Skip to content

Conversation

@mag123c
Copy link
Contributor

@mag123c mag123c commented Oct 23, 2025

Fixes: #60322

Improve ERR_AMBIGUOUS_MODULE_SYNTAX error messages to show the actual undefined global instead of always mentioning require().

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@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. labels Oct 23, 2025
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@aduh95
Copy link
Contributor

aduh95 commented Nov 12, 2025

It looks like there are some conflicts here, could you please rebase your changes on top of the latest main so we can run CI? Let us know if you need help

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.51%. Comparing base (e8c9c43) to head (a56707f).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/modules/esm/module_job.js 95.65% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #60376   +/-   ##
=======================================
  Coverage   88.51%   88.51%           
=======================================
  Files         703      703           
  Lines      208405   208422   +17     
  Branches    40190    40198    +8     
=======================================
+ Hits       184468   184489   +21     
+ Misses      15941    15936    -5     
- Partials     7996     7997    +1     
Files with missing lines Coverage Δ
lib/internal/modules/esm/module_job.js 96.52% <95.65%> (-0.08%) ⬇️

... and 25 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.

- Refactor getUndefinedCJSGlobalLike to use ArrayPrototypeFind
- Change if-else chain to switch statement
- Add single quotes around global names in error messages
- Revert test file to use --input-type=module flag and original order
- Update test regex patterns to expect quoted global names
@aduh95 aduh95 force-pushed the fix/ambiguous-error-message branch from f65596e to 90a476c Compare December 4, 2025 14:03
  Remove unused ArrayPrototypeSome import and fix assert usage.
@aduh95 aduh95 force-pushed the fix/ambiguous-error-message branch from 90a476c to a56707f Compare December 4, 2025 14:05
@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Dec 4, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 4, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Dec 5, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 5, 2025
@nodejs-github-bot nodejs-github-bot merged commit 37d9cfc into nodejs:main Dec 5, 2025
74 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 37d9cfc

aduh95 pushed a commit that referenced this pull request Dec 8, 2025
PR-URL: #60376
Fixes: #60322
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the ERR_AMBIGUOUS_MODULE_SYNTAX error message

6 participants