We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b2b93f commit 751c115Copy full SHA for 751c115
2 files changed
benchmark/common.js
@@ -193,6 +193,9 @@ Benchmark.prototype.end = function(operations) {
193
if (typeof operations !== 'number') {
194
throw new Error('called end() without specifying operation count');
195
}
196
+ if (!process.env.NODEJS_BENCHMARK_ZERO_ALLOWED && operations <= 0) {
197
+ throw new Error('called end() with operation count <= 0');
198
+ }
199
200
const time = elapsed[0] + elapsed[1] / 1e9;
201
const rate = operations / time;
test/sequential/test-benchmark-net.js
@@ -15,7 +15,8 @@ const path = require('path');
15
16
const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js');
17
18
-const child = fork(runjs, ['--set', 'dur=0', 'net']);
+const child = fork(runjs, ['--set', 'dur=0', 'net'],
19
+ {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}});
20
child.on('exit', (code, signal) => {
21
assert.strictEqual(code, 0);
22
assert.strictEqual(signal, null);
0 commit comments