From 6cd0be53ce324765c6540a1bea809f5d6bb22ea8 Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Fri, 26 Jun 2026 11:08:18 +0800 Subject: [PATCH] fix(test): raise timeout for cold-import suites to stop CI flake Two packages/core suites cold-import a large module graph inside the 5s per-test budget and intermittently time out under CI runner load: - config-session-env.test.ts: afterEach -> vi.resetModules() makes every test re-import config.js's full transitive graph cold (a sibling already runs ~4.3s, right at the edge). - skill-activation.test.ts: the integration test await-imports coreToolScheduler.js just to reach one pure helper, pulling the whole scheduler graph cold. Neither touches the network/LLM; it's transform+evaluate cost, not a hang. Give both suites a 30s testTimeout so a slow-but-correct import stops being reported as a failure while a genuine hang still trips. --- packages/core/src/config/config-session-env.test.ts | 7 +++++++ packages/core/src/skills/skill-activation.test.ts | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/core/src/config/config-session-env.test.ts b/packages/core/src/config/config-session-env.test.ts index 5cc2fab3159..c48295a00cc 100644 --- a/packages/core/src/config/config-session-env.test.ts +++ b/packages/core/src/config/config-session-env.test.ts @@ -103,6 +103,13 @@ const baseParams: ConfigParameters = { overrideExtensions: [], }; +// Each test re-imports config.js's full transitive module graph cold +// (afterEach calls vi.resetModules() so the module-level sessionEnvClaimed +// flag resets). That cold transform+evaluate runs several seconds and, under +// a contended CI runner, crosses the 5s default — a flaky timeout, not a hang. +// The reset is load-bearing for what these tests check, so give them headroom. +vi.setConfig({ testTimeout: 30_000 }); + describe('Config sessionEnvClaimed guard', () => { let originalEnv: string | undefined; diff --git a/packages/core/src/skills/skill-activation.test.ts b/packages/core/src/skills/skill-activation.test.ts index 3f1865f8835..f0302b031af 100644 --- a/packages/core/src/skills/skill-activation.test.ts +++ b/packages/core/src/skills/skill-activation.test.ts @@ -5,7 +5,7 @@ */ import * as path from 'node:path'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; import { SkillActivationRegistry, resolveProjectRelativePath, @@ -13,6 +13,12 @@ import { } from './skill-activation.js'; import type { SkillConfig } from './types.js'; +// The integration tests below `await import('../core/coreToolScheduler.js')` +// just to reach one pure helper, but that drags in the whole scheduler module +// graph cold. The first such import runs a few seconds and, under a contended +// CI runner, crosses the 5s default — a flaky timeout, not a hang. +vi.setConfig({ testTimeout: 30_000 }); + function makeSkill(overrides: Partial): SkillConfig { return { name: overrides.name ?? 'test-skill',