Skip to content

Commit bd8e734

Browse files
committed
fix(test): map opendirSync in the Windows-form root test
walkProject opens each directory with opendirSync since 3272052, so the mount mapping that covered readdirSync left the walk reading /mnt/q/proj as unreadable and indexing 0 files on Linux.
1 parent b539578 commit bd8e734

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎tests/cmdindex_root_typed_in_windows_form_on_linux.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// `token-goat index C:\x --walk` under WSL has to walk /mnt/c/x, the folder behind that spelling there; POSIX resolves `c:/x` as a relative path to nothing. tests/cmdindex_root_spelled_as_a_mount.test.ts pins the Windows half, where a mount spelling has to open at its drive letter, with its CAPTURE. A runner cannot create /mnt/<letter>, so one mount is mapped onto a temp directory through node:fs as tests/hook_reads_of_a_drive_letter_key_open_its_wsl_mount.test.ts does, adding readdirSync for the walk. The spellings are HAND-DERIVED from WSL's documented convention of mounting drive Q: at /mnt/q.
1+
// `token-goat index C:\x --walk` under WSL has to walk /mnt/c/x, the folder behind that spelling there; POSIX resolves `c:/x` as a relative path to nothing. tests/cmdindex_root_spelled_as_a_mount.test.ts pins the Windows half, where a mount spelling has to open at its drive letter, with its CAPTURE. A runner cannot create /mnt/<letter>, so one mount is mapped onto a temp directory through node:fs as tests/hook_reads_of_a_drive_letter_key_open_its_wsl_mount.test.ts does, adding opendirSync for the walk, the call walkProject opens each directory with: unmapped, the mount reads as an unreadable directory and the run indexes 0 files. The spellings are HAND-DERIVED from WSL's documented convention of mounting drive Q: at /mnt/q.
22

33
import type * as childProcess from 'node:child_process'
44
import * as fs from 'node:fs'
@@ -36,6 +36,7 @@ vi.mock('node:fs', async (importOriginal) => {
3636
openSync: wrap(actual.openSync),
3737
existsSync: wrap(actual.existsSync),
3838
readdirSync: wrap(actual.readdirSync),
39+
opendirSync: wrap(actual.opendirSync),
3940
}
4041
return { ...actual, ...overrides, default: { ...actual, ...overrides } }
4142
})

0 commit comments

Comments
 (0)