Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions tests/integration/build_setup/build_setup_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@ import {getResponse, sendInput} from '../test_case_utils.js';
const execAsync = promisify(exec);
const dirname = process.cwd();

// Hooks do the install/build; each test only runs a short command inside the
// installed fixture. Per-test budget, not an install budget.
const TEST_EXECUTION_TIMEOUT = 20000;

// These hooks run `npm install` (plus `npm run build` for ts_* setups) and the
// recursive node_modules teardown, overrunning vitest's default 10s hookTimeout
// and causing flaky "Hook timed out in 10000ms" failures. All twelve hook runs
// take ~16s combined on ubuntu-latest, but a cold, network-bound install has
// been measured at ~70s, so 120s covers the worst case. Don't raise
// TEST_EXECUTION_TIMEOUT for hook flakes; that stays the 20s per-test budget.
// Trade-off: a stuck hook now takes this long to surface.
const HOOK_TIMEOUT = 120000;

describe('Build setup', () => {
describe.each([
'js_commonjs',
Expand Down Expand Up @@ -52,7 +45,7 @@ describe('Build setup', () => {
expect(buildResult.stderr).toBe('');
expect(buildResult.stdout).toContain('\nBuild complete');
}
}, HOOK_TIMEOUT);
});

it(
'should build and run agent successfully',
Expand Down Expand Up @@ -128,6 +121,6 @@ describe('Build setup', () => {
.rm(`${projectPath}/dist`, {recursive: true, force: true})
.catch(() => {});
}
}, HOOK_TIMEOUT);
});
});
});
7 changes: 4 additions & 3 deletions tests/integration/tools/run_skill_script_tool_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import {describe, expect, it} from 'vitest';
const IS_WINDOWS = os.platform() === 'win32';
const IS_UNIX = os.platform() === 'linux' || os.platform() === 'darwin';

// PowerShell/cmd cold-start on the windows-latest CI runner can exceed vitest's
// 5000ms default. Must also exceed UnsafeLocalCodeExecutor's default
// 40000 tightens the project's 60000 testTimeout, which a per-test argument
// replaces rather than raises. It stays above UnsafeLocalCodeExecutor's default
// timeoutSeconds (30) so the executor's own timeout error surfaces first; see
// core/src/code_executors/unsafe_local_code_executor.ts
// core/src/code_executors/unsafe_local_code_executor.ts. Only the four
// it.skipIf(!IS_WINDOWS) tests pass it, where shell cold-start is slowest.
const TEST_EXECUTION_TIMEOUT = 40000;

describe('RunSkillScriptTool Integration with UnsafeLocalCodeExecutor', () => {
Expand Down
8 changes: 5 additions & 3 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import path from 'path';
import {defineConfig} from 'vitest/config';

/**
* Hook budget (ms) for the `integration` project: install-heavy `beforeAll`
* hooks run `npm install` (and sometimes `npm run build`) per fixture, which
* exceeds Vitest's 10s default on a slow or loaded machine.
* Hook budget (ms) for the `integration` project. The `beforeAll` hooks run
* `npm install` (and sometimes `npm run build`) per fixture, and the `afterAll`
* hooks remove `node_modules` recursively, which exceeds Vitest's 10s default.
* A cold, network-bound install has been measured at ~70s, so 120s covers the
* worst case. Trade-off: a stuck hook takes this long to surface.
*/
const INTEGRATION_HOOK_TIMEOUT_MS = 120000;

Expand Down
Loading