mirror of
https://github.com/appium/appium.git
synced 2026-04-22 18:40:00 -05:00
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`
This commit is contained in:
@@ -3,21 +3,19 @@
|
||||
"overrides": [
|
||||
{
|
||||
"files": "packages/fake-driver/**/*",
|
||||
"rules": { "require-await": "off" }
|
||||
"rules": {"require-await": "off"}
|
||||
},
|
||||
{ "files": "packages/support/**/*", "globals": { "BigInt": "readonly" } },
|
||||
{"files": "packages/support/**/*", "globals": {"BigInt": "readonly"}},
|
||||
{
|
||||
"files": "packages/*/test/**/*",
|
||||
"rules": { "func-names": "off" }
|
||||
"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"
|
||||
}
|
||||
@@ -26,7 +24,7 @@
|
||||
"files": "./packages/*/test/**/*.js",
|
||||
"rules": {
|
||||
"no-restricted-properties": [
|
||||
"error",
|
||||
"error",
|
||||
{
|
||||
"object": "sinon",
|
||||
"property": "spy",
|
||||
@@ -42,7 +40,7 @@
|
||||
"property": "mock",
|
||||
"message": "Use `sandbox = sinon.createSandbox()` and `sandbox.mock()` instead. Don't forget to call `sandbox.restore()` in `afterEach`"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
"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",
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
"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",
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"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"
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"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",
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
"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",
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
"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",
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
"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",
|
||||
|
||||
@@ -41,6 +41,6 @@
|
||||
"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\""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
"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",
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"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",
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"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",
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// 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'});
|
||||
+8
-1
@@ -1,4 +1,5 @@
|
||||
'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
|
||||
@@ -10,9 +11,15 @@
|
||||
* 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');
|
||||
|
||||
Reference in New Issue
Block a user