e2e·Storybook·visual 설정의 webServer 넷은 command가 먼저 빌드하는데 timeout이 없어 Playwright 기본 60 s에 기댄다. 값에 근거가 없어 느린 날 빌드가 넘으면 시험이 시작도 못 하고, 올릴 때도 근거가 없다. 빌드를 포함하는 항목마다 desktop에서 잰 시작 시간(webServer 시작부터 URL 응답까지, DEBUG=pw:webserver)을 childProcessTimeout에 넘긴다. Vitest 시험의 자식 프로세스와 같은 규칙(잰 최장의 15배를 30 s 단위로 올림)이다. 앱 빌드+preview 최장 3,880 ms(e2e, 3회)·3,887 ms(visual, 2회) → 60 s, Storybook 빌드+정적 서버 최장 8,887 ms(storybook, 2회)· 8,888 ms(visual, 2회) → 150 s. test:a11y는 e2e 설정을 펼쳐 같은 값을 받는다. dev·capabilities 설정은 dev 서버만 띄워 그대로 둔다. helper 머리말과 docs/work/reference/testing.md 2절에 webServer와 재는 법을 한 줄씩 더한다. 전역 timeout 올리기는 .claude/rules/tests.md 9번이 막고, 빌드를 global setup으로 옮기는 안은 빌드 스크립트와 storybook-static.ts 명령을 바꿔야 해 범위 밖이라 버렸다. visual 설정의 두 빌드는 동시에 돌지 않는다. Playwright 1.62가 webServer를 차례로 띄우고(설정의 순서대로 하나가 응답한 뒤 다음), 측정에서도 Storybook 서버는 앱 서버가 응답한 1 ms 뒤에 시작했다. 위험·한계: Playwright는 응답을 최대 1 s 간격으로 보므로 잰 값은 실제보다 최대 1 s 길다. 측정은 heavy.lock 아래 load 15~23에서 2~3회다. Storybook 빌드가 멈추면 이제 60 s가 아니라 150 s 뒤에 실패한다. 앱 빌드 두 곳은 값이 기본과 같은 60 s다. webServer timeout을 보는 검사는 없다 (test-timeout-declarations는 Vitest 파일만 본다). 빌드가 더 느린 파생 프로젝트는 자기 desktop에서 다시 재야 한다. 검증: 고치기 전 origin/main에서 빌드하는 webServer 넷 모두 timeout 없음(`git grep -n -B2 -A8 webServer -- 'playwright*.config.ts'`의 timeout 줄 0, 설정 파서 rc=1), 고친 뒤 넷 모두 있음(파서 rc=0). desktop 트리 b05110e0(82b959ff위, 이 커밋과 설정이 같다): test:storybook·test:visual rc=0, CI=true merge 단계 14개 rc=0, FE-GATE-029·030 rc=0. 노트북 laptop-gate, 트리 3a291c92(7752f90d위, 이 커밋): lint·check:types· test:unit 4052개·verify:documentation rc=0, scripts/verify.sh docs rc=0. Refs: REV-FE-0015, REV-FE-0023
36 lines
1.6 KiB
TypeScript
36 lines
1.6 KiB
TypeScript
/**
|
|
* Timeouts for Vitest tests that start a child process
|
|
* (docs/work/reference/testing.md 2절: such a test declares its own timeout).
|
|
* tests/setup.ts fails a test on the default timeout that starts one.
|
|
* It is also the one way to give any test, describe or hook more than the
|
|
* default, a long in-process run included, so every such number at a call is
|
|
* a desktop measurement. tests/unit/test-timeout-declarations.test.ts refuses
|
|
* a number written by hand (1112/03-08).
|
|
* A Playwright webServer whose command builds takes its timeout from here too
|
|
* (playwright*.config.ts), measured from the server's start to its URL
|
|
* answering.
|
|
*/
|
|
|
|
/** `testTimeout` in vitest.config.ts, sized for tests that run in process. */
|
|
export const DEFAULT_TEST_TIMEOUT_MS = 10_000;
|
|
|
|
/**
|
|
* A child process slowed down far more than in-process code on a loaded
|
|
* desktop: a documentation test that runs its checker as a child took 0.4 to
|
|
* 1.2 s, and 10.6 s once inside an FE-GATE-020 drill (2026-11-12), so it
|
|
* failed on the 10 s default.
|
|
*/
|
|
const LOADED_HOST_SLOWDOWN = 15;
|
|
const STEP_MS = 30_000;
|
|
|
|
/**
|
|
* The timeout for a test, or for a describe, whose longest measured run took
|
|
* `longestMeasuredMs`: fifteen times that, rounded up to a 30 s step. Measure
|
|
* on desktop with the JSON reporter, with test:coverage and test:unit, and pass
|
|
* the longest test of the describe. For a webServer, run its config on desktop
|
|
* with DEBUG=pw:webserver and pass the longest start.
|
|
*/
|
|
export function childProcessTimeout(longestMeasuredMs: number): number {
|
|
return Math.max(1, Math.ceil((longestMeasuredMs * LOADED_HOST_SLOWDOWN) / STEP_MS)) * STEP_MS;
|
|
}
|