Skip to content

test: assert reported names in Wasm link errors - #65981

Open
dobbydobap wants to merge 1 commit into
nodejs:mainfrom
dobbydobap:test-wasm-link-error-names
Open

test: assert reported names in Wasm link errors#65981
dobbydobap wants to merge 1 commit into
nodejs:mainfrom
dobbydobap:test-wasm-link-error-names

Conversation

@dobbydobap

Copy link
Copy Markdown
Contributor

9766a672a7f (#64950) changed the reserved-import-name WebAssembly.LinkError in
lib/internal/modules/esm/translators.js to report impt.name instead of
impt.module. It landed without a test, and the existing tests could not catch it:
they assert only the literal message prefix, never the interpolated value.

The fixtures make the gap concrete. invalid-import-name.wasm declares module
test and name wasm:invalid, so before the fix the message read Invalid Wasm import name "test" and now reads Invalid Wasm import name "wasm:invalid". The
old assertion /Invalid Wasm import name/ matches both.

This asserts the reported name in the five tests covering those three throw sites.
Two of them, the import-name cases, actually change failure behaviour: they fail on
v24.18.0 and pass on a main nightly. The other three already interpolated the
right value, so they pass either way; they are tightened because they had the same
gap, and because the import-module test asserted /Invalid Wasm import/, which
also matches the import-name message, so those two tests could not tell each
other's error apart.

All five pass on v27.0.0-nightly20260831, including through tools/test.py, and
the full test-esm-wasm-* set (22 tests) passes.

The reserved-import-name LinkError started reporting the import name
instead of the import module in 9766a67, which landed without a
test. These assertions only matched the literal message prefix, so they
passed either way. Assert the interpolated name, so the two import-name
cases fail against the old message, and tighten the export and
import-module assertions in the same family, which had the same gap and
could not tell each other's error apart.

Refs: nodejs#64950
Signed-off-by: dobbydobap <varshitha.kolupuri@gmail.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 Node.js core tests and test infrastructure. labels Sep 11, 2026
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.18%. Comparing base (9e7f67f) to head (004a8b4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65981      +/-   ##
==========================================
+ Coverage   90.16%   90.18%   +0.01%     
==========================================
  Files         771      771              
  Lines      265451   265451              
  Branches    50458    50457       -1     
==========================================
+ Hits       239355   239407      +52     
+ Misses      17051    17002      -49     
+ Partials     9045     9042       -3     

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

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

The change LGTM to me... however, @dobbydobap the PR message and commit message here appear to be entire AI generated. While using agents to prepare changes is fine, please do ensure that you are taking the time to at least write the PR messages yourself. We need to know that contributions are coming from people and aren't just automations.

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 Node.js core tests and test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants