2023-01-02 16:00:42 -05:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
2021-05-19 00:24:01 +09:00
|
|
|
|
2021-01-27 15:06:18 +01:00
|
|
|
window.add_result_callback(({ message, name, stack, status }) => {
|
2021-05-19 00:24:01 +09:00
|
|
|
const data = new TextEncoder().encode(
|
|
|
|
`${JSON.stringify({ name, status, message, stack })}\n`,
|
2021-01-27 15:06:18 +01:00
|
|
|
);
|
2021-05-19 00:24:01 +09:00
|
|
|
let bytesWritten = 0;
|
|
|
|
while (bytesWritten < data.byteLength) {
|
|
|
|
bytesWritten += Deno.stderr.writeSync(data.subarray(bytesWritten));
|
|
|
|
}
|
2021-01-27 15:06:18 +01:00
|
|
|
});
|
|
|
|
|
2021-06-06 18:08:50 +02:00
|
|
|
window.add_completion_callback((_tests, harnessStatus) => {
|
|
|
|
const data = new TextEncoder().encode(
|
|
|
|
`#$#$#${JSON.stringify(harnessStatus)}\n`,
|
|
|
|
);
|
|
|
|
let bytesWritten = 0;
|
|
|
|
while (bytesWritten < data.byteLength) {
|
|
|
|
bytesWritten += Deno.stderr.writeSync(data.subarray(bytesWritten));
|
|
|
|
}
|
2022-06-17 11:05:02 -04:00
|
|
|
|
|
|
|
// TODO(cjihrig): Restore the prototype of globalThis to be an EventTarget
|
|
|
|
// again. There are WPTs that change the prototype, which causes brand
|
|
|
|
// checking to fail. Once the globalThis prototype is frozen properly, this
|
|
|
|
// line can be removed.
|
|
|
|
Object.setPrototypeOf(globalThis, EventTarget.prototype);
|
|
|
|
|
2021-06-11 21:31:53 +02:00
|
|
|
Deno.exit(harnessStatus.status === 0 ? 0 : 1);
|
2021-01-27 15:06:18 +01:00
|
|
|
});
|