Skip to content

Commit 6444bbc

Browse files
konardclaude
andcommitted
fix: use setDefaultTimeout for Bun test timeout
Switched from inline timeout parameter to setDefaultTimeout(20000) which is the proper API for test-anywhere to configure timeouts across all tests. This will fix the Bun Windows timeout issue where tests take 10-16 seconds due to slower file I/O on Windows platforms. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ca28c12 commit 6444bbc

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

tests/cli.test.mjs

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,20 @@
1414

1515
/* global TextDecoder */
1616

17-
import { describe, it, assert, getRuntime } from 'test-anywhere';
17+
import {
18+
describe,
19+
it,
20+
assert,
21+
getRuntime,
22+
setDefaultTimeout,
23+
} from 'test-anywhere';
1824
import { readFileSync } from 'node:fs';
1925
import path from 'node:path';
2026
import { fileURLToPath } from 'node:url';
2127

28+
// Set timeout to 20 seconds for slow tests on Windows
29+
setDefaultTimeout(20000);
30+
2231
const __dirname = path.dirname(fileURLToPath(import.meta.url));
2332
const scriptPath = path.join(
2433
__dirname,
@@ -166,25 +175,21 @@ describe('gh-download-pull-request CLI', () => {
166175
}
167176
});
168177

169-
it(
170-
'Invalid PR format should show helpful error',
171-
async () => {
172-
const cmd = getRuntimeCommand();
173-
const baseArgs = getRuntimeArgs(scriptPath);
174-
const args = [...baseArgs, 'invalid-pr-format'];
175-
176-
try {
177-
await execCommand(cmd, args);
178-
// If it doesn't throw, that's unexpected
179-
assert.ok(false, 'Should have failed with invalid format');
180-
} catch (error) {
181-
const output = (error.stdout || '') + (error.stderr || '');
182-
assert.ok(
183-
output.includes('Invalid PR URL') || output.includes('Invalid PR'),
184-
`Did not show expected error message for invalid format. Output: ${output}`
185-
);
186-
}
187-
},
188-
{ timeout: 20000 }
189-
);
178+
it('Invalid PR format should show helpful error', async () => {
179+
const cmd = getRuntimeCommand();
180+
const baseArgs = getRuntimeArgs(scriptPath);
181+
const args = [...baseArgs, 'invalid-pr-format'];
182+
183+
try {
184+
await execCommand(cmd, args);
185+
// If it doesn't throw, that's unexpected
186+
assert.ok(false, 'Should have failed with invalid format');
187+
} catch (error) {
188+
const output = (error.stdout || '') + (error.stderr || '');
189+
assert.ok(
190+
output.includes('Invalid PR URL') || output.includes('Invalid PR'),
191+
`Did not show expected error message for invalid format. Output: ${output}`
192+
);
193+
}
194+
});
190195
});

0 commit comments

Comments
 (0)