1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
denoland-deno/tools/wpt/testharnessreport.js

24 lines
659 B
JavaScript

// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
window.add_result_callback(({ message, name, stack, status }) => {
const data = new TextEncoder().encode(
`${JSON.stringify({ name, status, message, stack })}\n`,
);
let bytesWritten = 0;
while (bytesWritten < data.byteLength) {
bytesWritten += Deno.stderr.writeSync(data.subarray(bytesWritten));
}
});
window.add_completion_callback((_tests, _harnessStatus) => {
Deno.exit(0);
});
globalThis.document = {
// document.body shim for FileAPI/file/File-constructor.any.html test
body: {
toString() {
return "[object HTMLBodyElement]";
},
},
};