refactor: better test errors (#59006)

This commit is contained in:
Oliver Eyton-Williams 2025-02-26 21:17:40 +01:00 committed by GitHub
parent ab3cbbe980
commit 3ba3fbe7c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);