-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nextTick
doesn't execute as expected with .mjs
#52978
Comments
nextTick
not executed as expected with .mjs
nextTick
doesn't execut as expected with .mjs
nextTick
doesn't execut as expected with .mjs
nextTick
doesn't execute as expected with .mjs
Using |
This comment was marked as resolved.
This comment was marked as resolved.
Oh I was confused, I thought you called bar() inside the promise constructor rather than just resolving that promise. |
Yeah - this makes sense an easier repro is:
This is the classic "order inside callback" gotcha (i.e. it's first tick weirdness, if you put it inside of a setImmediate it will log the same in both mjs and js). This needs a docs fix |
The docs are still wrong and need an update though :) |
is this still open ? |
I would like to add another point: if you use .mjs in a |
Version
v20.13.1
Platform
Darwin 23.3.0 Darwin Kernel Version 23.3.0
Subsystem
No response
What steps will reproduce the bug?
Use the code sample mentioned in the official documentation:
Save the code sample above to a file named
test.mjs
, and then execute it withnode test.mjs
.Here is the output for
test.mjs
:start bar foo zoo baz
.When I change the file to
test.js
and re-run it, I will get the message with:start foo bar zoo baz
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
It should print:
start foo bar zoo baz
What do you see instead?
It will print:
start bar foo zoo baz
Additional information
No response
The text was updated successfully, but these errors were encountered: