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:
Simon Priet
2021-09-08 14:01:19 +02:00
parent 5fbd7c88fa
commit e69a613a37
5610 changed files with 740417 additions and 3 deletions

25
node_modules/node-oauth1/npm/test-browser.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env node
// ---------------------------------------------------------------------------------------------------------------------
// This script is intended to execute all unit tests in the Chrome Browser.
// ---------------------------------------------------------------------------------------------------------------------
/* eslint-env node, es6 */
require('shelljs/global');
var chalk = require('chalk'),
path = require('path'),
KARMA_CONFIG_PATH = path.join(__dirname, '..', 'test', 'karma.conf');
module.exports = function (exit) {
console.log(chalk.yellow.bold('Running unit tests within browser...'));
var KarmaServer = require('karma').Server;
(new KarmaServer({ // eslint-disable no-new
cmd: 'start',
configFile: KARMA_CONFIG_PATH
}, exit)).start();
};
// ensure we run this script exports if this is a direct stdin.tty run
!module.parent && module.exports(exit);

64
node_modules/node-oauth1/npm/test-unit.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
#!/usr/bin/env node
/* eslint-env node, es6 */
// ---------------------------------------------------------------------------------------------------------------------
// This script is intended to execute all unit tests.
// ---------------------------------------------------------------------------------------------------------------------
// set directories and files for test and coverage report
var path = require('path'),
NYC = require('nyc'),
sh = require('shelljs'),
chalk = require('chalk'),
recursive = require('recursive-readdir'),
COV_REPORT_PATH = '.coverage',
SPEC_SOURCE_DIR = path.join(__dirname, '..', 'test', 'unit');
module.exports = function (exit) {
// banner line
console.info(chalk.yellow.bold('Running unit tests using mocha on node...'));
sh.test('-d', COV_REPORT_PATH) && sh.rm('-rf', COV_REPORT_PATH);
sh.mkdir('-p', COV_REPORT_PATH);
var Mocha = require('mocha'),
nyc = new NYC({
hookRequire: true,
reporter: ['text', 'lcov', 'text-summary', 'json'],
reportDir: COV_REPORT_PATH,
tempDirectory: COV_REPORT_PATH
});
nyc.reset();
nyc.wrap();
// add all spec files to mocha
recursive(SPEC_SOURCE_DIR, function (err, files) {
if (err) { console.error(err); return exit(1); }
var mocha = new Mocha({ timeout: 1000 * 60 });
files.filter(function (file) { // extract all test files
return (file.substr(-8) === '.test.js');
}).forEach(mocha.addFile.bind(mocha));
mocha.run(function (runError) {
runError && console.error(runError.stack || runError);
nyc.writeCoverageFile();
nyc.report();
nyc.checkCoverage({
statements: 55,
branches: 40,
functions: 70,
lines: 55
});
exit(process.exitCode || runError ? 1 : 0);
});
});
};
// ensure we run this script exports if this is a direct stdin.tty run
!module.parent && module.exports(process.exit);