☕️ Classic, reliable, trusted test framework for Node.js and the browser
Rewrite the 'mocha' wrapper script as a node script.
Nathan Rajlich6fa9d8ae889a
diff --git a/bin/mocha b/bin/mochaindex a0704a7a..faaa5184 100755--- a/bin/mocha+++ b/bin/mocha@@ -1,15 +1,19 @@-#!/usr/bin/env bash+#!/usr/bin/env node-DEBUG=0+/**+ * This tiny wrapper file checks for known node flags and appends them+ * when found, before invoking the "real" _mocha executable.+ */-for arg in $@; do- case $arg in- -d|--debug) DEBUG=1 ;;- esac-done+var spawn = require('child_process').spawn+ , args = process.argv.slice(2)-if test $DEBUG -eq 1; then- node debug $(dirname $0)/_mocha $@-else- node $(dirname $0)/_mocha $@-fi+args.unshift(__dirname + '/_mocha');++process.argv.forEach(function (arg) {+ if (/^(-d|--debug)$/.test(arg)) {+ args.unshift('debug');+ }+});++spawn(process.argv[0], args, { customFds: [0,1,2] });