Skip to content

Commit 50034fe

Browse files
committed
test(host-kit): isolate process fixtures from live procfs
1 parent 855aa4a commit 50034fe

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎packages/host-kit/src/internal/host-process-liveness.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ function psInstalledAt(installed: readonly string[]): void {
4242
}
4343

4444
beforeEach(() => {
45+
const readFileSync = fs.readFileSync;
46+
vi.spyOn(fs, 'readFileSync').mockImplementation((path, options) => {
47+
if (String(path).startsWith('/proc/')) {
48+
throw Object.assign(new Error('proc is unavailable in the ps fixture'), { code: 'ENOENT' });
49+
}
50+
return readFileSync(path, options);
51+
});
4552
mockRunCmdSync.mockReset();
4653
mockRunCmd.mockReset();
4754
});

0 commit comments

Comments
 (0)