test: stabilize aggregate coverage waits

This commit is contained in:
Hypatia May
2026-07-30 19:19:35 +08:00
parent 4f61bb536a
commit bf1f06d398
3 changed files with 11 additions and 6 deletions

View File

@@ -27,6 +27,9 @@ const TEST_POLICY: CordisCatalogPolicy = {
inheritedServices: [],
}
// Cold TypeScript program creation can exceed Vitest's 5s default under aggregate coverage load.
const COLD_PROGRAM_TIMEOUT = { timeout: 15_000 }
function collectEvents(root: string): EventEntry[] {
return collectEventsWithPolicy(root, TEST_POLICY)
}
@@ -126,7 +129,7 @@ afterEach(() => {
})
describe('gen-cordis-catalog collectEvents', () => {
it('extracts a well-formed event with its @mode and JSDoc', () => {
it('extracts a well-formed event with its @mode and JSDoc', COLD_PROGRAM_TIMEOUT, () => {
const events = collectEvents(make(
' /**\n * A thing happened.\n * @param id - which thing.\n * @mode emit\n */\n \'fix/happened\'(id: string): void',
))

View File

@@ -172,9 +172,10 @@ describe('typert loader', () => {
expect(ctx.typert.get('@fixture/late#Late')).toBeUndefined()
await ctx.loader.create({ name: '@fixture/late' })
await ctx.loader.await()
// The microtask flush and the dynamic import need a turn to settle.
await new Promise(resolve => setTimeout(resolve, 20))
expect(ctx.typert.get('@fixture/late#Late')).toBeDefined()
// Contributor import settles after Loader's own await boundary.
await vi.waitFor(() => {
expect(ctx.typert.get('@fixture/late#Late')).toBeDefined()
}, { timeout: 10_000 })
})
it('drops an in-flight manifest when the loader is disposed before import settles', LOADER_TEST_TIMEOUT, async () => {

View File

@@ -3897,8 +3897,9 @@ describe('skill slash command', () => {
source: 'runtime',
content: 'Dynamic body.',
})
await tick()
expect(result.terminal.output).toContain('DYNAMIC_COMPLETION_MARKER')
await vi.waitFor(() => {
expect(result.terminal.output).toContain('DYNAMIC_COMPLETION_MARKER')
})
result.terminal.send('\x03')
disposeSkill()