2024-01-01 14:58:21 -05:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2021-05-18 11:24:01 -04:00
|
|
|
|
2021-01-27 09:06:18 -05:00
|
|
|
window.add_result_callback(({ message, name, stack, status }) => {
|
2021-05-18 11:24:01 -04:00
|
|
|
const data = new TextEncoder().encode(
|
|
|
|
`${JSON.stringify({ name, status, message, stack })}\n`,
|
2021-01-27 09:06:18 -05:00
|
|
|
);
|
2021-05-18 11:24:01 -04:00
|
|
|
let bytesWritten = 0;
|
|
|
|
while (bytesWritten < data.byteLength) {
|
|
|
|
bytesWritten += Deno.stderr.writeSync(data.subarray(bytesWritten));
|
|
|
|
}
|
2021-01-27 09:06:18 -05:00
|
|
|
});
|
|
|
|
|
2021-06-06 12:08:50 -04: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 15:31:53 -04:00
|
|
|
Deno.exit(harnessStatus.status === 0 ? 0 : 1);
|
2021-01-27 09:06:18 -05:00
|
|
|
});
|