From 0f95a7d73355ce9ab299c9f8dfa983b897ecf2fc Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 23 Jan 2019 23:10:31 +0100 Subject: [PATCH] do not recursively call `process.exit()` (#3684) * do not recursively call `process.exit()` When inside `process.on('exit')`, calling `process.exit()` stops other `exit` event listeners from being invoked. This has lead to issues with coverage generation with `nyc` because a fallback exit detection mechanism in it that relies on internal Node.js APIs was accidentally disabled in Node v11.7.0, leaving `nyc` with no way to detect process exit. Refs: https://github.com/nodejs/node/issues/25650 * Revert "pin default Node.js version to v11.6.0 in .travis.yml" This reverts commit 1abfef606d7a72c2f73c06805d6c11211315486b. --- .travis.yml | 2 +- lib/cli/run-helpers.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 02d4c47142..2de2a30cdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ stages: # defaults language: node_js -node_js: '11.6' +node_js: '11' addons: apt: packages: diff --git a/lib/cli/run-helpers.js b/lib/cli/run-helpers.js index df53117fec..d953a06909 100644 --- a/lib/cli/run-helpers.js +++ b/lib/cli/run-helpers.js @@ -25,7 +25,7 @@ const cwd = (exports.cwd = process.cwd()); */ const exitMochaLater = code => { process.on('exit', () => { - process.exit(Math.min(code, 255)); + process.exitCode = Math.min(code, 255); }); };