Ensured that tests are not run without the minimum required node version
This commit is contained in:
Родитель
697f1bc4f3
Коммит
9dd81c4d6f
|
@ -98,8 +98,6 @@ Code at [/test/functional_tests.js](/test/functional_tests.js).
|
||||||
|
|
||||||
Note: The study variation/branch during tests is overridden by a preference in the FIREFOX_PREFERENCES section of `test/utils.js`.
|
Note: The study variation/branch during tests is overridden by a preference in the FIREFOX_PREFERENCES section of `test/utils.js`.
|
||||||
|
|
||||||
(The functional tests are using async/await, so make sure you are running Node 7.6+)
|
|
||||||
|
|
||||||
The functional testing set-up is a minimal set of tests imported from <https://github.com/mozilla/share-button-study> which contains plenty of examples of functional tests relevant to Shield study addons.
|
The functional testing set-up is a minimal set of tests imported from <https://github.com/mozilla/share-button-study> which contains plenty of examples of functional tests relevant to Shield study addons.
|
||||||
|
|
||||||
## Directory Structure and Files
|
## Directory Structure and Files
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
"lint:web-ext-lint": "WEB_EXT_VERBOSE=false web-ext lint",
|
"lint:web-ext-lint": "WEB_EXT_VERBOSE=false web-ext lint",
|
||||||
"postformat": "npm run eslint-fix",
|
"postformat": "npm run eslint-fix",
|
||||||
"prebuild": "npm run bundle-utils",
|
"prebuild": "npm run bundle-utils",
|
||||||
|
"pretest": "node test/ensure_minimum_node_version.js",
|
||||||
"prewatch": "npm run bundle-utils",
|
"prewatch": "npm run bundle-utils",
|
||||||
"sign": "echo 'TBD, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1407757'",
|
"sign": "echo 'TBD, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1407757'",
|
||||||
"start": "web-ext run --no-reload",
|
"start": "web-ext run --no-reload",
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* eslint-env node */
|
||||||
|
|
||||||
|
const semver = require("semver");
|
||||||
|
const requiredNodeEngineVersion = require("../package.json").engines.node;
|
||||||
|
const currentNodeEngineVersion = process.versions.node;
|
||||||
|
if (!semver.satisfies(currentNodeEngineVersion, requiredNodeEngineVersion)) {
|
||||||
|
console.error(
|
||||||
|
`Node version needs to be ${requiredNodeEngineVersion} for tests to run. Currently ${currentNodeEngineVersion}. Exiting...`,
|
||||||
|
);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче