From cdf0705fb265a2b2e5d1a15f872eb43a6e0c7f2d Mon Sep 17 00:00:00 2001 From: Binayak Ghosh Date: Fri, 25 Mar 2022 14:01:56 -0700 Subject: [PATCH] fix mocha exitCode issue nightwatchjs#3001 (#3039) --- lib/runner/process-listener.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/runner/process-listener.js b/lib/runner/process-listener.js index 5cd01efbcd..0ee1496533 100644 --- a/lib/runner/process-listener.js +++ b/lib/runner/process-listener.js @@ -48,11 +48,7 @@ module.exports = class { } onExit(code) { - if (code > 0) { - this.setExitCode(code); - } - - this.exit(); + this.process.exitCode = code || this.exitCode; } unhandled(err) { @@ -110,7 +106,7 @@ module.exports = class { exit() { this.process.exit && this.process.exit(this.exitCode); - + return this; } };