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
8 changes: 6 additions & 2 deletions test/parallel/test-timers-immediate-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

// Flags: --expose-internals --no-warnings

'use strict';
require('../common');
const assert = require('assert');
const { internalBinding } = require('internal/test/binding');
const timersBinding = internalBinding('timers');

// setImmediate should run clear its queued cbs once per event loop turn
// but immediates queued while processing the current queue should happen
Expand All @@ -38,8 +42,8 @@ const QUEUE = 10;
function run() {
if (hit === 0) {
setTimeout(() => { ticked = true; }, 1);
const now = Date.now();
while (Date.now() - now < 2);
const now = timersBinding.getLibuvNow();
while (timersBinding.getLibuvNow() - now < 2);
}

if (ticked) return;
Expand Down
Loading