From a320962aa8a6917a2f937408ef1f9cbd091bb55e Mon Sep 17 00:00:00 2001 From: "M. George Hansen" Date: Mon, 1 Jun 2020 23:44:33 -0700 Subject: [PATCH] test: fix false-pos in runner due to exit code --- test/lib/harness.ts | 2 +- test/run-tests.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/lib/harness.ts b/test/lib/harness.ts index 3a6dde9..54515f9 100644 --- a/test/lib/harness.ts +++ b/test/lib/harness.ts @@ -114,7 +114,7 @@ export const testSuite = ( `[TEST] suite "${suiteName}": ${passed} of ${tests.length} succeeded\n\n` ); if (passed < tests.length) { - process.exit(1); + process.exitCode = 1; } })(); }; diff --git a/test/run-tests.ts b/test/run-tests.ts index f6b068e..6850b60 100644 --- a/test/run-tests.ts +++ b/test/run-tests.ts @@ -16,5 +16,9 @@ const files = fs.readdirSync(TEST_SUITES_DIR); shuffle(files); for (const file of files) { const fullPath = path.join(TEST_SUITES_DIR, file); - fork(path.relative(process.cwd(), fullPath)); + fork(path.relative(process.cwd(), fullPath)).on("exit", (code) => { + if (code !== 0) { + process.exitCode = 1; + } + }); }