mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
This test has been flaky in the CI. It squeezes too many independent test cases into one file, so split it up so that we can mark the persistent flaky test case and leave the unproblematic ones alone. PR-URL: https://github.com/nodejs/node/pull/60568 Refs: https://github.com/nodejs/node/issues/54803 Refs: https://github.com/nodejs/reliability/blob/main/reports/2025-11-03.md Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
29 lines
819 B
JavaScript
29 lines
819 B
JavaScript
// Test that timerify throws appropriate errors for invalid argument types.
|
|
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { timerify } = require('perf_hooks');
|
|
|
|
[1, {}, [], null, undefined, Infinity].forEach((input) => {
|
|
assert.throws(() => timerify(input),
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
name: 'TypeError',
|
|
message: /The "fn" argument must be of type function/
|
|
});
|
|
});
|
|
|
|
const asyncFunc = async (a, b = 1) => {};
|
|
const syncFunc = (a, b = 1) => {};
|
|
|
|
[1, '', {}, [], false].forEach((histogram) => {
|
|
assert.throws(() => timerify(asyncFunc, { histogram }), {
|
|
code: 'ERR_INVALID_ARG_TYPE'
|
|
});
|
|
assert.throws(() => timerify(syncFunc, { histogram }), {
|
|
code: 'ERR_INVALID_ARG_TYPE'
|
|
});
|
|
});
|