fix(ext/node): align nextTick ordering in ESM#34085
Merged
Merged
Conversation
littledivy
pushed a commit
to crowlKats/deno
that referenced
this pull request
Jun 10, 2026
Closes denoland#34052 This updates module evaluation so promise and `queueMicrotask` jobs queued during top-level ESM evaluation run before `process.nextTick`, matching Node ESM behavior. It also drains the nextTick queue at the end of main CJS loading to preserve Node CJS entrypoint ordering. Tests added for both ESM and CJS ordering.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #34052
This updates module evaluation so promise and
queueMicrotaskjobs queued during top-level ESM evaluation run beforeprocess.nextTick, matching Node ESM behavior. It also drains the nextTick queue at the end of main CJS loading to preserve Node CJS entrypoint ordering.Tests added for both ESM and CJS ordering.
Verified:
./target/debug/deno run -A tests/specs/node/next_tick_microtask_order/main.mjs./target/debug/deno run -A tests/specs/node/next_tick_microtask_order/main.cjs./x test-spec next_tick_microtask_ordercargo test -p deno_core nexttickcargo test -p deno_core test_tla_with_tick_scheduled_no_hangcargo fmt --check./target/debug/deno fmt --check ext/node/polyfills/01_require.js tests/specs/node/next_tick_microtask_order/__test__.jsonc tests/specs/node/next_tick_microtask_order/main.mjs tests/specs/node/next_tick_microtask_order/main.cjsgit diff --check