1const assert = require('assert');
2const path = require('path');
3
4module.exports = async function * customReporter(source) {
5  const counters = {};
6  for await (const event of source) {
7    if (event.data.file) {
8      assert.strictEqual(event.data.file, path.resolve(__dirname, '../reporters.js'));
9    }
10    counters[event.type] = (counters[event.type] ?? 0) + 1;
11  }
12  yield "custom.js ";
13  yield JSON.stringify(counters);
14};
15