summaryrefslogtreecommitdiff
path: root/test/parallel/test-timers-regress-GH-9765.js
blob: 49adc390fa7bb5450622d0d175c211e63f0f4a95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
const common = require('../common');

// This test ensures that if an Immediate callback clears subsequent
// immediates we don't get stuck in an infinite loop.
//
// If the process does get stuck, it will be timed out by the test
// runner.
//
// Ref: https://github.com/nodejs/node/issues/9756

setImmediate(common.mustCall(function() {
  clearImmediate(i2);
  clearImmediate(i3);
}));

const i2 = setImmediate(common.mustNotCall());

const i3 = setImmediate(common.mustNotCall());