Skip to content

Commit cad646d

Browse files
committed
fix(test): relax slow Windows search timeouts
1 parent 0360cb9 commit cad646d

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

‎tests/search-decision-card.test.ts‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ type ToolCallResponse = {
4040
isError?: boolean;
4141
};
4242

43+
const SLOW_WINDOWS_TEST_TIMEOUT_MS = 60000;
44+
4345
function getToolCallHandler(
4446
server: unknown
4547
): (request: ToolCallRequest) => Promise<ToolCallResponse> {
@@ -153,7 +155,7 @@ export class ProfileService {
153155
config: { skipEmbedding: true }
154156
});
155157
await indexer.index();
156-
}, 30000);
158+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
157159

158160
afterEach(async () => {
159161
if (originalArgv) {
@@ -170,7 +172,7 @@ export class ProfileService {
170172
await rmWithRetries(tempRoot);
171173
tempRoot = null;
172174
}
173-
}, 30000);
175+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
174176

175177
it('intent="edit" with multiple results returns full decision card with ready field', async () => {
176178
if (!tempRoot) throw new Error('tempRoot not initialized');
@@ -207,7 +209,7 @@ export class ProfileService {
207209
}
208210
expect(preflight.ready).toBeDefined();
209211
expect(typeof preflight.ready).toBe('boolean');
210-
}, 30000);
212+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
211213

212214
it('decision card has all expected fields when returned', async () => {
213215
if (!tempRoot) throw new Error('tempRoot not initialized');
@@ -259,7 +261,7 @@ export class ProfileService {
259261
if (preflight.whatWouldHelp) {
260262
expect(Array.isArray(preflight.whatWouldHelp)).toBe(true);
261263
}
262-
}, 30000);
264+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
263265

264266
it('intent="explore" returns lightweight preflight', async () => {
265267
if (!tempRoot) throw new Error('tempRoot not initialized');
@@ -290,7 +292,7 @@ export class ProfileService {
290292
expect(typeof preflight.ready).toBe('boolean');
291293
// Should NOT have full decision card fields for explore
292294
}
293-
}, 30000);
295+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
294296

295297
it('includes snippet field when includeSnippets=true', async () => {
296298
if (!tempRoot) throw new Error('tempRoot not initialized');
@@ -321,7 +323,7 @@ export class ProfileService {
321323
// At least some results should have a snippet
322324
const withSnippets = parsed.results.filter((result) => result.snippet);
323325
expect(withSnippets.length).toBeGreaterThan(0);
324-
}, 30000);
326+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
325327

326328
it('does not include snippet field when includeSnippets=false', async () => {
327329
if (!tempRoot) throw new Error('tempRoot not initialized');
@@ -350,7 +352,7 @@ export class ProfileService {
350352
parsed.results.forEach((result) => {
351353
expect(result.snippet).toBeUndefined();
352354
});
353-
}, 30000);
355+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
354356

355357
it('scope header starts snippet when includeSnippets=true', async () => {
356358
if (!tempRoot) throw new Error('tempRoot not initialized');
@@ -381,5 +383,5 @@ export class ProfileService {
381383
const firstLine = withSnippet.snippet.split('\n')[0].trim();
382384
expect(firstLine).toMatch(/^\/\//);
383385
}
384-
}, 30000);
386+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
385387
});

‎tests/search-snippets.test.ts‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ vi.mock('../src/core/reranker.js', () => ({
1111
isAmbiguous: vi.fn(() => false)
1212
}));
1313

14+
const SLOW_WINDOWS_TEST_TIMEOUT_MS = 60000;
15+
1416
describe('Search Snippets with Scope Headers', () => {
1517
let tempRoot: string | null = null;
1618

@@ -98,15 +100,15 @@ export const VERSION = '1.0.0';
98100
config: { skipEmbedding: true }
99101
});
100102
await indexer.index();
101-
}, 30000);
103+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
102104

103105
afterEach(async () => {
104106
if (tempRoot) {
105107
await rmWithRetries(tempRoot);
106108
tempRoot = null;
107109
}
108110
delete process.env.CODEBASE_ROOT;
109-
}, 30000);
111+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
110112

111113
it('returns snippets when includeSnippets=true', async () => {
112114
if (!tempRoot) throw new Error('tempRoot not initialized');
@@ -136,7 +138,7 @@ export const VERSION = '1.0.0';
136138

137139
const withSnippets = parsed.results.filter((r: any) => r.snippet);
138140
expect(withSnippets.length).toBeGreaterThan(0);
139-
}, 30000);
141+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
140142

141143
it('scope header is a comment line starting with //', async () => {
142144
if (!tempRoot) throw new Error('tempRoot not initialized');
@@ -167,7 +169,7 @@ export const VERSION = '1.0.0';
167169
// Scope header should be a comment line
168170
expect(firstLine).toMatch(/^\/\//);
169171
}
170-
});
172+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
171173

172174
it('does not include snippet when includeSnippets=false', async () => {
173175
if (!tempRoot) throw new Error('tempRoot not initialized');
@@ -195,7 +197,7 @@ export const VERSION = '1.0.0';
195197
parsed.results.forEach((r: any) => {
196198
expect(r.snippet).toBeUndefined();
197199
});
198-
});
200+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
199201

200202
it('snippet is a string starting with code or comment', async () => {
201203
if (!tempRoot) throw new Error('tempRoot not initialized');
@@ -225,5 +227,5 @@ export const VERSION = '1.0.0';
225227
expect(typeof withSnippet.snippet).toBe('string');
226228
expect(withSnippet.snippet.length).toBeGreaterThan(0);
227229
}
228-
});
230+
}, SLOW_WINDOWS_TEST_TIMEOUT_MS);
229231
});

0 commit comments

Comments
 (0)