GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — esm: delete preload mock test by GeoffreyBooth · Pull Request #46402 · nodejs/node

Conversation

@GeoffreyBooth

@GeoffreyBooth GeoffreyBooth commented Jan 29, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Per #44710 (comment), this PR deletes a test that isn’t compatible with off-thread loaders; but more broadly, I think we’re likely to want to rethink the approach of globalPreload‘s sloppy scripts, rather than build on it. I’m not reverting the full PR that added this test, #39240, because we’re keeping parts of it. The off-thread PR will delete the undocumented setImportMetaCallback that that PR adds. More context: nodejs/loaders#124

cc @bmeck @nodejs/loaders

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@GeoffreyBooth
esm: delete preload mock test
11b88c2
@GeoffreyBooth GeoffreyBooth added esm Issues and PRs related to the ECMAScript Modules implementation. loaders Issues and PRs related to ES module loaders. labels Jan 29, 2023
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure. labels Jan 29, 2023
@bmeck

bmeck commented Jan 29, 2023 via email •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
This shouldn't be deleted without a plan forward. It was explicitly designed to work with off thread loaders so the claim it doesn't is concerning to hear and would be good to understand.
…
On Sat, Jan 28, 2023, 10:24 PM Geoffrey Booth ***@***.***> wrote: Per #44710 (comment) <#44710 (comment)>, this PR deletes a test that isn’t compatible with off-thread loaders; but more broadly, I think we’re likely to want to rethink the approach of globalPreload‘s sloppy scripts, rather than build on it. I’m not reverting the full PR that added this test, #39240 <#39240>, because we’re keeping parts of it. The off-thread PR will delete the undocumented setImportMetaCallback that that PR adds. cc @bmeck <https://github.com/bmeck> @nodejs/loaders <https://github.com/orgs/nodejs/teams/loaders> ------------------------------ You can view, comment on, or merge this pull request online at: #46402 Commit Summary - 11b88c2 <11b88c2> esm: delete preload mock test File Changes (2 files <https://github.com/nodejs/node/pull/46402/files>) - *D* test/es-module/test-esm-loader-mock.mjs <https://github.com/nodejs/node/pull/46402/files#diff-c7f1002d283d353145656887966dfbdd0ea26e13e398b21023d093c6248feadd> (45) - *D* test/fixtures/es-module-loaders/mock-loader.mjs <https://github.com/nodejs/node/pull/46402/files#diff-08a5d722c9df06780af1b452e4394133c678b11eee19530ef0bd871f4a8a2c2f> (249) Patch Links: - https://github.com/nodejs/node/pull/46402.patch - https://github.com/nodejs/node/pull/46402.diff — Reply to this email directly, view it on GitHub <#46402>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABZJIY4YJQNUPGNBJ63FKDWUXWJLANCNFSM6AAAAAAUKATUUQ> . You are receiving this because you were mentioned.Message ID: ***@***.***>
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@GeoffreyBooth

GeoffreyBooth commented Jan 29, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

This shouldn’t be deleted without a plan forward.

This was discussed in nodejs/loaders#124 and #46220. Basically, test mocking can be achieved with just the port option in globalPreload, as that’s what Quibble is doing; and the test in #46220 tests port. So the use case of mocking for tests is handled with existing tests.

This test has a grander vision of what mocking for tests should look like, including mocking import.meta objects, but we can’t get it to work with the off-thread PR. We removed setImportMetaCallback a month ago from the off-thread PR. Since it was undocumented, my feeling was that it could always be re-added after the off-thread PR landed. But more broadly, I’m leaning against using the sloppy mode scripts of globalPreload as a way to inject what are essentially more hooks. I think we can remove the sloppy mode scripts entirely, now that we have --import; no one in nodejs/loaders#124 disputed that. To do so, we would need to find a different way to provide access to port, and to an equivalent to setImportMetaCallback if mocking import.meta objects is something we want to provide an API for.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bmeck

bmeck commented Jan 29, 2023 via email

