Skip to content

Commit f71a3ed

Browse files
committed
test_runner: add multiple files benchmark
1 parent bb3d171 commit f71a3ed

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

benchmark/test_runner/multi-files.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
const bench = common.createBenchmark(main, {
5+
patterns: ['test/fixtures/test-runner/**/*.?(c|m)js', 'test/parallel/test-runner-*'],
6+
concurrency: ['yes', 'no'],
7+
}, {
8+
flags: ['--expose-internals'],
9+
});
10+
11+
12+
function main({ patterns, concurrency }) {
13+
const { run } = require('node:test');
14+
const { Glob } = require('internal/fs/glob');
15+
const glob = new Glob([patterns]);
16+
const files = glob.globSync().filter((f) => !f.includes('never_ending') && !f.includes('watch-mode'));
17+
concurrency = concurrency === 'yes';
18+
19+
bench.start();
20+
(async function() {
21+
const stream = run({ concurrency, files });
22+
for await (const _ of stream); // eslint-disable-line no-unused-vars
23+
})().then(() => bench.end(files.length));
24+
}

benchmark/test_runner/suite-tests.js

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
'use strict';
22
const common = require('../common');
3-
const { finished } = require('node:stream/promises');
4-
5-
const reporter = require('../fixtures/empty-test-reporter');
63

74
const { describe, it } = require('node:test');
85

@@ -52,8 +49,6 @@ async function run({ numberOfSuites, testsPerSuite, testType, concurrency }) {
5249
}
5350
}
5451

55-
await finished(reporter);
56-
5752
return numberOfSuites * testsPerSuite;
5853
}
5954

0 commit comments

Comments
 (0)