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: add mock file system API by mcollina · Pull Request #65798 · nodejs/node Conversation
|
|
Review requested:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| Adds a file to the mock file system. Missing parent directories are | ||
| created automatically. | ||
|
|
||
| ### `mockFs.existsSync(path)` |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we'd want/need these separate APIs (like existsSync/addRirectory etc) the user can just call mockFs.vfs.mkdirSync can't they?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| shadows real files or directories. Join it with relative paths to access | ||
| the mock's files through the `node:fs` APIs. | ||
|
|
||
| ### `mockFs.restore()` |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
For restore to make sense here IMO the vfs would need to actually "take over" something like other mocks. I don't understand when I'd ever do this.
OTOH if mockFs could intercept/take over calls (i.e. like mock.module) it would make sense.
This is cool but I don't understand why I'd use this over mock.module("node:fs", { exports: new VirtualFileSystem() })
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.
I'm approving since the code itself looks fine and this is tagged early development and iteration is fine - but I'm not convinced this has a benefit over mock.module + VirtualFileSystem and I'm wary of adding more ways to e.g. create a file or directory since the current ones work with VirtualFileSystem as is
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #65798 +/- ## ========================================== + Coverage 90.05% 90.13% +0.08% ========================================== Files 769 769 Lines 261396 261765 +369 Branches 49631 49690 +59 ========================================== + Hits 235399 235946 +547 + Misses 17034 16852 -182 - Partials 8963 8967 +4
🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@benjamingr I should have linked #55902. I’m ok in closing this if that’s not wanted anymore. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
test_runner: support mock file system
There was an error while loading. Please reload this page.