import { lstat } from "node:fs/promises"; import { expect } from "vitest"; /** * Expect a recorded path to be gone. A missing record fails instead of * passing: `access("")` also rejects with ENOENT, so a `list[0] ?? ""` check * passes when the fixture never recorded the resource. `lstat` keeps a * dangling symbolic link from reading as removed. */ export const expectRemoved = async ( path: string | undefined, ): Promise => { if (path === undefined || path === "") throw new Error("expectRemoved needs a recorded path; none was recorded"); await expect(lstat(path)).rejects.toMatchObject({ code: "ENOENT" }); };