• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Flags: --test --expose-internals
2'use strict';
3
4const v8_reporter = require('internal/test_runner/reporter/v8-serializer');
5const { Buffer } = require('buffer');
6
7
8(async function () {
9  const reported = v8_reporter([
10    { type: "test:pass", data: { name: "test", nesting: 0, file: __filename, testNumber: 1, details: { duration_ms: 0 } } }
11  ]);
12
13  for await (const chunk of reported) {
14    process.stdout.write(chunk);
15    process.stdout.write(Buffer.concat([Buffer.from("arbitrary - pre"), chunk]));
16    process.stdout.write(Buffer.from("arbitrary - mid"));
17    process.stdout.write(Buffer.concat([chunk, Buffer.from("arbitrary - post")]));
18  }
19})();
20
21