Skip to content

module: add tests for two cases of eager imports:#64197

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
MayaLekova:import-defer-02
Jul 8, 2026
Merged

module: add tests for two cases of eager imports:#64197
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
MayaLekova:import-defer-02

Conversation

@MayaLekova

@MayaLekova MayaLekova commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

module: add tests for two cases of eager imports when using import defer

  • when the defer imported module contains top-level await
  • when the defer imported module is eagerly imported from another module

Refs: https://github.com/tc39/proposal-defer-import-eval
Signed-off-by: Maya Lekova maya@igalia.com

@nodejs-github-bot nodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Jun 29, 2026

@nicolo-ribaudo nicolo-ribaudo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note that this is already tested in test262:

I am not super familiar with the Node.js implementation of ESM, but test262 is run through V8's d8.

Whether or not it makes sense to have these two tests here probably depends on how much they are testing V8-internal code paths vs if there is any part of it that is implemented on the Node.js side.


The tests look correct :)

Comment thread test/fixtures/es-modules/dep-module-top-level-await.mjs Outdated
Comment thread test/es-module/test-defer-import-eval-with-tla.mjs
@nicolo-ribaudo

Copy link
Copy Markdown
Contributor

Oh, could you update the commit first line to mention that it's about import defer?

@joyeecheung

joyeecheung commented Jun 29, 2026

Copy link
Copy Markdown
Member

This doesn't look very Node.js specific and should live in test262 instead? As long as the V8 side works alright I think it's unlikely that anything in particular in Node.js would make it not work.

@MayaLekova

Copy link
Copy Markdown
Contributor Author

This doesn't look very Node.js specific and should live in test262 instead? As long as the V8 side works alright I think it's unlikely that anything in particular in Node.js would make it not work.

I was thinking about it and as those 2 tests are really simple, I think it's worth having them in Node.js as well. They are not anymore engine-specific than the initial 2 smoke tests I added in Node. Also makes it really easy to run and - if needed - debug the code in Node directly.

@MayaLekova MayaLekova force-pushed the import-defer-02 branch 3 times, most recently from 78d8282 to b135b16 Compare July 3, 2026 15:34
Comment thread test/es-module/test-defer-import-eval-with-tla.mjs Outdated
  - when the defer imported module contains top-level await
  - when the defer imported module is also eagerly imported

Refs: https://github.com/tc39/proposal-defer-import-eval
Signed-off-by: Maya Lekova <maya@igalia.com>
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.24%. Comparing base (e6a8d06) to head (ebce535).
⚠️ Report is 293 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64197      +/-   ##
==========================================
- Coverage   92.01%   90.24%   -1.77%     
==========================================
  Files         379      741     +362     
  Lines      166972   240745   +73773     
  Branches    25554    45354   +19800     
==========================================
+ Hits       153639   217270   +63631     
- Misses      13041    15048    +2007     
- Partials      292     8427    +8135     

see 545 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MayaLekova

Copy link
Copy Markdown
Contributor Author

Thanks for looking into this!
@jasnell @joyeecheung @caiolima could you please take another look?

@joyeecheung joyeecheung left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think two small tests are okay to add if they make debugging easier, though we should be cautious about duplicating tests for cases already covered in the upstream, especially when the V8 version on main tends to be months behind the upstream and the proposal can still go through semantic changes..

@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@joyeecheung joyeecheung added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 8, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 8, 2026
@nodejs-github-bot nodejs-github-bot merged commit a006262 into nodejs:main Jul 8, 2026
71 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in a006262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants