diff options
Diffstat (limited to 'test/parallel/test-timers-setimmediate-infinite-loop.js')
-rw-r--r-- | test/parallel/test-timers-setimmediate-infinite-loop.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/parallel/test-timers-setimmediate-infinite-loop.js b/test/parallel/test-timers-setimmediate-infinite-loop.js new file mode 100644 index 0000000000..49adc390fa --- /dev/null +++ b/test/parallel/test-timers-setimmediate-infinite-loop.js @@ -0,0 +1,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()); |