Skip to content

Conversation

jnealey88
Copy link
Contributor

Summary

Closes #503

This PR adds a test to verify that the mount() method correctly creates file nodes (not directories) when mounting files.

Investigation Results

After investigating issue #503, it appears the bug described has already been resolved. The current implementation in node-fs-mount.ts correctly:

  • Creates parent directories for files: FS.mkdirTree(dirname(vfsMountPoint))
  • Creates directory trees for directories: FS.mkdirTree(vfsMountPoint)

This fix was likely implemented as part of PR #2338 ("File mounting in NODEFS").

Changes

  • Added explicit test case to mount.spec.ts that verifies:
    • Mount point doesn't exist before mounting
    • After mounting a file, isFile() returns true
    • After mounting a file, isDir() returns false

Test Plan

The new test case ensures this behavior remains correct and prevents regression. The test explicitly addresses the concern raised in issue #503.

Since the bug appears to be already fixed, this PR primarily serves to:

  1. Document that the issue is resolved
  2. Add test coverage to prevent regression
  3. Allow issue PHP: mount() should not create a directory when mounting a file #503 to be closed

@adamziel
Copy link
Collaborator

👋 @jnealey88 thank you for the test! It seems like this PR got intertwined with #2561 – would you mind removing the changes unrelated to mount.spec.ts from this one? I think they're good to merge once the other changes are cleaned up.

…ss#503)

This test confirms that the mount() method properly creates a file node
(not a directory) when mounting a file. The issue described in WordPress#503
appears to have been resolved in PR WordPress#2338 when file mounting support
was added to NODEFS.

The test explicitly checks:
- That the mount point doesn't exist before mounting
- That after mounting a file, isFile() returns true
- That after mounting a file, isDir() returns false

This ensures the behavior described in issue WordPress#503 is working correctly.
@jnealey88 jnealey88 force-pushed the fix/mount-file-creates-directory-issue-503 branch from fe62613 to 076be88 Compare August 28, 2025 14:13
@jnealey88
Copy link
Contributor Author

@adamziel - My fault! Should be good to go now.

@adamziel adamziel merged commit 73bd71c into WordPress:trunk Aug 28, 2025
26 checks passed
@adamziel
Copy link
Collaborator

Thank you so much @jnealey88!

@jnealey88 jnealey88 deleted the fix/mount-file-creates-directory-issue-503 branch August 28, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP: mount() should not create a directory when mounting a file
2 participants