Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Ensure process exit code is preserved when using --no-exit

Glen Mailer8aafaa495326
diff --git a/bin/_mocha b/bin/_mocha
index 055e3ea1..32c82a06 100644
--- a/bin/_mocha
+++ b/bin/_mocha
@@ -348,7 +348,11 @@ if (program.watch) {
// load
mocha.files = files;
-mocha.run(program.exit ? process.exit : function() {});
+mocha.run(program.exit ? process.exit : exitLater);
+
+function exitLater(code) {
+ process.on('exit', function() { process.exit(code) })
+}
// enable growl notifications