1'use strict'; 2 3const common = require('../common'); 4const assert = require('assert'); 5 6// To match browser behaviour, interval should continue 7// being rescheduled even if it throws. 8 9let count = 2; 10const interval = setInterval(() => { throw new Error('IntervalError'); }, 1); 11 12process.on('uncaughtException', common.mustCall((err) => { 13 assert.strictEqual(err.message, 'IntervalError'); 14 if (--count === 0) { 15 clearInterval(interval); 16 } 17}, 2)); 18