From 33f2e337dd5e6d03680680f35364ea2ca5d1c3d7 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 6 May 2024 06:29:30 +0100 Subject: [PATCH] Update test logic to display all test errors --- tests/helpers/run.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/helpers/run.js b/tests/helpers/run.js index 2aba038..cfe67ba 100644 --- a/tests/helpers/run.js +++ b/tests/helpers/run.js @@ -16,8 +16,10 @@ const stackLog = (err) => { }; const run = async (tests) => { - try { - for (let i = 0; i < tests.length; i += 1) { + let errorsEncountered = false; + + for (let i = 0; i < tests.length; i += 1) { + try { // eslint-disable-next-line no-console console.log(`[${os.platform()}] ${scriptName}: test ${i}`); const test = tests[i]; @@ -69,10 +71,14 @@ const run = async (tests) => { chai.assert.deepEqual(testOutput, expectedOutput); } } + } catch (err) { + // eslint-disable-next-line no-console + stackLog(err); + errorsEncountered = true; } - } catch (err) { - // eslint-disable-next-line no-console - stackLog(err); + } + + if (errorsEncountered) { process.exit(1); } };