2022-01-07 22:09:52 -05:00
|
|
|
// Copyright 2018-2022 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));
|
|
|
|
}
|
2021-06-11 21:31:53 +02:00
|
|
|
Deno.exit(harnessStatus.status === 0 ? 0 : 1);
|
2021-01-27 15:06:18 +01:00
|
|
|
});
|