Skip to content
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

test_runner: make mock.module's specifier consistent with import() #54416

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Aug 16, 2024

The previous implementation was trying to follow both require and import conventions. It is not practical to try to follow both, and aligning with import() seems to be what makes the most sense. It would allow us to greatly simplify the internal loader.

For Unix paths, it barely makes a difference (only if the path contains special URL chars such as ?, #, or %). For Windows, it means you need to use / instead of \ for path delimiter, and escape any # or % char. In my experience, folks really only mock either relative paths, or bare specifiers (i.e. module from a node_modules package), so I don't expect this change to be breaking.

Refs: #54223 (comment)

The previous implementation was trying to follow both `require` and
`import` conventions. It is not practical to try to follow both,
and aligning with `import()` seems to be what makes the most sense.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Aug 16, 2024
Copy link

codecov bot commented Aug 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.32%. Comparing base (e4f61de) to head (6855057).
Report is 351 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54416      +/-   ##
==========================================
- Coverage   87.33%   87.32%   -0.01%     
==========================================
  Files         648      648              
  Lines      182321   182324       +3     
  Branches    34971    34980       +9     
==========================================
+ Hits       159222   159223       +1     
+ Misses      16374    16373       -1     
- Partials     6725     6728       +3     
Files with missing lines Coverage Δ
lib/internal/test_runner/mock/mock.js 99.24% <100.00%> (+<0.01%) ⬆️

... and 29 files with indirect coverage changes

Copy link
Member

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

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

LGTM (sans the lint errors obv)

@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 Aug 17, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 17, 2024
@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 the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 20, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 20, 2024
@nodejs-github-bot nodejs-github-bot merged commit 68e94c1 into main Aug 20, 2024
58 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 68e94c1

@nodejs-github-bot nodejs-github-bot deleted the mock-loader-import branch August 20, 2024 17:39
RafaelGSS pushed a commit that referenced this pull request Aug 25, 2024
The previous implementation was trying to follow both `require` and
`import` conventions. It is not practical to try to follow both,
and aligning with `import()` seems to be what makes the most sense.

PR-URL: #54416
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
@RafaelGSS RafaelGSS mentioned this pull request Aug 25, 2024
@targos targos added the dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. label Sep 21, 2024
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. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants