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 Sep 23, 2023
1 parent 55fde47 commit 641af8e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions benchmark/test_runner/multi-files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'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';
let tests = 0;

bench.start();
(async function() {
const stream = run({ concurrency, files });
for await (const { type } of stream) {
if (type === 'test:start') tests++;
}
})().then(() => bench.end(tests));
}

0 comments on commit 641af8e

Please sign in to comment.