xref: /third_party/node/test/fixtures/test-runner/custom_reporters/custom.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/fixtures/test-runner/custom_reporters/
11cb0ef41Sopenharmony_ciconst assert = require('assert');
21cb0ef41Sopenharmony_ciconst path = require('path');
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_cimodule.exports = async function * customReporter(source) {
51cb0ef41Sopenharmony_ci  const counters = {};
61cb0ef41Sopenharmony_ci  for await (const event of source) {
71cb0ef41Sopenharmony_ci    if (event.data.file) {
81cb0ef41Sopenharmony_ci      assert.strictEqual(event.data.file, path.resolve(__dirname, '../reporters.js'));
91cb0ef41Sopenharmony_ci    }
101cb0ef41Sopenharmony_ci    counters[event.type] = (counters[event.type] ?? 0) + 1;
111cb0ef41Sopenharmony_ci  }
121cb0ef41Sopenharmony_ci  yield "custom.js ";
131cb0ef41Sopenharmony_ci  yield JSON.stringify(counters);
141cb0ef41Sopenharmony_ci};
15

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