Copy link
Copy Markdown
Member
I can port the test to use a leaky global as well then. Removing this removes reference point I send to people about mocking direction for esm. Doesn't need a strict guideline to keep it frozen.
…
On Sun, Jan 29, 2023, 9:50 AM Geoffrey Booth ***@***.***> wrote: This shouldn’t be deleted without a plan forward. This was discussed in nodejs/loaders#124 <nodejs/loaders#124> and #46220 <#46220>. Basically, test mocking can be achieved with just the port option in globalPreload, as that’s what Quibble is doing; and the test in #46220 <#46220> tests port. So the use case of mocking for tests is handled with existing tests. This test has a grander vision of what mocking for tests should look like, including mocking import.meta objects, but we can’t get it to work with the off-thread PR. We removed setImportMetaCallback months ago from the off-thread PR. Since it was undocumented, my feeling was that it could always be re-added after the off-thread PR landed. But more broadly, I’m leaning against using the sloppy mode scripts of globalPreload as a way to inject what are essentially more hooks. I think we can remove the sloppy mode scripts entirely, now that we have --import; no one in nodejs/loaders#124 <nodejs/loaders#124> disputed that. To do so, we would need to find a different way to provide access to port, and to an equivalent to setImportMetaCallback if mocking import.meta objects is something we want to provide an API for. — Reply to this email directly, view it on GitHub <#46402 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABZJIYSUKVOLY3CVDI5VSLWU2GUBANCNFSM6AAAAAAUKATUUQ> . You are receiving this because you were mentioned.Message ID: ***@***.***>
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@GeoffreyBooth

GeoffreyBooth commented Jan 29, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

I can port the test to use a leaky global as well then.

Can you do that as a commit on the branch for #44710? If you can refactor the test so that it passes on the off-thread branch, then sure, it can stay. At this point my top priority is landing that PR, as it’s holding up just about the entire Loaders API agenda, and I’m okay with removing things to make way for that PR landing (and those removed things can get added back later).

If you don’t have time soon to refactor the test on that branch, we can just land this removal PR and then a refactored version of the test can get added back in a later PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@GeoffreyBooth GeoffreyBooth mentioned this pull request Jan 29, 2023
Node.js Loaders Team Meeting 2023-01-31 nodejs/loaders#128
Closed
jasnell
jasnell approved these changes Jan 29, 2023
View reviewed changes
@bmeck

bmeck commented Jan 29, 2023 via email

Copy link
Copy Markdown
Member
I'm not blocking but likely wouldn't get to it in timely manner if it sounds like that pr would drastically alter things. As such removal of this is unfortunate since there isn't another mocking ref to ensure the feature in core is possible but acceptable.
…
On Sun, Jan 29, 2023, 11:39 AM James M Snell ***@***.***> wrote: ***@***.**** approved this pull request. — Reply to this email directly, view it on GitHub <#46402 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABZJI6USNVLBYIIQCZ4D33WU2TNPANCNFSM6AAAAAAUKATUUQ> . You are receiving this because you were mentioned.Message ID: ***@***.***>
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@GeoffreyBooth

GeoffreyBooth commented Jan 30, 2023

Copy link
Copy Markdown
Member Author

As such removal of this is unfortunate since there isn’t another mocking ref to ensure the feature in core is possible but acceptable.

Sure, it would be nice if there was a test in core to validate that the mocking use case is possible; but I think such a test could be more minimal than this one, which goes beyond what I would consider the minimum acceptable mocking (such as setting up a fake import.meta for the mocked module). @giltayar in nodejs/loaders#124 (comment) seems very confident that as long as globalPreload port remains after the move to off-thread, Quibble will continue to be able to work. So I think we should be good, and having the test in core is a nice-to-have that can happen anytime. I asked him to contribute such a test when he found the time and he seemed willing.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@nodejs-github-bot

nodejs-github-bot commented Jan 30, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/49240/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

targos
targos approved these changes Jan 30, 2023
View reviewed changes
@GeoffreyBooth GeoffreyBooth added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. and removed needs-ci PRs that need a full CI run. labels Jan 30, 2023
@aduh95

aduh95 commented Jan 30, 2023

Copy link
Copy Markdown
Contributor

At this point my top priority is landing that PR, as it’s holding up just about the entire Loaders API agenda, and I’m okay with removing things to make way for that PR landing (and those removed things can get added back later).

Another possibility would be to move that test to test/known_issues in the off-thread branch, that would let the CI be green while keeping the test in the repo.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@GeoffreyBooth

GeoffreyBooth commented Jan 30, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Another possibility would be to move that test to test/known_issues in the off-thread branch, that would let the CI be green while keeping the test in the repo.

It’s not really a known issue in that we’re intentionally removing setImportMetaCallback. The test would be written for an API that no longer exists.

I suppose we could move it into known_issues and explain all this in a comment at the top of the test file, but is that really better? If we’re looking to create a TODO, we could open an issue on GitHub that we want a test for the mocking use case. That feels more likely to get noticed. Such an issue could link to this PR, to provide the old test as reference.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Jan 31, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 938341a into nodejs:main Jan 31, 2023
@nodejs-github-bot

nodejs-github-bot commented Jan 31, 2023

