node/test/parallel/test-handle-wrap-close-abort.js
Rich Trott 6263c00828 test: provide duration/interval to timers
There are places in the code base where setTimeout() or
setInterval() are called with just a callback and no duration/interval.
The timers module will use a value of `1` in that situation.

An unspecified duration or interval can be confusing. Did the original
author forget to provide a value? Did they intend to use setImmediate()
or process.nextTick() instead of setTimeout()? And so on.

This change provides a duration or interval of `1` to all calls in the
codebase where it is missing. `parallel/test-timers.js` still tests the
situation where `setTimeout()` and `setInterval()` are called with
`undefined` and other non-numeric values for the duration/interval.

PR-URL: https://github.com/nodejs/node/pull/9472
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-06 15:22:51 -08:00

17 lines
372 B
JavaScript

'use strict';
const common = require('../common');
process.on('uncaughtException', common.mustCall(function() {}, 2));
setTimeout(function() {
process.nextTick(function() {
const c = setInterval(function() {
clearInterval(c);
throw new Error('setInterval');
}, 1);
});
setTimeout(function() {
throw new Error('setTimeout');
}, 1);
}, 1);