Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/mocha-3.1.0/bin/mocha')
-rw-r--r--tests/lib/mocha-3.1.0/bin/mocha81
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.0/bin/mocha b/tests/lib/mocha-3.1.0/bin/mocha
new file mode 100644
index 0000000000..0c16f0ee94
--- /dev/null
+++ b/tests/lib/mocha-3.1.0/bin/mocha
@@ -0,0 +1,81 @@
+#!/usr/bin/env node
+
+/**
+ * This tiny wrapper file checks for known node flags and appends them
+ * when found, before invoking the "real" _mocha(1) executable.
+ */
+
+var spawn = require('child_process').spawn;
+var path = require('path');
+var getOptions = require('./options');
+var args = [path.join(__dirname, '_mocha')];
+
+// Load mocha.opts into process.argv
+// Must be loaded here to handle node-specific options
+getOptions();
+
+process.argv.slice(2).forEach(function(arg) {
+ var flag = arg.split('=')[0];
+
+ switch (flag) {
+ case '-d':
+ args.unshift('--debug');
+ args.push('--no-timeouts');
+ break;
+ case 'debug':
+ case '--debug':
+ case '--debug-brk':
+ case '--inspect':
+ args.unshift(arg);
+ args.push('--no-timeouts');
+ break;
+ case '-gc':
+ case '--expose-gc':
+ args.unshift('--expose-gc');
+ break;
+ case '--gc-global':
+ case '--es_staging':
+ case '--no-deprecation':
+ case '--prof':
+ case '--log-timer-events':
+ case '--throw-deprecation':
+ case '--trace-deprecation':
+ case '--use_strict':
+ case '--allow-natives-syntax':
+ case '--perf-basic-prof':
+ args.unshift(arg);
+ break;
+ default:
+ if (arg.indexOf('--harmony') === 0) {
+ args.unshift(arg);
+ } else if (arg.indexOf('--trace') === 0) {
+ args.unshift(arg);
+ } else if (arg.indexOf('--icu-data-dir') === 0) {
+ args.unshift(arg);
+ } else if (arg.indexOf('--max-old-space-size') === 0) {
+ args.unshift(arg);
+ } else if (arg.indexOf('--preserve-symlinks') === 0) {
+ args.unshift(arg);
+ } else {
+ args.push(arg);
+ }
+ break;
+ }
+});
+
+var proc = spawn(process.execPath, args, { stdio: 'inherit' });
+proc.on('exit', function(code, signal) {
+ process.on('exit', function() {
+ if (signal) {
+ process.kill(process.pid, signal);
+ } else {
+ process.exit(code);
+ }
+ });
+});
+
+// terminate children.
+process.on('SIGINT', function() {
+ proc.kill('SIGINT'); // calls runner.abort()
+ proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die.
+});