Commit Graph

5 Commits

Author SHA1 Message Date
Christopher Hiller d31aaf9916 chore: update TS configuration
This pulls in some recommended settings from `@tsconfig/node14` (a proper TS target configuration for Node.js v14; ours wasn't _wrong_ per se, but this is better) and allows us more flexible use of `ts-node`.  Use of this module is recommended by `ts-node` (which we need to run tests).

`ts-node`'s behavior changes _depending on the directory in which it's run_--and this can cause some really nonsensical bugs--so the changes here ensure that it will act the same regardless of if you're running tests from a package directory or the monorepo root.

Also:

- Ensure various `clean` scripts don't fail if they've been run before `build`
- Enable `strict` mode in `@appium/types` cause we can
- Fix a type issue found in `@appium/support`; this does not appear to have been a traditional bug but rather a type disagreement surfaced by the new config

# Conflicts:
#	package-lock.json
#	packages/typedoc-plugin-appium/tsconfig.json
2022-12-06 18:08:15 -08:00
Christopher Hiller 3c32112c20 chore: use tsc for compilation across the board
- `@appium/gulp-plugins` does not use `tsc` and continues to use...whatever it uses.
- `@appium/doctor` now has generated declarations, though I didn't bother to do anything with the types
- rewrote swaths of build scripts:
  - removed the `fix` and `lint` scripts from each workspace (package) since I don't think they get used and they are of limited value
  - for tests and autoinstallation of extensions, added `ts-node` for on-the-fly compilation
  - workspaces _can_ define their own `build` and `clean` scripts (both should be required if either is used).  these do not currently get run when running `npm run dev`, but they do occur on a bare `npm install` from the monorepo root or a `npm run reinstall`.
  - `npm run rebuild` does a fresh rebuild, but does not clean any `node_modules` dirs nor does it reinstall anything.
  - removed `prepublishOnly` since `preversion` does the same thing
  - `npm test` now runs `build`/`lint` in parallel
- postinstall script of `appium` ("autoinstall") script now must call `npm run build` if in a fresh dev environment. this is because a) lifecycle scripts of packages run before lifecycle scripts in the monorepo root, and b) `postinstall` runs before `prepare`. so there's really no way around it; even using `ts-node` fails because other modules depend on `@appium/support/index.js` which expects the pkg to be built.

Closes #17746
Closes #17807
2022-12-06 11:21:05 -08:00
Christopher Hiller 882a5f4d5e chore: unify test setup fixture
Moved the stuff in `test/setup-babel` into `test/setup` and then removed some cruft in the `test:*` scripts of each package referencing `test/setup-babel`
2022-04-14 14:30:00 -07:00
Christopher Hiller f0cb12d2e8 chore(eslint-config-appium): dev & test env improvements
- add `jsconfig.json` for the TS language server to understand the project
- update `.wallaby.js` to transpile fixtures if necessary; run on save to reduce lag
- update single-file Mocha debug launch config
- add `test` env in `babel.config.json` which is used by the former
- add some handy vscode tasks
- add a bunch of types
- remove unused `babel-eslint` (we use `@babel/eslint-parser`)
- bump `ecmaVersion` in `eslint-config-appium`
- remove cruft from babel configs (`shippedProposals: true` goes a long way)
- enable `sinon-chai` globally in tests
- add `rewiremock` for module-level mocking (sinon cannot do this itself, but they work in tandem)
2021-10-20 11:39:59 -07:00
Christopher Hiller ee00285b38 chore: global chai
This PR makes `chai` and `should()` _globals_ when using Mocha:

- `chai` is configured with `chai-as-promised`
- A `.mocharc.js` requires `./test/setup.js` _from the monorepo root_.
- Updated the ESLint config to recognize the globals.
- Updated Wallaby config

All instances of `import chai...` and the like have been removed from all test files.
2021-08-13 10:40:52 -07:00