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: refactor test-runner-module-mocking #54233

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Aug 6, 2024

Trying to use paths as import specifiers can lead to weird results if the path contain special URL chars (e.g. #, ?, %).

@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 Issues and PRs related to the tests. labels Aug 6, 2024
Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.10%. Comparing base (e0634f5) to head (8ef4cb9).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54233      +/-   ##
==========================================
- Coverage   87.10%   87.10%   -0.01%     
==========================================
  Files         647      647              
  Lines      181739   181739              
  Branches    34887    34886       -1     
==========================================
- Hits       158310   158301       -9     
- Misses      16738    16740       +2     
- Partials     6691     6698       +7     

see 23 files with indirect coverage changes

cjsImpl = require(cjsFixture);

assert.strictEqual(esmImpl.default.string, 'original cjs string');
assert.strictEqual(cjsImpl.string, 'original cjs string');
});

test('ESM mocks can be used by both module systems', async (t) => {
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this test? (Other changes LGTM)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't find a way to refactor it. Either we use an absolute path for require and a file: URL for import() (but that's already the previous test), either we use the same relative specifier (but that's already the following test); so it seemed to me it was testing a "real" use case, or rather it's testing some particular case where an absolute path coincides with an origin-relative URL – but we cannot guarantee that, it depends on where the node repo was cloned.

@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 7, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 7, 2024
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 7, 2024
@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 7, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 8, 2024
@nodejs-github-bot nodejs-github-bot merged commit 9e6c526 into nodejs:main Aug 8, 2024
58 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 9e6c526

@aduh95 aduh95 deleted the refactor-mock_loader-test branch August 9, 2024 07:55
targos pushed a commit that referenced this pull request Aug 14, 2024
PR-URL: #54233
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Aug 19, 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. 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.

4 participants