test(#4516): migrate per-runtime install/upgrade adapters to named timeout constants (#4582)

Batch 5 of the ad hoc timeout literal migration (epic #4445). Replaces
every bare numeric timeout/timeoutMs object-literal property across
tests/augment-upgrades.test.cjs, tests/shared-hooks-dir-resolution.test.cjs,
tests/antigravity-upgrades.test.cjs, tests/cursor-hooks.test.cjs,
tests/cursor-hook-workspace-roots.test.cjs, tests/gemini-runtime-removed.test.cjs,
tests/kilo-upgrades.test.cjs, tests/kimi-upgrades.test.cjs,
tests/kimi-variant-disambiguation.test.cjs, tests/opencode-plugin-adapter.test.cjs,
tests/windsurf-hooks-bridge.test.cjs, tests/effort-sync-installed-runtime.test.cjs,
and tests/hooks-commonjs-marker.test.cjs with a named constant, per
eslint-rules/no-adhoc-timeout-literal.cjs. Removes these 13 files from the
rule's allowlist.

Adds one new shared constant to tests/helpers/timeouts.cjs for spawning a
single already-staged hook script directly (a heavier class than the
existing quick-spawn norm), shared across three files in this batch. One
new file-local constant covers a property-test driver process distinct
from any existing class. Every other site reuses an existing shared norm.
No src/bin file touched, no numeric timeout value changed anywhere.

Co-authored-by: sim <sim@local>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-09-10 14:11:26 -04:00
committed by GitHub
parent 0b928fe28c
commit 557a0b2876
15 changed files with 65 additions and 40 deletions

View File

@@ -33,7 +33,7 @@ const ROOT = path.join(__dirname, '..');
const INSTALL_JS = path.join(ROOT, 'bin', 'install.js');
// #3145: class-norm timeout, not a per-suite value — see helpers/timeouts.cjs.
const { BUILD_TIMEOUT_MS: BUILD_HOOKS_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
const { BUILD_TIMEOUT_MS: BUILD_HOOKS_TIMEOUT_MS, INSTALL_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
// hooks/dist is gitignored + built; build it idempotently so a real install
// emits hooks (mirrors golden-install-parity / install-minimal-hooks).
@@ -64,7 +64,7 @@ function runInstaller(args, homeDir) {
'XDG_CONFIG_HOME', 'CODEX_CONFIG_DIR', 'OPENCODE_CONFIG_DIR', 'KILO_CONFIG_DIR',
]) delete env[k];
return spawnSync(process.execPath, [INSTALL_JS, ...args], {
cwd: homeDir, env, encoding: 'utf8', timeout: 120000,
cwd: homeDir, env, encoding: 'utf8', timeout: INSTALL_TIMEOUT_MS,
});
}
@@ -127,7 +127,7 @@ describe('#1928 --gemini CLI deprecation redirect', () => {
delete env.GSD_TEST_MODE;
delete env.CLAUDE_CONFIG_DIR;
const r = spawnSync(process.execPath, [INSTALL_JS, '--gemini', '--uninstall', '--global'], {
cwd: home, env, encoding: 'utf8', timeout: 120000,
cwd: home, env, encoding: 'utf8', timeout: INSTALL_TIMEOUT_MS,
});
assert.strictEqual(r.status, 1, 'must exit 1, not fall through to the uninstall dispatch');