Skip to content

Commit

Permalink
test_runner: add multiple files benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLow committed Aug 3, 2023
1 parent bb3d171 commit f71a3ed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
24 changes: 24 additions & 0 deletions benchmark/test_runner/multi-files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';
const common = require('../common');

const bench = common.createBenchmark(main, {
patterns: ['test/fixtures/test-runner/**/*.?(c|m)js', 'test/parallel/test-runner-*'],
concurrency: ['yes', 'no'],
}, {
flags: ['--expose-internals'],
});


function main({ patterns, concurrency }) {
const { run } = require('node:test');
const { Glob } = require('internal/fs/glob');
const glob = new Glob([patterns]);
const files = glob.globSync().filter((f) => !f.includes('never_ending') && !f.includes('watch-mode'));
concurrency = concurrency === 'yes';

bench.start();
(async function() {
const stream = run({ concurrency, files });
for await (const _ of stream); // eslint-disable-line no-unused-vars
})().then(() => bench.end(files.length));
}
5 changes: 0 additions & 5 deletions benchmark/test_runner/suite-tests.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
'use strict';
const common = require('../common');
const { finished } = require('node:stream/promises');

const reporter = require('../fixtures/empty-test-reporter');

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

Expand Down Expand Up @@ -52,8 +49,6 @@ async function run({ numberOfSuites, testsPerSuite, testType, concurrency }) {
}
}

await finished(reporter);

return numberOfSuites * testsPerSuite;
}

Expand Down

0 comments on commit f71a3ed

Please sign in to comment.