Fix missing non-zero exit code for failure cases in test.mjs

The two affected code paths caught and logged errors, but that wasn't
reflected in the exit code of the process, and that is what GitHub
Actions (and other tools) to determine if process execution was
successful or not. This commit fixes the issue by making sure we
consistently exit with code 1 in case of errors so that GitHub Actions
pipelines correctly reflect the outcome of the test run.
This commit is contained in:
Tim van der Meij 2026-05-29 19:16:17 +02:00
parent 80c8e62e65
commit 8d5fe521b3
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -1148,6 +1148,7 @@ async function startBrowsers({ baseUrl, initializeSession, numSessions = 1 }) {
})
.catch(function (ex) {
console.log(`Error while starting ${browserName}: ${ex.message}`);
session.numErrors = 1;
closeSession(sessionName);
});
}
@ -1395,6 +1396,7 @@ async function main() {
// because the teardown logic of the tests did not get a chance to run.
console.error(e);
await Promise.all(sessions.map(session => closeSession(session.name)));
process.exit(1);
}
}