Skip to content

Commit 5ea6b3e

Browse files
committed
WIP: force exit in CI smoke tests if required
1 parent cfdebd4 commit 5ea6b3e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/smoke.spec.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ test('app launches and loads UI from server', async () => {
2323
await expect(window.locator('h1:has-text("Intercept HTTP")')).toBeVisible({ timeout: 60000 });
2424
console.log('saw title');
2525

26-
await electronApp.close();
26+
await Promise.race([
27+
electronApp.close(),
28+
new Promise((_, reject) => setTimeout(() => reject(new Error('App failed to close cleanly')), 5000))
29+
]).catch(async (error) => {
30+
console.warn('Warning:', error.message, '- force killing process');
31+
electronApp.process().kill('SIGKILL');
32+
if (!process.env.CI) {
33+
console.log('(Note that shutdown issues like this are ignored in CI)');
34+
throw error;
35+
} else {
36+
console.log('Ignoring error (assuming this is a CI issue)')
37+
}
38+
});
2739
console.log('closed app');
2840
});

0 commit comments

Comments
 (0)