Skip to content

Commit 8a40eb2

Browse files
cliffhallclaude
andcommitted
test(filesystem): keep the stat prototype in the 2^53 inode test, so it reaches the identity check on Windows
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 322dcf0 commit 8a40eb2

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

‎src/filesystem/__tests__/pinned-directory.test.ts‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,15 +301,14 @@ describe("the identity check (#5154)", () => {
301301
const expected = { ...lstatBig(file), ino: high };
302302
const realFstat = fs.fstatSync;
303303
const realLstat = fs.lstatSync;
304-
vi.spyOn(fs, "fstatSync").mockImplementationOnce((fd) => ({
305-
...realFstat(fd, { bigint: true }),
306-
isFile: () => true,
307-
ino: high + 1n,
308-
}));
309-
vi.spyOn(fs, "lstatSync").mockImplementationOnce((p) => ({
310-
...realLstat(p, { bigint: true }),
311-
ino: high + 1n,
312-
}));
304+
// Persistent and prototype-preserving: on Windows openInDirectory lstats
305+
// the name once for its symlink check before the identity check.
306+
vi.spyOn(fs, "fstatSync").mockImplementation((fd) =>
307+
Object.assign(realFstat(fd, { bigint: true }), { ino: high + 1n }),
308+
);
309+
vi.spyOn(fs, "lstatSync").mockImplementation((p) =>
310+
Object.assign(realLstat(p, { bigint: true }), { ino: high + 1n }),
311+
);
313312
await expect(
314313
overwriteFileInDirectory(file, "new", expected),
315314
).rejects.toThrow("was replaced while it was being opened");

0 commit comments

Comments
 (0)