test_runner: support mocking non-existent modules#62298
test_runner: support mocking non-existent modules#62298geeksilva97 wants to merge 1 commit intonodejs:mainfrom
Conversation
|
Review requested:
|
5d7b662 to
c1881e2
Compare
There was a problem hiding this comment.
if it does exist on disk, though, it could be imported/required via other means, so it seems prudent to ensure the actual resolved specifier is still mocked out?
There was a problem hiding this comment.
That's an edge case I could not think of. Would you have an example to illustrate the issue?
There was a problem hiding this comment.
Let's say you have an exports specifier "foo": "./foo/index.js" in package pkg.
That can be required, or imported, by any of the following paths relative to the package root:
pkg/foo./foo/index.js./foo(if it's a CJS file)./foo/index(if it's a CJS file)
If you don't fully resolve to a list of potential paths and confirm that, in fact, nothing exists in any of them, then shadowing a subset of them would create a scenario where you have more than one source of truth about that resource's contents.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62298 +/- ##
==========================================
- Coverage 89.77% 89.69% -0.09%
==========================================
Files 673 676 +3
Lines 203820 206657 +2837
Branches 39175 39575 +400
==========================================
+ Hits 182987 185351 +2364
- Misses 13152 13446 +294
- Partials 7681 7860 +179
🚀 New features to boost your workflow:
|
Fixes #55891