jest-verify-node-version
Within Jest Setup, verify node version
This module uses process.version
to retrieve the current version of node.
Usage
const check = ; // use CWD package.json; // = true // provide package.json-like object; // = true
Example with Jest
// jest.config.js //... "globalSetup": "<rootDir>/global.setup.js" //... // global.setup.jsconst check = ; moduleexports = async { ;};
If the node version doesn't satisfy the engine node version range and doNotThrow
is not true, then the check
function will throw an error. For example:
$ npm test > example-module@1.0.0 test /Users/julian/dev/example-module> jest Error: node version v10.16.3, does not satisfy engine requirement of >=12.13.0