forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuite-tests-as-fast-as-can.js
More file actions
37 lines (30 loc) · 909 Bytes
/
suite-tests-as-fast-as-can.js
File metadata and controls
37 lines (30 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'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');
const bench = common.createBenchmark(main, {
numberOfSuites: [10, 100],
testsPerSuite: [10, 100, 1000],
}, {
// We don't want to test the reporter here
flags: ['--test-reporter=./benchmark/fixtures/empty-test-reporter.js'],
});
async function run(numberOfSuites, testsPerSuite) {
for (let i = 0; i < numberOfSuites; i++) {
describe(`${i}`, () => {
for (let j = 0; j < testsPerSuite; j++) {
it(`${j}`, () => {
});
}
});
}
await finished(reporter);
return numberOfSuites * testsPerSuite;
}
function main({ numberOfSuites, testsPerSuite }) {
bench.start();
run(numberOfSuites, testsPerSuite).then((ops) => {
bench.end(ops);
});
}