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
4 changes: 2 additions & 2 deletions tests/integration/agent_loader/agent_dirname_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -56,6 +56,6 @@ describe.each(['__dirname', '__filename', 'import_meta_url'])(
await fs
.unlink(path.join(projectPath, 'package-lock.json'))
.catch(() => {});
}, TEST_EXECUTION_TIMEOUT);
});
},
);
8 changes: 4 additions & 4 deletions tests/integration/app_loader/app_loader_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -62,7 +62,7 @@ describe('App loader CLI integration', () => {
await fs
.unlink(path.join(projectPath, 'package-lock.json'))
.catch(() => {});
}, TEST_EXECUTION_TIMEOUT);
});
},
);
});
Expand All @@ -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',
Expand Down Expand Up @@ -138,5 +138,5 @@ describe('AgentLoader discovery and loading integration', () => {
await fs
.unlink(path.join(projectPath, 'package-lock.json'))
.catch(() => {});
}, TEST_EXECUTION_TIMEOUT);
});
});
13 changes: 2 additions & 11 deletions tests/integration/build_setup/build_setup_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -128,6 +119,6 @@ describe('Build setup', () => {
.rm(`${projectPath}/dist`, {recursive: true, force: true})
.catch(() => {});
}
}, HOOK_TIMEOUT);
});
});
});
2 changes: 1 addition & 1 deletion tests/integration/skills/script_js/agent_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
15 changes: 12 additions & 3 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading