Skip to content

test: add smoke tests for defer importing synthetic modules - #65537

Open
MayaLekova wants to merge 1 commit into
nodejs:mainfrom
MayaLekova:import-defer-05-synthetic
Open

test: add smoke tests for defer importing synthetic modules#65537
MayaLekova wants to merge 1 commit into
nodejs:mainfrom
MayaLekova:import-defer-05-synthetic

Conversation

@MayaLekova

Copy link
Copy Markdown
Contributor

test: add smoke tests for defer importing synthetic modules

The tests added ensure that Node.js doesn't crash or produce incorrect results when importing synthetic modules (i.e. JSON, text or builtin modules) with the defer modifier.

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 Aug 25, 2026
@MayaLekova
MayaLekova force-pushed the import-defer-05-synthetic branch 2 times, most recently from 03ccd50 to 414cd49 Compare August 25, 2026 11:23
@MayaLekova
MayaLekova marked this pull request as ready for review August 25, 2026 11:24
@MayaLekova

Copy link
Copy Markdown
Contributor Author

@joyeecheung and @nicolo-ribaudo could you take a look please? Just a few smoke tests for synthetic modules.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.12%. Comparing base (46a7dbd) to head (414cd49).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65537      +/-   ##
==========================================
- Coverage   90.21%   90.12%   -0.09%     
==========================================
  Files         751      751              
  Lines      253550   253635      +85     
  Branches    47813    47793      -20     
==========================================
- Hits       228733   228600     -133     
- Misses      16076    16276     +200     
- Partials     8741     8759      +18     

see 46 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.

@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.

The tested behavior looks correct to me.

For the node:fs, is there any way to test when evaluation happens? Maybe if one monkey-patches some built-ins before evaluating node:fs then it does something different? (I hope the answer is "no it's not possible")

@MayaLekova

Copy link
Copy Markdown
Contributor Author

is there any way to test when evaluation happens?
I thought about it, couldn't think of a straight-forward way at first. Monkey-patching might be a reasonable way, I'll give it another try.

If the builtin was to write something to the global namespace, that would make it easier. But I guess they don't do so, in order no to pollute the global namespace. Also there might be another builtin module that writes something on globalThis.

@MayaLekova
MayaLekova force-pushed the import-defer-05-synthetic branch from 414cd49 to 0302cad Compare August 25, 2026 17:05
The tests added ensure that Node.js doesn't crash or produce
incorrect results when importing synthetic modules (i.e. JSON,
text or builtin modules) with the `defer` modifier.

Signed-off-by: Maya Lekova <maya@igalia.com>
@MayaLekova
MayaLekova force-pushed the import-defer-05-synthetic branch from 0302cad to 7f7855e Compare August 25, 2026 17:48
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.

3 participants