Ensured that tests are not run without the minimum required node version

This commit is contained in:
Fredrik Wollsén 2018-03-22 12:49:58 +02:00 коммит произвёл Gregg Lind
Родитель 697f1bc4f3
Коммит 9dd81c4d6f
3 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -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`.
(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.
## Directory Structure and Files

Просмотреть файл

@ -60,6 +60,7 @@
"lint:web-ext-lint": "WEB_EXT_VERBOSE=false web-ext lint",
"postformat": "npm run eslint-fix",
"prebuild": "npm run bundle-utils",
"pretest": "node test/ensure_minimum_node_version.js",
"prewatch": "npm run bundle-utils",
"sign": "echo 'TBD, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1407757'",
"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);
}