mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
Signed-off-by: James M Snell <jasnell@gmail.com> Assisted-by: Opencode PR-URL: https://github.com/nodejs/node/pull/65920 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Xuguang Mei <meixuguang@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
23 lines
645 B
JavaScript
23 lines
645 B
JavaScript
// Flags: --experimental-bench --no-warnings
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
const originalHrtimeBigint = process.hrtime.bigint;
|
|
process.hrtime.bigint = () => 1n;
|
|
const { bench, run } = require('node:bench');
|
|
process.hrtime.bigint = originalHrtimeBigint;
|
|
|
|
const completion = bench('zero duration', { samples: 1 }, (b) => {
|
|
b.start();
|
|
b.end(1);
|
|
});
|
|
|
|
(async () => {
|
|
await run().toArray();
|
|
const result = await completion;
|
|
assert.strictEqual(result.error.code, 'ERR_INVALID_STATE');
|
|
assert.match(result.error.message, /insufficient clock precision/);
|
|
})().then(common.mustCall());
|