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: add back globalPreload tests #48779

Merged
merged 2 commits into from
Jul 17, 2023
Merged

esm: add back globalPreload tests #48779

merged 2 commits into from
Jul 17, 2023

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Jul 15, 2023

This started as a revert of 938341a.

#44710 removed setImportMetaCallback, removing possibility for hooks authors to modify the import.meta object. It also removed all hooks execution when node entry point was not a file (e.g. REPL, --eval, etc.) which was not a problem except for globalPreload which is always supposed to run. I've added some tests to ensure globalPreload behaves correctly in this case.
I've also added back the test that was removed in #46402 because it's good test for globalPreload and ensures mocking works – which is a very important use case for hooks IMO.

Refs: #46402
Fixes: #48778
Fixes: #48516

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders
  • @nodejs/modules

@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. process Issues and PRs related to the process subsystem. labels Jul 15, 2023
@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 Jul 15, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 15, 2023
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 16, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 16, 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.

🙌 awesome, thanks for tackling this!

lib/internal/main/eval_string.js Show resolved Hide resolved
test/es-module/test-esm-loader-hooks.mjs Outdated Show resolved Hide resolved
Co-authored-by: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com>
@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 16, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 16, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 merged commit 16b8c71 into nodejs:main Jul 17, 2023
@aduh95
Copy link
Contributor Author

aduh95 commented Jul 17, 2023

Landed in 16b8c71

@aduh95 aduh95 deleted the globalPreload branch July 17, 2023 15:26
@aduh95 aduh95 added the backport-blocked-v18.x PRs that should land on the v18.x-staging branch but are blocked by another PR's pending backport. label Jul 17, 2023
pluris pushed a commit to pluris/node that referenced this pull request Aug 6, 2023
PR-URL: nodejs#48779
Fixes: nodejs#48778
Fixes: nodejs#48516
Refs: nodejs#46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
pluris pushed a commit to pluris/node that referenced this pull request Aug 7, 2023
PR-URL: nodejs#48779
Fixes: nodejs#48778
Fixes: nodejs#48516
Refs: nodejs#46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
PR-URL: nodejs#48779
Fixes: nodejs#48778
Fixes: nodejs#48516
Refs: nodejs#46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
PR-URL: nodejs#48779
Fixes: nodejs#48778
Fixes: nodejs#48516
Refs: nodejs#46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
UlisesGascon pushed a commit to UlisesGascon/node that referenced this pull request Aug 14, 2023
PR-URL: nodejs#48779
Fixes: nodejs#48778
Fixes: nodejs#48516
Refs: nodejs#46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
RafaelGSS pushed a commit that referenced this pull request Aug 15, 2023
PR-URL: #48779
Fixes: #48778
Fixes: #48516
Refs: #46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
@UlisesGascon UlisesGascon mentioned this pull request Aug 15, 2023
targos pushed a commit to targos/node that referenced this pull request Nov 11, 2023
PR-URL: nodejs#48779
Fixes: nodejs#48778
Fixes: nodejs#48516
Refs: nodejs#46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
@targos targos added backported-to-v18.x PRs backported to the v18.x-staging branch. and removed backport-blocked-v18.x PRs that should land on the v18.x-staging branch but are blocked by another PR's pending backport. labels Nov 23, 2023
targos pushed a commit that referenced this pull request Nov 23, 2023
PR-URL: #48779
Backport-PR-URL: #50669
Fixes: #48778
Fixes: #48516
Refs: #46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
PR-URL: nodejs/node#48779
Backport-PR-URL: nodejs/node#50669
Fixes: nodejs/node#48778
Fixes: nodejs/node#48516
Refs: nodejs/node#46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
PR-URL: nodejs/node#48779
Backport-PR-URL: nodejs/node#50669
Fixes: nodejs/node#48778
Fixes: nodejs/node#48516
Refs: nodejs/node#46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
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. esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loader preload code never executes esm loaders: getBuiltin() does not work with node:test
5 participants