Skip to content

Commit 82545b1

Browse files
committed
test(watch): temporarily clear process.env.CI and increase timeout to prevent silent render suppression in CI
1 parent 927d7fb commit 82545b1

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/__tests__/watch-dashboard.test.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { describe, it, expect, vi, beforeEach } from 'vitest';
2+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
33
import { render } from 'ink';
44
import { Writable } from 'node:stream';
55
import { Console } from 'node:console';
@@ -13,7 +13,7 @@ if (!console.Console) {
1313

1414
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
1515

16-
const waitForFrameToContain = async (mockStdout: MockWritable, substring: string, timeout = 2000) => {
16+
const waitForFrameToContain = async (mockStdout: MockWritable, substring: string, timeout = 5000) => {
1717
const start = Date.now();
1818
while (Date.now() - start < timeout) {
1919
const output = mockStdout.frames.join('\n');
@@ -43,10 +43,21 @@ const getDockerSystemStatsSpy = vi.spyOn(containersMod, 'getDockerSystemStats');
4343

4444
describe('WatchDashboard', () => {
4545
let mockStdout: MockWritable;
46+
let originalCI: string | undefined;
4647

4748
beforeEach(() => {
4849
mockStdout = new MockWritable();
4950
vi.clearAllMocks();
51+
originalCI = process.env.CI;
52+
delete process.env.CI;
53+
});
54+
55+
afterEach(() => {
56+
if (originalCI !== undefined) {
57+
process.env.CI = originalCI;
58+
} else {
59+
delete process.env.CI;
60+
}
5061
});
5162

5263
it('renders loading states and then displays pods and containers', async () => {

0 commit comments

Comments
 (0)