fix: propagate top level thrown errors in WPT (#10932)

Previously top level errors were swallowed.
This commit is contained in:
Luca Casonato 2021-06-11 21:31:53 +02:00 committed by GitHub
parent c7ed125590
commit 614dc1bce7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -168,9 +168,13 @@ async function generateBundle(location: URL): Promise<string> {
}
}
return scriptContents.map(([url, contents]) =>
`Deno.core.evalContext(${JSON.stringify(contents)}, ${
JSON.stringify(url)
});`
).join("\n");
return scriptContents.map(([url, contents]) => `
(function() {
const [_,err] = Deno.core.evalContext(${JSON.stringify(contents)}, ${
JSON.stringify(url)
});
if (err !== null) {
throw err?.thrown;
}
})();`).join("\n");
}

View file

@ -18,5 +18,5 @@ window.add_completion_callback((_tests, harnessStatus) => {
while (bytesWritten < data.byteLength) {
bytesWritten += Deno.stderr.writeSync(data.subarray(bytesWritten));
}
Deno.exit(0);
Deno.exit(harnessStatus.status === 0 ? 0 : 1);
});