xref: /third_party/node/test/fixtures/test-runner/custom_reporters/custom.cjs
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/fixtures/test-runner/custom_reporters/
11cb0ef41Sopenharmony_ciconst { Transform } = require('node:stream');
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst customReporter = new Transform({
41cb0ef41Sopenharmony_ci  writableObjectMode: true,
51cb0ef41Sopenharmony_ci  transform(event, encoding, callback) {
61cb0ef41Sopenharmony_ci    this.counters ??= {};
71cb0ef41Sopenharmony_ci    this.counters[event.type] = (this.counters[event.type] ?? 0) + 1;
81cb0ef41Sopenharmony_ci    callback();
91cb0ef41Sopenharmony_ci  },
101cb0ef41Sopenharmony_ci  flush(callback) {
111cb0ef41Sopenharmony_ci    this.push('custom.cjs ')
121cb0ef41Sopenharmony_ci    this.push(JSON.stringify(this.counters));
131cb0ef41Sopenharmony_ci    callback();
141cb0ef41Sopenharmony_ci  }
151cb0ef41Sopenharmony_ci});
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_cimodule.exports = customReporter;
18

Indexes created Thu Nov 07 10:32:03 CST 2024