diff --git a/tests/integration/agent_loader/agent_dirname_test.ts b/tests/integration/agent_loader/agent_dirname_test.ts index 1e71a3a1d..13b5acdff 100644 --- a/tests/integration/agent_loader/agent_dirname_test.ts +++ b/tests/integration/agent_loader/agent_dirname_test.ts @@ -26,7 +26,7 @@ describe.each(['__dirname', '__filename', 'import_meta_url'])( beforeAll(async () => { await execAsync('npm install', {cwd: projectPath}); - }, TEST_EXECUTION_TIMEOUT); + }); it( 'should run agent and load params from file nearby via package.json script', @@ -56,6 +56,6 @@ describe.each(['__dirname', '__filename', 'import_meta_url'])( await fs .unlink(path.join(projectPath, 'package-lock.json')) .catch(() => {}); - }, TEST_EXECUTION_TIMEOUT); + }); }, ); diff --git a/tests/integration/app_loader/app_loader_test.ts b/tests/integration/app_loader/app_loader_test.ts index 4367307b8..7d06a3fd8 100644 --- a/tests/integration/app_loader/app_loader_test.ts +++ b/tests/integration/app_loader/app_loader_test.ts @@ -29,7 +29,7 @@ describe('App loader CLI integration', () => { beforeAll(async () => { await execAsync('npm install', {cwd: projectPath}); - }, TEST_EXECUTION_TIMEOUT); + }); it( 'should run app via package.json start script and get responses', @@ -62,7 +62,7 @@ describe('App loader CLI integration', () => { await fs .unlink(path.join(projectPath, 'package-lock.json')) .catch(() => {}); - }, TEST_EXECUTION_TIMEOUT); + }); }, ); }); @@ -77,7 +77,7 @@ describe('AgentLoader discovery and loading integration', () => { beforeAll(async () => { await execAsync('npm install', {cwd: projectPath}); loader = new AgentLoader(projectPath); - }, TEST_EXECUTION_TIMEOUT); + }); it( 'should discover apps vs agents across directories and standalone files', @@ -138,5 +138,5 @@ describe('AgentLoader discovery and loading integration', () => { await fs .unlink(path.join(projectPath, 'package-lock.json')) .catch(() => {}); - }, TEST_EXECUTION_TIMEOUT); + }); }); diff --git a/tests/integration/build_setup/build_setup_test.ts b/tests/integration/build_setup/build_setup_test.ts index 880dee469..4a4f1eb53 100644 --- a/tests/integration/build_setup/build_setup_test.ts +++ b/tests/integration/build_setup/build_setup_test.ts @@ -14,15 +14,6 @@ const dirname = process.cwd(); 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', @@ -52,7 +43,7 @@ describe('Build setup', () => { expect(buildResult.stderr).toBe(''); expect(buildResult.stdout).toContain('\nBuild complete'); } - }, HOOK_TIMEOUT); + }); it( 'should build and run agent successfully', @@ -128,6 +119,6 @@ describe('Build setup', () => { .rm(`${projectPath}/dist`, {recursive: true, force: true}) .catch(() => {}); } - }, HOOK_TIMEOUT); + }); }); }); diff --git a/tests/integration/skills/script_js/agent_test.ts b/tests/integration/skills/script_js/agent_test.ts index b17df2c86..c904b0196 100644 --- a/tests/integration/skills/script_js/agent_test.ts +++ b/tests/integration/skills/script_js/agent_test.ts @@ -31,7 +31,7 @@ const TEST_EXECUTION_TIMEOUT = 60000; describe('Agent with skills that generates JS script and runs it locally', () => { beforeAll(async () => { await execAsync('npm install', {cwd: PROJECT_PATH}); - }, TEST_EXECUTION_TIMEOUT); + }); it( 'should run agent with skills successfully', diff --git a/vitest.config.ts b/vitest.config.ts index 1b7eaee63..5ec0393a7 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -9,14 +9,23 @@ 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. + * hooks run `npm install` (and sometimes `npm run build`) per fixture, and the + * matching `afterAll` hooks recursively remove the resulting `node_modules`. + * That exceeds Vitest's 10s default on a slow or loaded machine. + * + * The twelve `build_setup` hook runs take ~16s combined warm on ubuntu-latest, + * but a cold, network-bound install has been measured at ~70s, so 120s covers + * the worst case. Trade-off: a genuinely stuck hook takes this long to surface. + * + * An install or teardown hook must not pass its own timeout argument, which + * shadows this floor rather than raising it. */ const INTEGRATION_HOOK_TIMEOUT_MS = 120000; /** * Test budget (ms) for the `integration` project: matches the largest per-file - * timeout in the repo. Per-file `it()`/hook timeouts still override both. + * timeout in the repo. A per-test `it()` timeout may still override this; a + * hook timeout must not (see above). */ const INTEGRATION_TEST_TIMEOUT_MS = 60000;