diff --git a/test/common/wpt/worker.js b/test/common/wpt/worker.js index afaee075f7a32e..c61de78c9ed729 100644 --- a/test/common/wpt/worker.js +++ b/test/common/wpt/worker.js @@ -7,6 +7,8 @@ const { parentPort, workerData } = require('worker_threads'); const { ResourceLoader } = require(workerData.wptRunner); const resource = new ResourceLoader(workerData.wptPath); +const completedTests = new Set(); +let currentlyRunningTest; global.self = global; global.GLOBAL = { @@ -31,6 +33,7 @@ runInThisContext(workerData.harness.code, { // eslint-disable-next-line no-undef add_result_callback((result) => { + completedTests.add(currentlyRunningTest); parentPort.postMessage({ type: 'result', result: { @@ -51,5 +54,12 @@ add_completion_callback((_, status) => { }); for (const scriptToRun of workerData.scriptsToRun) { - runInThisContext(scriptToRun.code, { filename: scriptToRun.filename }); + try { + currentlyRunningTest = scriptToRun; + runInThisContext(scriptToRun.code, { filename: scriptToRun.filename }); + } catch (err) { + if (!completedTests.has(scriptToRun)) { + throw err; + } + } }