feat: ✨ Created a mini nodeJS server with NewMan for testing without PostMan GUI.
This will mimic a run in a CD/CI environment or docker container.
This commit is contained in:
30
node_modules/newman/lib/node-version-check/index.js
generated
vendored
Normal file
30
node_modules/newman/lib/node-version-check/index.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
var semver = require('semver'),
|
||||
colors = require('colors/safe'),
|
||||
pkg = require('../../package.json'),
|
||||
|
||||
/**
|
||||
* The required node version from package.json.
|
||||
*
|
||||
* @type {String}
|
||||
* @readOnly
|
||||
*/
|
||||
requiredNodeVersion = pkg && pkg.engines && pkg.engines.node,
|
||||
|
||||
/**
|
||||
* The current node version as detected from running process.
|
||||
*
|
||||
* @type {String}
|
||||
* @readOnly
|
||||
*/
|
||||
currentNodeVersion = process && process.version;
|
||||
|
||||
// if either current or required version is not detected, we bail out
|
||||
if (!(requiredNodeVersion && currentNodeVersion)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we check semver satisfaction and throw error on mismatch
|
||||
if (!semver.satisfies(currentNodeVersion, requiredNodeVersion)) {
|
||||
console.error([colors.red('newman:'), 'required node version', requiredNodeVersion].join(' '));
|
||||
process.exit(1);
|
||||
}
|
Reference in New Issue
Block a user