Synchronize history paging and Node cancellation tests

This commit is contained in:
yudshj committed 2026-11-19 12:43:54 +08:00
1 parent 73723b46c7
commit 5dc1009c8d
2 files changed
+10 -4

No files matched your search

+2 -2
View File
@@ -16,7 +16,7 @@ import {
assertFixtureInventory, captureStableAria, compareOrRefreshGolden,
launchWebScaffold, seedSession, watchConsole, webSnapshotMode, type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, saveFailureShot } from './support.ts'
import { loadEarlierChatPage, newEnglishPage, saveFailureShot } from './support.ts'
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/stats-paged-history', import.meta.url))
const UI_EXPECTED = fileURLToPath(new URL('./expected/stats-paged-history/ui.expected.md', import.meta.url))
@@ -127,7 +127,7 @@ describe('web e2e: whole-session stats survive history paging', () => {
// 加载更早: prepending the older page must not move ANY strip figure —
// counts, wall times, or token groups.
await page.getByRole('button', { name: 'Load earlier' }).click()
await loadEarlierChatPage(page)
await expect.poll(() => page.getByText('m1', { exact: true }).count(), { timeout: 10_000 }).toBe(1)
const history = page.locator('[data-chat-history]')
await expect.poll(() => history.getAttribute('data-chat-history'), { timeout: 10_000 }).toBe('idle')
@@ -210,8 +210,14 @@ describe('Node program process', () => {
const { run } = await setup()
const entered = Promise.withResolvers<undefined>()
const controller = new AbortController()
const active = run({ ...timing, program: 'void tools.enter({}); for (;;) {}', signal: controller.signal, bindings: bindings({ enter: async () => { entered.resolve(undefined); return null } }) })
await entered.promise
const active = run({
...timing,
program: 'await tools.enter({}); for (;;) {}',
signal: controller.signal,
bindings: bindings({ enter: async () => { entered.resolve(undefined); return null } }),
})
const earlyResult = await Promise.race([entered.promise, active])
expect(earlyResult).toBeUndefined()
controller.abort('stop')
expect((await active).error).toEqual({ kind: 'abort', message: 'stop' })
})