From 42e804e69b5e5dee640768e737ef985207b8d8cf Mon Sep 17 00:00:00 2001 From: Zheng Date: Tue, 26 Mar 2019 19:59:48 +0800 Subject: [PATCH] add switch for zeroExitCode even for failing tests --- config/cli/config/listeners.js | 4 +++- lib/console.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/cli/config/listeners.js b/config/cli/config/listeners.js index 2342e6c..852950d 100644 --- a/config/cli/config/listeners.js +++ b/config/cli/config/listeners.js @@ -20,7 +20,9 @@ module.exports = [{ }); tabl.push(['TOTALS', output.totals.pass, output.totals.fail, output.totals.total]); console.log(tabl.toString()); - process.exitCode = Math.min(output.totals.fail, 255); + + let zeroExitCode = context.config.get('profiles:base:zeroExitCode') || false + process.exitCode = zeroExitCode ? 0 : Math.min(output.totals.fail, 255); if (context.program.exit) { process.exit(); } diff --git a/lib/console.js b/lib/console.js index eaef951..e77d27a 100644 --- a/lib/console.js +++ b/lib/console.js @@ -19,7 +19,9 @@ module.exports = function (context, instances) { table.push(...getTableRows(output)); table.push(['TOTALS', output.totals.pass, output.totals.fail, output.totals.total]); console.log(table.toString()); - process.exitCode = Math.min(output.totals.fail, 255); + + let zeroExitCode = context.config.get('profiles:base:zeroExitCode') || false + process.exitCode = zeroExitCode ? 0 : Math.min(output.totals.fail, 255); if (context.program.exit) { process.exit(); }