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

esm: refactor mocking test #49465

Merged
merged 6 commits into from
Sep 5, 2023

Conversation

GeoffreyBooth
Copy link
Member

This PR refactors test/es-module/test-esm-loader-mock.mjs to use the new register and initialize APIs instead of globalPreload and setImportMetaCallback. I tried to preserve as much of the previous test as possible; all of the assertions from the earlier version are unchanged. This test passes both here, on main, and within #49144.

The largest addition to test-esm-loader-mock.mjs was code that just moved there from within the insideAppContext function in mock-loader.mjs.

@nodejs/loaders

@GeoffreyBooth GeoffreyBooth added test Issues and PRs related to the tests. esm Issues and PRs related to the ECMAScript Modules implementation. loaders Issues and PRs related to ES module loaders labels Sep 3, 2023
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Sep 3, 2023
@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@JakobJingleheimer JakobJingleheimer left a comment

Choose a reason for hiding this comment

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

🙌 wow! we should use this before & after as a poster-child for register & initialize

test/es-module/test-esm-loader-mock.mjs Outdated Show resolved Hide resolved
test/es-module/test-esm-loader-mock.mjs Outdated Show resolved Hide resolved
test/es-module/test-esm-loader-mock.mjs Outdated Show resolved Hide resolved
test/es-module/test-esm-loader-mock.mjs Outdated Show resolved Hide resolved
test/fixtures/es-module-loaders/mock-loader.mjs Outdated Show resolved Hide resolved
test/es-module/test-esm-loader-mock.mjs Outdated Show resolved Hide resolved
@aduh95 aduh95 added the needs-ci PRs that need a full CI run. label Sep 3, 2023
@GeoffreyBooth GeoffreyBooth removed the needs-ci PRs that need a full CI run. label Sep 4, 2023
@GeoffreyBooth GeoffreyBooth added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 4, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 4, 2023
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the needs-ci PRs that need a full CI run. label Sep 4, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@GeoffreyBooth GeoffreyBooth 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 Sep 5, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 5, 2023
@nodejs-github-bot nodejs-github-bot merged commit 6a5394e into nodejs:main Sep 5, 2023
64 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 6a5394e

@GeoffreyBooth GeoffreyBooth deleted the refactor-mocking-test branch September 5, 2023 01:14
ruyadorno pushed a commit that referenced this pull request Sep 28, 2023
PR-URL: #49465
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
This was referenced Sep 28, 2023
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
PR-URL: nodejs#49465
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Nov 11, 2023
PR-URL: nodejs#49465
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@targos targos added the backported-to-v18.x PRs backported to the v18.x-staging branch. label Nov 23, 2023
targos pushed a commit that referenced this pull request Nov 23, 2023
PR-URL: #49465
Backport-PR-URL: #50669
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
PR-URL: nodejs/node#49465
Backport-PR-URL: nodejs/node#50669
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
PR-URL: nodejs/node#49465
Backport-PR-URL: nodejs/node#50669
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
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. backported-to-v18.x PRs backported to the v18.x-staging branch. 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. loaders Issues and PRs related to ES module loaders 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.

5 participants