Skip to content
Closed
Show file tree
Hide file tree
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
test: replace flaky immediates event loop test
Replace a flaky immediates event loop test that hasn't
truly made sense for a while, since it has gone through
so many different iterations, with a new test that is
verifying the same behavior but without so much
potential for flakiness.

Fixes: #24497
  • Loading branch information
apapirovski committed Jan 7, 2022
commit 8f73f2b71775c072ca1a5afa4b58fb53197dfe60
2 changes: 0 additions & 2 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ prefix parallel
test-repl-sigint-nested-eval: PASS, FLAKY

[$system==win32]
# https://github.com/nodejs/node/issues/24497
test-timers-immediate-queue: PASS,FLAKY
# https://github.com/nodejs/node/issues/23277
test-worker-memory: PASS,FLAKY
# https://github.com/nodejs/node/issues/41206
Expand Down
34 changes: 34 additions & 0 deletions test/parallel/test-timers-immediate-event-loop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Flags: --expose-internals
'use strict';

const common = require('../common');

const assert = require('assert');
const { sleep } = require('internal/util');

// SetImmediate should clear its existing queue on each event loop run
// but leave any newly scheduled Immediates until the next run.
//
// Since timer expiries are notoriously flaky and dependant on specific
// OS configurations, we instead just check that an Immediate queue
// will eventually be interrupted by the timer — regardless of how long
// it actually takes for that to happen.

const duration = 1;
let nextImmediate;

const exit = common.mustCall(() => {
assert.ok(nextImmediate.hasRef());
process.exit();
});

function check() {
sleep(duration);
nextImmediate = setImmediate(check);
}

setImmediate(common.mustCall(() => {
setTimeout(exit, duration);

check();
}));
57 changes: 0 additions & 57 deletions test/parallel/test-timers-immediate-queue.js

This file was deleted.