Copy link
Copy Markdown
Collaborator

Landed in 938341a

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@GeoffreyBooth
GeoffreyBooth deleted the remove-preload-mock-test branch January 31, 2023 04:50
@GeoffreyBooth

GeoffreyBooth commented Jan 31, 2023

Copy link
Copy Markdown
Member Author

@aduh95 I forgot to remove author ready/commit queue after your comment; should I have done so? Not sure if that was an outstanding question that wasn’t resolved.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Jan 31, 2023

Copy link
Copy Markdown
Contributor

is that really better?

I might be wrong, but I think removing the file and adding it back later "reset" the git blame history, while renaming/moving the file would not. In that sense it would be better. Also if someone wants to work on the test, it's much easier if the code is still in the codebase rather than having to dig the PRs or the git history.

If the off-thread loader is not capable of mocking, that would be an issue, in that sense it's a known issue. setImportMetaCallback is an implementation detail.

I forgot to remove author ready/commit queue after your comment; should I have done so? Not sure if that was an outstanding question that wasn’t resolved.

I did not remove it myself, so no worries. I kinda regret not doing so, as now this test has been removed but the off-thread PR still has failing tests and still cannot land, so it could have waited longer, but anyway.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ruyadorno pushed a commit that referenced this pull request Feb 1, 2023
@GeoffreyBooth @ruyadorno
esm: delete preload mock test
729642f
PR-URL: #46402
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@ruyadorno ruyadorno mentioned this pull request Feb 1, 2023
v19.6.0 proposal #46455
Merged
@aduh95 aduh95 mentioned this pull request Feb 12, 2023
Move ESM loaders off-thread #44710
Merged
7 tasks done
@juanarbol juanarbol mentioned this pull request Mar 3, 2023
V18.15.0 proposal #46920
Merged
juanarbol pushed a commit that referenced this pull request Mar 3, 2023
@GeoffreyBooth @juanarbol
esm: delete preload mock test
cf7f3cb
PR-URL: #46402
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
juanarbol pushed a commit that referenced this pull request Mar 5, 2023
@GeoffreyBooth @juanarbol
esm: delete preload mock test
4e88c7c
PR-URL: #46402
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@aduh95 aduh95 mentioned this pull request May 30, 2023
Crash of ESM loader #48240
Closed
@aduh95 aduh95 mentioned this pull request Jul 15, 2023
esm: add back globalPreload tests #48779
Merged
aduh95 added a commit that referenced this pull request Jul 17, 2023
@aduh95
esm: add back globalPreload tests and fix failing ones
16b8c71
PR-URL: #48779
Fixes: #48778
Fixes: #48516
Refs: #46402
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@aduh95 @Ceres6
esm: add back globalPreload tests and fix failing ones
9d7d595
PR-URL: nodejs#48779
Fixes: nodejs#48778
Fixes: nodejs#48516
Refs: nodejs#46402
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@aduh95 @Ceres6
esm: add back globalPreload tests and fix failing ones
113a703
PR-URL: nodejs#48779
Fixes: nodejs#48778
Fixes: nodejs#48516
Refs: nodejs#46402
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
UlisesGascon pushed a commit to UlisesGascon/node that referenced this pull request Aug 14, 2023
@aduh95 @UlisesGascon
esm: add back globalPreload tests and fix failing ones
903bc73
PR-URL: nodejs#48779
Fixes: nodejs#48778
Fixes: nodejs#48516
Refs: nodejs#46402
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Aug 15, 2023
@aduh95 @RafaelGSS
esm: add back globalPreload tests and fix failing ones
a559747
PR-URL: #48779
Fixes: #48778
Fixes: #48516
Refs: #46402
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Nov 11, 2023
@aduh95 @targos
esm: add back globalPreload tests and fix failing ones
002a084
PR-URL: nodejs#48779
Fixes: nodejs#48778
Fixes: nodejs#48516
Refs: nodejs#46402
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
targos pushed a commit that referenced this pull request Nov 23, 2023
@aduh95 @targos
esm: add back globalPreload tests and fix failing ones
63aa5d7
PR-URL: #48779
Backport-PR-URL: #50669
Fixes: #48778
Fixes: #48516
Refs: #46402
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
esm: add back globalPreload tests and fix failing ones
5915a0d
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 <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
esm: add back globalPreload tests and fix failing ones
29f9d1c
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 <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
+1 more reviewer
@targos targos targos approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. esm Issues and PRs related to the ECMAScript Modules implementation. loaders Issues and PRs related to ES module loaders. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@GeoffreyBooth @bmeck @nodejs-github-bot @aduh95 @jasnell @targos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.