node/test/fixtures/test-runner/node_modules/reporter-esm/index.mjs
Geoffrey Booth 12c0571c8f
module: move test reporter loading
Move the logic for handling --test-reporter out of the
general module loader and into the test_runner subsystem.

PR-URL: https://github.com/nodejs/node/pull/45923
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-12-22 21:40:32 +00:00

8 lines
252 B
JavaScript

export default async function * customReporter(source) {
const counters = {};
for await (const event of source) {
counters[event.type] = (counters[event.type] ?? 0) + 1;
}
yield "package: reporter-esm";
yield JSON.stringify(counters);
};