test: tighten temp home cleanup assertion

This commit is contained in:
Peter Steinberger
2026-05-09 20:49:34 +01:00
parent 79b1c6a626
commit efee3f9793

View File

@@ -4,7 +4,13 @@ import { describe, expect, it } from "vitest";
import { createTempHomeEnv } from "./temp-home.js";
async function expectPathMissing(targetPath: string): Promise<void> {
await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" });
try {
await fs.stat(targetPath);
} catch (error) {
expect((error as NodeJS.ErrnoException).code).toBe("ENOENT");
return;
}
throw new Error(`expected ${targetPath} to be removed`);
}
describe("createTempHomeEnv", () => {