mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 18:52:48 +00:00
test(process): skip POSIX observer errors on Windows
Refs #7281 Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
1 parent
1201c99427
commit
cf9e7f7dad
1 file changed
+33
-28
@@ -656,36 +656,41 @@ it.each(["nested", "outside", "no-roots"] as const)(
|
||||
},
|
||||
);
|
||||
|
||||
it("treats an observer path below a regular file as absent", async () => {
|
||||
const fixture = await createTestTempDirectory("rea-observer-not-directory-");
|
||||
const root = join(fixture, "selected");
|
||||
const blocker = join(fixture, "blocker.txt");
|
||||
await mkdir(root);
|
||||
await writeFile(join(root, "kept.txt"), "retain me");
|
||||
await writeFile(blocker, "not a directory");
|
||||
const observerPath = join(blocker, "capture");
|
||||
const scenario = processScenarioSchema.parse({
|
||||
executable: process.execPath,
|
||||
filesystem_observation_paths: [root],
|
||||
});
|
||||
try {
|
||||
await expect(realpath(observerPath)).rejects.toMatchObject({
|
||||
code: "ENOTDIR",
|
||||
});
|
||||
const snapshot = await snapshotRoots(scenario, undefined, undefined, {
|
||||
observerPaths: [observerPath],
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"treats an observer path below a regular file as absent",
|
||||
async () => {
|
||||
const fixture = await createTestTempDirectory(
|
||||
"rea-observer-not-directory-",
|
||||
);
|
||||
const root = join(fixture, "selected");
|
||||
const blocker = join(fixture, "blocker.txt");
|
||||
await mkdir(root);
|
||||
await writeFile(join(root, "kept.txt"), "retain me");
|
||||
await writeFile(blocker, "not a directory");
|
||||
const observerPath = join(blocker, "capture");
|
||||
const scenario = processScenarioSchema.parse({
|
||||
executable: process.execPath,
|
||||
filesystem_observation_paths: [root],
|
||||
});
|
||||
try {
|
||||
await expect(realpath(observerPath)).rejects.toMatchObject({
|
||||
code: "ENOTDIR",
|
||||
});
|
||||
const snapshot = await snapshotRoots(scenario, undefined, undefined, {
|
||||
observerPaths: [observerPath],
|
||||
});
|
||||
|
||||
expect(snapshot.files.map(({ path }) => path).sort()).toEqual([
|
||||
"root_0:.",
|
||||
"root_0:kept.txt",
|
||||
]);
|
||||
expect(snapshot.coverage.unobserved_subtrees).toEqual([]);
|
||||
expect(snapshot.truncated).toBe(false);
|
||||
} finally {
|
||||
await rm(fixture, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
expect(snapshot.files.map(({ path }) => path).sort()).toEqual([
|
||||
"root_0:.",
|
||||
"root_0:kept.txt",
|
||||
]);
|
||||
expect(snapshot.coverage.unobserved_subtrees).toEqual([]);
|
||||
expect(snapshot.truncated).toBe(false);
|
||||
} finally {
|
||||
await rm(fixture, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"propagates unexpected observer path resolution errors",
|
||||
|
||||
Reference in new issue
Block a user