Some CLI args can be interpreted as filenames or JSON/CSV blobs. Appium first assumes the value is a file and attempts to open it. But if a blob is given and it is of some _problematic length_, the OS will throw an `ENAMETOOLONG` exception trying to open a filepath with a huge blob. If the JSON is reasonably small, an `ENOENT` will be thrown instead. Previous to this change, we were only looking for `ENOENT`; now we treat `ENAMETOOLONG` errors as JSON blobs. If the problem is that the filename _is_ actually too long, the user will get an "invalid JSON" error, which will probably be confusing, but is less likely to happen than the more-common error this addresses.
If someone complains about it in the future, we can take another look, but it's going to take more effort than it's worth atm to fix it (imo).
BREAKING CHANGE:
This change upgrades to ESLint v8 and removes `@babel/eslint-parser`, which is only necessary if we're using mid-stage TC39 proposals (which we aren't). I think `@babel/core` was a peer dep of `@babel/eslint-parser`, so I removed that too. And removed cruft from the main configuration.
ESLint rules _very likely_ had breaking changes, but I didn't experience any on our codebase. However, this version of ESLint seems to be incompatible with `gulp-eslint`, so `@appium/gulp-plugins` should be held back from upgrading.
In addition:
- Updated `README.md`
- Updated some fields in `package.json`
- Loosened `peerDependencies`, as they're supposed to be loose.
This package was missing `@appium/types`, which means packages consuming `@appium/support` which _don't_ also consume `appium` in some capacity will have types that won't compile, e.g., `teen_process`.
This PR passes a `cliArgs` parameter to the static method `updateServer` of drivers and plugins so they can take action on the server configuration based on the content of the arguments.
Note that `cliArgs` is a misnomer, because these args can also come from configuration files.
Closes#17304
I'm not sure _what_ happened here other than "the types weren't strict enough" otherwise I would have noticed this earlier. Anyway; the check to see if we should dig into the config object to normalize the keys was getting passed _something_ but that _something_ wasn't anything it expected.
As a result, I needed to update some tests which assumed `readConfigFile()` resolved w/ an identity w/r/t the config file itself. It doesn't give the config file back verbatim any longer; the result will be normalized to camel-case keys (or whatever the `appiumCliDest` property is, if it exists)
* docs(appium): reorganize migration doc info so that appropriate bits are in their own docs
* Update packages/appium/docs/en/ecosystem/build-drivers.md
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* Update packages/appium/docs/en/ecosystem/build-drivers.md
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* Update packages/appium/docs/en/guides/caps.md
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* Update packages/appium/docs/en/guides/caps.md
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* Update packages/appium/docs/en/guides/config.md
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* Update packages/appium/docs/en/guides/config.md
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* Update packages/appium/docs/en/guides/config.md
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* Update packages/appium/docs/en/guides/config.md
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* Update packages/appium/docs/en/guides/config.md
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* Update packages/appium/docs/en/guides/migrating-1-to-2.md
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* add header for extensions
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
This adds a test (which currently only runs automatically in CI) which installs the uiautomator2 driver. This will ensure that driver installation does not only work in a dev environment!
Due to needing to support Windows and not wishing to befoul the default `APPIUM_HOME`, we need `cross-env` as a production dependency (otherwise the smoke test would fail) to set a temporary `APPIUM_HOME` (`local_appium_home`) which is relative to the temp dir used by the smoke test (see https://github.com/boneskull/nodejs-production-test-action)
Also fix duplication of error messages about engines.
Unfortunately this adds another startup delay, but I'm unsure of a better way around it. I guess bundling our own npm might work!