From 3ba3fbe7c3a2ccd5cdaeeb206aff4c86dfd9a8ee Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Wed, 26 Feb 2025 21:17:40 +0100 Subject: [PATCH] refactor: better test errors (#59006) --- curriculum/test/test-challenges.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/curriculum/test/test-challenges.js b/curriculum/test/test-challenges.js index 0d261a56005..446bf1f0bf3 100644 --- a/curriculum/test/test-challenges.js +++ b/curriculum/test/test-challenges.js @@ -73,6 +73,7 @@ process.on('uncaughtException', err => { // some errors *may* not be reported, since cleanup is triggered by the first // error and that starts shutting down the browser and the server. const handleRejection = err => { + console.error('Unhandled rejection:'); // setting the error code because node does not (yet) exit with a non-zero // code on unhandled exceptions. process.exitCode = 1; @@ -631,7 +632,7 @@ async function getContextEvaluator(build, sources, code, loadEnzyme) { evaluate: async (testString, timeout) => Promise.race([ new Promise((_, reject) => - setTimeout(() => reject('timeout'), timeout) + setTimeout(() => reject(Error('timeout')), timeout) ), await page.evaluate(async testString => { return await document.__runTest(testString);