1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00
denoland-deno/tools/wpt/testharnessreport.js
Ryan Dahl 4775d57867
chore: update copyright to 2022 (#13306)
Co-authored-by: Erfan Safari <erfanshield@outlook.com>
2022-01-12 16:24:10 +01:00

22 lines
747 B
JavaScript

// Copyright 2018-2022 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) => {
const data = new TextEncoder().encode(
`#$#$#${JSON.stringify(harnessStatus)}\n`,
);
let bytesWritten = 0;
while (bytesWritten < data.byteLength) {
bytesWritten += Deno.stderr.writeSync(data.subarray(bytesWritten));
}
Deno.exit(harnessStatus.status === 0 ? 0 : 1);
});