Files
appium/test/setup.js
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

28 lines
1.0 KiB
JavaScript

'use strict';
/**
* Mocha will load this file to configure the environment to use Chai as the
* assertion library. Since Chai is a singleton, we can run into problems when
* running files individually, if we have not carefully configured Chai in every
* single test file. This file means less boilerplate and less random test
* failures when running single test files.
*
* For simplicity, this file is _not_ transpiled. If it were, Mocha would need
* to load different versions of this file depending on the test context (are we
* running tests against the distfiles, or the source files?).
*
*/
require('ts-node').register();
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const sinonChai = require('sinon-chai');
// The `chai` global is set if a test needs something special.
// Most tests won't need this.
global.chai = chai.use(chaiAsPromised).use(sinonChai);
// `should()` is only necessary when working with some `null` or `undefined` values.
global.should = chai.should();