mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00

PR-URL: https://github.com/nodejs/node/pull/56966 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
33 lines
792 B
JavaScript
33 lines
792 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
const OVERFLOW = Math.pow(2, 31); // TIMEOUT_MAX is 2^31-1
|
|
|
|
function timerNotCanceled() {
|
|
assert.fail('Timer should be canceled');
|
|
}
|
|
|
|
process.on('warning', common.mustCall((warning) => {
|
|
if (warning.name === 'DeprecationWarning') return;
|
|
|
|
const lines = warning.message.split('\n');
|
|
|
|
assert.strictEqual(warning.name, 'TimeoutOverflowWarning');
|
|
assert.strictEqual(lines[0], `${OVERFLOW} does not fit into a 32-bit signed` +
|
|
' integer.');
|
|
assert.strictEqual(lines.length, 2);
|
|
}, 2));
|
|
|
|
|
|
{
|
|
const timeout = setTimeout(timerNotCanceled, OVERFLOW);
|
|
clearTimeout(timeout);
|
|
}
|
|
|
|
{
|
|
const interval = setInterval(timerNotCanceled, OVERFLOW);
|
|
clearInterval(interval);
|
|
}
|