Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions test/sequential/test-timers-block-eventloop.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
'use strict';

const common = require('../common');
const fs = require('fs');
const platformTimeout = common.platformTimeout;
const assert = require('assert');

let called = false;
const t1 = setInterval(() => {
common.busyLoop(platformTimeout(12));
}, platformTimeout(10));

const t2 = setInterval(() => {
common.busyLoop(platformTimeout(15));
}, platformTimeout(10));

const t3 =
setTimeout(common.mustNotCall('eventloop blocked!'), platformTimeout(200));

setTimeout(function() {
fs.stat('/dev/nonexistent', () => {
assert(!called);
called = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is here to prevent an infinite loop before anyone asks :)

setImmediate(common.mustCall(() => {
clearInterval(t1);
clearInterval(t2);
clearTimeout(t3);
});
}, platformTimeout(50));
}));
}, 10);

const t2 = setInterval(() => {
common.busyLoop(20);
}, 10);