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`
MODIFY
.eslintrc
.eslintrc
"rules": {"func-names": "off"}
},
{
- "files": "./packages/*/scripts/**/*.js",
- "parserOptions": {
- "sourceType": "script"
- }
- },
- {
- "files": "./packages/*/index.js",
+ "files": [
+ "./packages/*/index.js",
+ "./packages/*/scripts/**/*.js",
+ "./test/*.js"
+ ],
"parserOptions": {
"sourceType": "script"
}

MODIFY
packages/appium/package.json
packages/appium/package.json
"postinstall": "node ./scripts/postinstall.js",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:e2e": "mocha --require ../../test/setup-babel.js --timeout 30s --slow 15s \"./test/e2e/**/*.spec.js\"",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:e2e": "mocha --timeout 30s --slow 15s \"./test/e2e/**/*.spec.js\"",
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/base-driver": "file:../base-driver",

MODIFY
packages/base-driver/package.json
packages/base-driver/package.json
"fix": "npm run lint -- --fix",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:e2e": "mocha --require ../../test/setup-babel.js --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/support": "file:../support",

MODIFY
packages/base-plugin/package.json
packages/base-plugin/package.json
"fix": "npm run lint -- --fix",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/support": "file:../support"

MODIFY
packages/doctor/package.json
packages/doctor/package.json
"fix": "npm run lint -- --fix",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/support": "file:../support",

MODIFY
packages/fake-driver/package.json
packages/fake-driver/package.json
"fix": "npm run lint -- --fix",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:e2e": "mocha --require ../../test/setup-babel.js --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/base-driver": "file:../base-driver",

MODIFY
packages/images-plugin/package.json
packages/images-plugin/package.json
"fix": "npm run lint -- --fix",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:e2e": "mocha --require ../../test/setup-babel.js --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/base-driver": "file:../base-driver",

MODIFY
packages/opencv/package.json
packages/opencv/package.json
"fix": "npm run lint -- --fix",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:e2e": "mocha --require ../../test/setup-babel.js --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@babel/runtime": "7.17.9",

MODIFY
packages/relaxed-caps-plugin/package.json
packages/relaxed-caps-plugin/package.json
"fix": "npm run lint -- --fix",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
}
}

MODIFY
packages/support/package.json
packages/support/package.json
"fix": "npm run lint -- --fix",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:e2e": "mocha --require ../../test/setup-babel.js --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@babel/runtime": "7.17.9",

MODIFY
packages/test-support/package.json
packages/test-support/package.json
"fix": "npm run lint -- --fix",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/support": "file:../support",

MODIFY
packages/universal-xml-plugin/package.json
packages/universal-xml-plugin/package.json
"fix": "npm run lint -- --fix",
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
"test": "npm run test:unit",
- "test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
+ "test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/base-driver": "file:../base-driver",

DELETE
test/setup-babel.js
-// This configures @babel/register to look for a babel config in parent dir(s) of
-// wherever the tests are run. This is required if running tests via `mocha` in a package dir
-// instead of the monorepo root. This does not affect `gulp-mocha`, since it has its own `.babelrc`.
-// This file is required _in addition to_ the monorepo root's `test/setup.js`.
-
-require('@babel/register')({rootMode: 'upward'});

MODIFY
test/setup.js
test/setup.js
'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
* to load different versions of this file depending on the test context (are we
* running tests against the distfiles, or the source files?).
*
- * @module
*/
+// This configures @babel/register to look for a babel config in parent dir(s) of
+// wherever the tests are run. This is required if running tests via `mocha` in a package dir
+// instead of the monorepo root. This does not affect `gulp-mocha`, since it has its own `.babelrc`.
+// This file is required _in addition to_ the monorepo root's `test/setup.js`.
+
+require('@babel/register')({rootMode: 'upward'});
+
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const sinonChai = require('sinon-chai');

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`