Skip to content

armgit / mocha

Public Imported from GitHub
0

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

remove SIGINT handler for single runs; see #3570

Christopher Hillera63ab5f8799e
diff --git a/lib/cli/run-helpers.js b/lib/cli/run-helpers.js
index e574e1fb..3afa7143 100644
--- a/lib/cli/run-helpers.js
+++ b/lib/cli/run-helpers.js
@@ -190,22 +190,12 @@ exports.handleFiles = ({
* @param {Options} [opts] - Options
* @param {string[]} [opts.files] - List of test files
* @param {boolean} [opts.exit] - Whether or not to force-exit after tests are complete
+ * @returns {Runner}
* @private
*/
exports.singleRun = (mocha, {files = [], exit = false} = {}) => {
mocha.files = files;
- const runner = mocha.run(exit ? exitMocha : exitMochaLater);
-
- process.once('SIGINT', () => {
- debug('aborting runner');
- runner.abort();
-
- // This is a hack:
- // Instead of `process.exit(130)`, set runner.failures to 130 (exit code for SIGINT)
- // The amount of failures will be emitted as error code later
- runner.failures = 130;
- setImmediate(() => process.kill(process.pid, 'SIGINT'));
- });
+ return mocha.run(exit ? exitMocha : exitMochaLater);
};
/**