FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test_runner: make `mock.module`'s `specifier` consistent with `import()` by aduh95 · Pull Request #54416 · nodejs/node · GitHub

/ node Public

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

Merged
nodejs-github-bot merged 2 commits into
mainfrom
mock-loader-import
Aug 20, 2024
Merged

test_runner: make mock.module's specifier consistent with import()#54416
nodejs-github-bot merged 2 commits into
mainfrom
mock-loader-import

Conversation

aduh95 commented Aug 16, 2024

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

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

codecov Bot commented Aug 17, 2024
edited
Loading

Copy link
Copy Markdown

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

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM (sans the lint errors obv)

aduh95 added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Aug 17, 2024
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 17, 2024

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 20, 2024
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 merged commit 68e94c1 into main Aug 20, 2024

Copy link
Copy Markdown
Collaborator

Landed in 68e94c1

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 mentioned this pull request Aug 25, 2024
reillylm added a commit to reillylm/DefinitelyTyped that referenced this pull request Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 outstanding review comments, and a CI started. 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


Back | FazBrowse Home | New Git URL