GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||
GeezerVison is showing github.com — test_runner: refactor `mock_loader` by aduh95 · Pull Request #54223 · nodejs/node Conversation
Contributor
It seems the
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@ ## main #54223 +/- ## ======================================= Coverage 87.31% 87.31% ======================================= Files 648 648 Lines 182362 182336 -26 Branches 34986 34980 -6 ======================================= - Hits 159229 159212 -17 + Misses 16398 16392 -6 + Partials 6735 6732 -3
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Can you clarify this? From what I can tell, dynamic import does work with paths. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
In the example you give here ( /// Assuming path of the current module is /tmp/entry.mjs await import('./foo?test.js'); // Would attempt to load /tmp/foo with import.meta.url being file:///tmp/foo?test.js await import('./foo%3Ftest.js'); // Would attempt to load /tmp/foo?test.js with import.meta.url being file:///tmp/foo%3Ftest.js await import('/path/to/file#1.js'); // Would try to load /path/to/file with import.meta.url being file:///path/to/file#1.js await import('/path/to/file%231.js'); // Would try to load /path/to/file#1.js with import.meta.url being file:///path/to/file%231.js |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Another question: if this is only an internal refactor/simplification, I would expect the existing tests to continue working. Why are all of the changes to the test file required? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
That's fair, let's move the test refactor to a dedicated PR (#54233) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM if the CI passes.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d8ed05d to
e5acdee
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
So it breaks on Windows – but IMO that's because the tests are wrong, importing a Windows path is not supposed to work. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I ran into a similar issue when originally developing the feature. The tests only broke on Windows when I tried to implement things more cleanly. I assumed that importing a Windows path was supposed to work because in the tests, code like this works without any mocks configured: const fixture = fixtures.path('module-mocking', 'basic-esm.mjs'); const original = await import(fixture); Maybe it's possible that the code only loads because the mock loader is enabled, even with no mocks configured. If the test is wrong and the code doesn't load without the mock loader, then we should drop the invalid test(s) or even add a test to make sure it never works with the mock loader. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Are you sure? It seems like somthing that shouldn't work. IIRC you should get |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I edited my comment, but what might be happening is that the mock loader is enabled and even though no modules are mocked, the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Let me validate that once I get a hand on a Windows machine. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I tried reproducing on 22.6.0 on Windows. Both |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I suggest we land #54233, then I can add a Windows-only test case in this PR that validates passing a path to import results in a rejected promise. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
SGTM. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@aduh95 I think this is ready for the change you proposed in #54223 (comment). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e5acdee to
db0e8e2
Compare
|
It looks like it's not possible to support |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
64babf7 to
ac0933b
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM since I guess the commit queue needs a reapproval.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Commit Queue failed- Loading data for nodejs/node/pull/54223 ✔ Done loading data for nodejs/node/pull/54223 ----------------------------------- PR info ------------------------------------ Title test_runner: refactor `mock_loader` (#54223) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch aduh95:refactor-mock_loader -> nodejs:main Labels test, author ready, needs-ci, test_runner Commits 2 - test_runner: refactor `mock_loader` - squash! add Windows-only test Committers 1 - Antoine du Hamel <[email protected]> PR-URL: https://github.com/nodejs/node/pull/54223 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/54223 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]> -------------------------------------------------------------------------------- ℹ This PR was created on Tue, 06 Aug 2024 09:37:08 GMT ✔ Approvals: 5 ✔ - Yagiz Nizipli (@anonrig) (TSC): https://github.com/nodejs/node/pull/54223#pullrequestreview-2221307097 ✔ - Colin Ihrig (@cjihrig): https://github.com/nodejs/node/pull/54223#pullrequestreview-2250956747 ✔ - Chemi Atlow (@atlowChemi): https://github.com/nodejs/node/pull/54223#pullrequestreview-2222805845 ✔ - Moshe Atlow (@MoLow) (TSC): https://github.com/nodejs/node/pull/54223#pullrequestreview-2230052660 ✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/54223#pullrequestreview-2231864401 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2024-08-20T17:54:28Z: https://ci.nodejs.org/job/node-test-pull-request/61294/ - Querying data for job/node-test-pull-request/61294/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ No git cherry-pick in progress ✔ No git am in progress ✔ No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD ✔ origin/main is now up-to-date - Downloading patch for 54223 From https://github.com/nodejs/node * branch refs/pull/54223/merge -> FETCH_HEAD ✔ Fetched commits as cc26951180e6..ac0933b2ab3b -------------------------------------------------------------------------------- [main f1e95b31b5] test_runner: refactor `mock_loader` Author: Antoine du Hamel <[email protected]> Date: Sat Aug 3 14:30:47 2024 +0200 2 files changed, 16 insertions(+), 42 deletions(-) [main d4e46cdcd7] squash! add Windows-only test Author: Antoine du Hamel <[email protected]> Date: Fri Aug 16 23:57:03 2024 +0200 1 file changed, 6 insertions(+) ✔ Patches applied Please run the following commands to complete landinghttps://github.com/nodejs/node/actions/runs/10492400336 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in b4344cf |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PR-URL: #54223 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #54223 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.