summaryrefslogtreecommitdiff
path: root/tools/wpt/testharnessreport.js
blob: b1852a4886f53474b888be9431018484638e76ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 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]";
    },
  },
};