From 076be8868c3984ecc1a10b691ff56f23847ae7fb Mon Sep 17 00:00:00 2001 From: jnealey88 <129418666+jnealey88@users.noreply.github.com> Date: Wed, 27 Aug 2025 10:29:04 -0700 Subject: [PATCH] Add test to verify mount() correctly handles files (addresses #503) This test confirms that the mount() method properly creates a file node (not a directory) when mounting a file. The issue described in #503 appears to have been resolved in PR #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 #503 is working correctly. --- packages/php-wasm/node/src/test/mount.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/php-wasm/node/src/test/mount.spec.ts b/packages/php-wasm/node/src/test/mount.spec.ts index 98b13d63f3..f3b1dcfc4f 100644 --- a/packages/php-wasm/node/src/test/mount.spec.ts +++ b/packages/php-wasm/node/src/test/mount.spec.ts @@ -138,6 +138,21 @@ describe('Mounting', () => { } }); + it('Should create a file node, not a directory, when mounting a file', async () => { + // This test addresses issue #503 + // Ensure the mount point doesn't exist yet + expect(php.fileExists(fileMountPoint)).toBe(false); + + await php.mount( + fileMountPoint, + createNodeFsMountHandler(filePath) + ); + + // The mount point should be a file, not a directory + expect(php.isFile(fileMountPoint)).toBe(true); + expect(php.isDir(fileMountPoint)).toBe(false); + }); + it('Should unmount mounted file and remove created node from VFS', async () => { const unmount = await php.mount( fileMountPoint,