Skip to content

Commit 50cdd86

Browse files
Fix rejects Windows with AMD GPU unit test (#1171)
1 parent df5ae70 commit 50cdd86

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/unit/utils.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ describe('validateHardware', () => {
4343
controllers: [{ vendor: 'AMD', model: 'Radeon RX 6800' }],
4444
} as Systeminformation.GraphicsData);
4545

46+
vi.mock('node:child_process', async () => {
47+
const actual = await vi.importActual<typeof import('node:child_process')>('node:child_process');
48+
return {
49+
...actual,
50+
exec: (_cmd: string, callback: (error: Error | null, stdout: string, stderr: string) => void) => {
51+
setImmediate(() => callback(new Error('mocked exec failure'), '', ''));
52+
return { kill: () => {}, on: () => {} } as any;
53+
},
54+
};
55+
});
56+
4657
const result = await validateHardware();
4758
expect(result).toStrictEqual({
4859
isValid: false,

0 commit comments

Comments
 (0)