Skip to content

vfs: dispatch fs/promises to mounted VFS instances#63537

Open
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:vfs-mount-integration
Open

vfs: dispatch fs/promises to mounted VFS instances#63537
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:vfs-mount-integration

Conversation

@mcollina
Copy link
Copy Markdown
Member

@mcollina mcollina commented May 24, 2026

  • Add mount/unmount on VirtualFileSystem plus a handler registry consulted by lib/fs.js, lib/internal/fs/promises.js, and lib/internal/fs/dir.js via vfsState.handlers.
  • Route absolute paths to the VFS that owns them, so the public fs.* and fs/promises APIs (sync, callback, promise, streams, fs.watch, opendir) dispatch to the mounted provider and fall through to the real filesystem otherwise.

Ref: #63115

Add mount/unmount lifecycle on `VirtualFileSystem`, a handler registry
that fs.js and fs/promises.js consult via `vfsState.handlers`, and a
router that maps absolute paths to the VFS that owns them. When a VFS
is mounted, the public `fs.*` and `fs/promises` APIs (including
streams, `fs.watch`, and `opendir`) dispatch to the provider for paths
under the mount point, and fall through to the real filesystem
otherwise. Includes per-method dispatch tests, error-path coverage,
multi-mount routing tests, and router unit tests.

Ref: nodejs#63115

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels May 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

❌ Patch coverage is 92.69521% with 116 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.35%. Comparing base (74ccf38) to head (2e86633).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/vfs/setup.js 86.64% 87 Missing and 1 partial ⚠️
lib/internal/fs/promises.js 93.29% 10 Missing and 1 partial ⚠️
lib/internal/vfs/file_system.js 93.93% 8 Missing ⚠️
lib/fs.js 99.26% 4 Missing ⚠️
lib/internal/fs/dir.js 80.95% 4 Missing ⚠️
lib/internal/vfs/router.js 97.82% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63537      +/-   ##
==========================================
+ Coverage   90.32%   90.35%   +0.03%     
==========================================
  Files         730      732       +2     
  Lines      234209   235705    +1496     
  Branches    43934    44443     +509     
==========================================
+ Hits       211558   212982    +1424     
- Misses      14372    14452      +80     
+ Partials     8279     8271       -8     
Files with missing lines Coverage Δ
lib/internal/fs/utils.js 98.44% <100.00%> (+<0.01%) ⬆️
lib/internal/vfs/errors.js 100.00% <100.00%> (ø)
lib/internal/vfs/router.js 97.82% <97.82%> (ø)
lib/fs.js 98.33% <99.26%> (+0.13%) ⬆️
lib/internal/fs/dir.js 93.84% <80.95%> (-0.74%) ⬇️
lib/internal/vfs/file_system.js 99.21% <93.93%> (+2.52%) ⬆️
lib/internal/fs/promises.js 92.94% <93.29%> (+0.06%) ⬆️
lib/internal/vfs/setup.js 86.64% <86.64%> (ø)

... and 46 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina mcollina added request-ci Add this label to start a Jenkins CI on a PR. semver-minor PRs that contain new features and should be released in the next minor version. labels May 24, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 24, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants