diff --git a/CHANGELOG.md b/CHANGELOG.md index a6d95809..0e12a26b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지 - 선택 runtime 제거 드릴 셋이 merge의 FE-GATE-020에서 main 단계의 새 게이트 FE-GATE-030으로 옮는다. main job 이름이 `main / self-tests and removal drills`로 바뀐다. 그 이름을 필수 검사로 걸었으면 바꾼다. 선택 runtime을 바꾸는 PR은 `scripts/verify.sh gate FE-GATE-030`을 직접 돌린다. - merge job 셋과 main job(`main / self-tests and removal drills`)이 runner의 actions/cache 저장소에서 Node·corepack·pnpm store와 메타데이터 캐시를 복원하고, main run만 저장한다. runner에 캐시 서버가 없으면 복원 단계가 경고만 내고 설치가 그대로 돈다. 자기 runner의 캐시 크기 상한을 확인한다(항목 하나가 압축 전 약 0.7GB, lockfile이 바뀔 때마다 새 항목). - FE-GATE-005가 `test:unit`·`test:contract`를 따로 돌지 않는다. `tests/unit`·`tests/contract`는 `test:coverage`에서 한 번 돌고, 같은 실행이 `artifacts/tests/unit.xml`·`contract.xml`을 쓴다(`scripts/lib/coverage-bundle-junit-reporter.ts`). 계약에서 command `test-unit`·`test-contract`가 빠진다. 자기 `config/ci/gates.json`의 게이트가 그 id를 부르면 지운다. `test:coverage`의 경로에서 두 폴더 중 하나를 빼거나 그 reporter를 빼면 FE-GATE-005가 실패한다. 두 package script는 작업 중에 쓰는 명령으로 남는다. +- FE-GATE-009의 `test:a11y`가 `playwright test --config playwright.a11y.config.ts --grep @a11y`로 돌고 결과를 `artifacts/tests/a11y/`에 쓴다. 자기 `test:a11y`를 고쳐 썼으면 `--config playwright.a11y.config.ts`를 넣는다. 빠지면 008과 009가 같은 결과 경로에 써서 `tests/unit/playwright-result-paths.test.ts`(FE-GATE-005)가 실패한다(`scripts/verify.sh gate FE-GATE-005`). - 수동 접근성 기록(`docs/accessibility/route-reviews/`)에 WCAG 2.2 칸 둘이 생기고, `Release ID`를 릴리스 태그와 대조한다. - 옮기기 전: 자기 기록에 `M8`·`M9` 줄이 없으면 FE-GATE-009 형식 검사가 그 필드 이름을 대며 실패한다. release 단계를 태그 없이(브랜치에서 수동으로) 돌리면 FE-GATE-028이 `missing required environment: RELEASE_TAG`로 멈춘다. - 옮기는 법: 기록마다 `M8 Focus not obscured: pending`, `M9 Target size: pending` 두 줄을 더한다. 서명하는 기록의 `Release ID`는 다음 release부터 그 릴리스 태그(예 `v1.4.0`)로 적는다. release 단계는 태그 run에서 돈다. @@ -106,7 +107,8 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지 | [계약] | `verify:documentation`(FE-GATE-017)이 `scripts/verify.sh`와 `python3` 명령 안의 경로·script 이름도 대조한다. 자기 문서의 `scripts/verify.sh script <이름>`·`python3 <경로>`가 낡았으면 실패하니 고친다 (1112/08-06) | `scripts/verify-documentation-readiness.ts` | `aebb7c8c` | | [계약] | release의 provider job 둘(vulnerability·provenance)에 FE-GATE-013과 같은 runner 요구(`hostRequirements`)를 적고, 계약이 둘이 같은지 본다. provider 감독 스크립트가 provider를 띄우기 전에 비특권 user namespace를 점검하고, 막혔으면 `test:system` 사전 점검과 같은 문구로 멈춘다 (1101/13-03) | `config/ci/gates.json`, `scripts/contracts/ci-gates.ts`, `scripts/generate-ci-workflow.ts`, `.gitea/workflows/quality-gates.yml`, `scripts/check-system-test-prerequisites.ts`, `scripts/run-and-validate-provider.ts` | `9ebd0856` | | [계약] | 브라우저 job 컨테이너가 `--shm-size=2g`로 뜨고, Firefox 시험 프로필을 RAM 파일시스템(`/dev/shm`)에 둔다. Firefox가 시험 context의 저장소를 디스크 프로필에 두어, 디스크가 붐비면 첫 화면 5초 대기를 넘겼다. 자리가 모자라면 디스크 프로필로 돌고 이유를 한 줄 찍는다 | `scripts/generate-ci-workflow.ts`, `.gitea/workflows/quality-gates.yml`, `tests/support/browser/browser-test.ts`, `docs/operations/ci-quality-gates.md` | `f81dda49`, `c239bdf4` | -| [계약] | FE-GATE-008의 `test:e2e`가 이름에 `@a11y`가 붙은 시험을 빼고 돈다(`playwright test --grep-invert @a11y`). 그 시험은 FE-GATE-009의 `test:a11y`만 돈다. 두 실행은 같은 Playwright 설정이라 project(세 엔진)도 같다. FE-GATE-008만 돌리면 axe 스캔과 생성 기능 목록의 빈·오류 상태 화면은 돌지 않는다. 제품이 e2e spec에 `@a11y`를 붙인 시험도 009에서만 돈다. 시험 둘이 두 script의 짝과 PR 경로표의 008·009 짝을 지킨다. round9 R9-D11을 바꾼다(decisions.md FE-6) | `package.json`, `tests/unit/ci-workflow-generation.test.ts`, `tests/unit/pr-gate-selection.test.ts`, `docs/work/reference/decisions.md`, `docs/testing/taxonomy.md`, `.claude/skills/fe-qa/SKILL.md` | `d254d70a` | +| [계약] | FE-GATE-008의 `test:e2e`가 이름에 `@a11y`가 붙은 시험을 빼고 돈다(`playwright test --grep-invert @a11y`). 그 시험은 FE-GATE-009의 `test:a11y`만 돈다. `test:a11y`의 설정 `playwright.a11y.config.ts`는 e2e 설정을 펼치고 결과 경로만 따로 두므로 project(세 엔진)도 같다. FE-GATE-008만 돌리면 axe 스캔과 생성 기능 목록의 빈·오류 상태 화면은 돌지 않는다. 제품이 e2e spec에 `@a11y`를 붙인 시험도 009에서만 돈다. 시험 둘이 두 script의 짝과 PR 경로표의 008·009 짝을 지킨다. round9 R9-D11을 바꾼다(decisions.md FE-6) | `package.json`, `tests/unit/ci-workflow-generation.test.ts`, `tests/unit/playwright-result-paths.test.ts`, `tests/unit/pr-gate-selection.test.ts`, `docs/work/reference/decisions.md`, `docs/testing/taxonomy.md`, `.claude/skills/fe-qa/SKILL.md` | `d254d70a`, `ede99cb9` | +| [계약] | FE-GATE-009의 `test:a11y`가 `playwright.a11y.config.ts`로 돌아 결과 폴더·HTML report·`results.xml`을 `artifacts/tests/a11y/`에 쓴다. 전에는 e2e 설정을 그대로 써서, merge browser job이 008 다음 009를 돌고 올린 e2e 증거가 009 실행의 것이었다. FE-GATE-009 증거에 a11y `results.xml`·`report/index.html`(producer `test-a11y`)이 들어간다. 게이트 밖 `test:e2e:dev`는 `artifacts/tests/e2e-dev/`에 쓴다. 새 시험이 package script가 부르는 Playwright 설정끼리·게이트 명령끼리 결과 경로가 겹치거나, 게이트 명령이 쓰는 JUnit·report가 그 게이트의 증거가 아니면 실패한다. 제거 fixture 사본은 두 새 결과 폴더를 복사하지 않고, 같은 시험이 각 Playwright 설정의 결과 폴더가 그 제외 목록에 드는지 본다. a11y 설정은 FE-GATE-029가 읽도록 `testDir`을 글자로 둔다. 위 "먼저 할 일" (1106 영역 11의 3.2 (3) 증거 읽기 주의) | `package.json`, `playwright.a11y.config.ts`, `playwright.dev.config.ts`, `config/ci/gates.json`, `config/repository-layout.json`, `scripts/lib/removal-fixture.ts`, `tests/unit/playwright-result-paths.test.ts`, `tests/unit/removal-fixture.test.ts`, `tests/unit/ungated-tests.test.ts`, `tests/helpers/playwright-run-isolation.ts`, `tests/unit/ci-workflow-generation.test.ts`, `docs/testing/taxonomy.md`, `docs/work/reference/decisions.md` | `ede99cb9` | | [계약] | `dependency-cache` 단계를 main job(`main_gate`)에도 둔다. 키·경로·main run만 저장·frozen install은 merge job과 같다. release·promotion·provider job은 그대로 거절한다. 위 `7ed0af3d` 행의 「merge job 셋에만」을 바꾼다(decisions.md FE-7) | `config/ci/gates.json`, `scripts/contracts/ci-gates.ts`, `.gitea/workflows/quality-gates.yml`, `tests/unit/ci-workflow-generation.test.ts`, `docs/operations/ci-quality-gates.md` | `d254d70a` | | [계약] | FE-GATE-005의 명령이 `test:coverage`·`check:scale:pr` 둘이 된다. `tests/unit`·`tests/contract`의 JUnit 증거(`unit.xml`·`contract.xml`, 이름·형식 그대로)는 coverage 실행 안의 reporter가 쓰고, 두 증거의 producer는 `test-coverage`다. 한 폴더에서 시험 파일이 하나도 돌지 않거나 보고서가 그 폴더에서 돈 파일과 다른 파일을 담으면 그 실행이 실패한다. unit·contract 시험은 이제 coverage 계측 아래에서만 돈다. FE-GATE-004·006·007은 자기 실행을 그대로 둔다(decisions.md FE-4) | `config/ci/gates.json`, `package.json`, `scripts/lib/coverage-bundle-junit-reporter.ts`, `scripts/lib/feature-scaffold-drill.ts`, `tests/unit/coverage-bundle-junit-reporter.test.ts`, `docs/operations/ci-quality-gates.md` | `6cba1f50` | diff --git a/config/ci/gates.json b/config/ci/gates.json index 0d4e3c58..9ef34d0a 100644 --- a/config/ci/gates.json +++ b/config/ci/gates.json @@ -970,6 +970,24 @@ "schemaId": "text", "production": "runner-generated" }, + { + "id": "artifact-artifacts-tests-a11y-report-index-html", + "path": "artifacts/tests/a11y/report/index.html", + "schemaId": "html", + "production": "command-generated", + "producerCommandIds": [ + "test-a11y" + ] + }, + { + "id": "artifact-artifacts-tests-a11y-results-xml", + "path": "artifacts/tests/a11y/results.xml", + "schemaId": "junit", + "production": "command-generated", + "producerCommandIds": [ + "test-a11y" + ] + }, { "id": "artifact-artifacts-tests-a11y-json", "path": "artifacts/tests/a11y.json", @@ -1709,6 +1727,8 @@ ], "logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-009-txt", "evidenceArtifactIds": [ + "artifact-artifacts-tests-a11y-report-index-html", + "artifact-artifacts-tests-a11y-results-xml", "artifact-artifacts-tests-a11y-json" ], "retentionClassId": "merge-cycle" diff --git a/config/repository-layout.json b/config/repository-layout.json index fec526de..a8657b8a 100644 --- a/config/repository-layout.json +++ b/config/repository-layout.json @@ -246,6 +246,13 @@ "readBy": "pnpm, 모든 게이트", "sets": ["fixture-copy", "secret-scan", "history-free", "scale-source", "vite-build", "package-manifest"] }, + { + "path": "playwright.a11y.config.ts", + "kind": "tool-convention", + "role": "a11y 시험 설정(e2e 설정에 결과 경로만 따로)", + "readBy": "test:a11y (FE-GATE-009)", + "sets": ["fixture-copy", "secret-scan", "playwright-configs"] + }, { "path": "playwright.capabilities.config.ts", "kind": "tool-convention", @@ -257,13 +264,13 @@ "path": "playwright.config.ts", "kind": "tool-convention", "role": "e2e 설정(빌드 미리보기)", - "readBy": "test:e2e (FE-GATE-008), test:a11y (FE-GATE-009)", + "readBy": "test:e2e (FE-GATE-008), 이것을 펼치는 playwright.a11y.config.ts(test:a11y, FE-GATE-009)·playwright.dev.config.ts(test:e2e:dev)", "sets": ["fixture-copy", "secret-scan", "history-free", "playwright-configs"] }, { "path": "playwright.dev.config.ts", "kind": "tool-convention", - "role": "dev 서버 대상 e2e 설정", + "role": "dev 서버 대상 e2e 설정(결과 경로는 artifacts/tests/e2e-dev)", "readBy": "test:e2e:dev", "sets": ["fixture-copy", "secret-scan"] }, diff --git a/config/security/secret-scan-policy.json b/config/security/secret-scan-policy.json index a1bd645c..4e5b7036 100644 --- a/config/security/secret-scan-policy.json +++ b/config/security/secret-scan-policy.json @@ -27,6 +27,7 @@ "vite.service-worker.config.ts", "vitest.config.ts", "playwright.config.ts", + "playwright.a11y.config.ts", "playwright.capabilities.config.ts", "playwright.dev.config.ts", "playwright.storybook.config.ts", diff --git a/docs/testing/taxonomy.md b/docs/testing/taxonomy.md index 4c3f07c5..8e06bffc 100644 --- a/docs/testing/taxonomy.md +++ b/docs/testing/taxonomy.md @@ -14,7 +14,7 @@ script로 낮추지 않는다. | integration | `pnpm test:integration` | HTTP/MSW, IndexedDB, 조립된 browser-runtime 경계, 자식 프로세스·파일 시스템·IPC 통합 | `artifacts/tests/integration.xml` | | system / CI runner | `pnpm test:system` | systemd, bubblewrap, cgroup v2, CI provider 프로세스 통제를 갖춘 호환 Linux host. 그 host에서 bubblewrap이 권한 없는 user namespace와 network namespace를 만들 수 있어야 한다. CI와 `scripts/verify.sh`는 FE-GATE-013을 `scripts/run-in-system-container.sh`가 띄우는 컨테이너 안에서 돌린다 | `artifacts/tests/system.xml` | | end-to-end | `pnpm test:e2e` | 버전을 고정한 브라우저 엔진. 이름에 `@a11y`가 붙은 시험은 빼고 accessibility 층에서 돈다 | `artifacts/tests/e2e/` | -| accessibility | `pnpm test:a11y` | 버전을 고정한 브라우저 엔진. `tests/e2e/`에서 이름에 `@a11y`가 붙은 시험만 돈다 | `artifacts/tests/a11y.json` | +| accessibility | `pnpm test:a11y` | 버전을 고정한 브라우저 엔진. `tests/e2e/`에서 이름에 `@a11y`가 붙은 시험만 돈다. 설정은 e2e 설정에 결과 경로만 따로 둔 `playwright.a11y.config.ts`다 | `artifacts/tests/a11y.json`, `artifacts/tests/a11y/` | `test:all`은 평소 제품 개발 루프다. 다음을 순서대로 돌린다: `test:runtime-schema`, `test:unit`, `test:contract`, `test:component`, diff --git a/docs/work/reference/decisions.md b/docs/work/reference/decisions.md index 6ca7a035..406cffc2 100644 --- a/docs/work/reference/decisions.md +++ b/docs/work/reference/decisions.md @@ -73,7 +73,7 @@ | 결정 p 선택 runtime 제거 드릴을 main 단계로 | 2026-11-12 | FE-GATE-020의 선택 runtime 제거 드릴 셋(optional recipe, browser file/storage, realtime)을 새 게이트 FE-GATE-030으로 떼어 main 단계(`main_gate`)에서 돌린다. 기능 드릴(샘플 제거, scaffold)은 merge에 남는다. 이유: runner PR 1회 약 30분 가운데 7분쯤이고, worker를 늘리지 않고 merge 25분 목표에 닿는 길이 이것뿐이었다. 대가: 그 셋의 회귀를 병합 뒤 main run에서 본다. main이 빨강이면 다음 PR이 고친다. 짝 백엔드가 무거운 lane을 nightly로 옮긴 것과 같은 모양이다. 재검토: runner가 늘거나 드릴이 빨라져 merge에 다시 넣어도 25분 안이면 되돌린다 | 권하는 안으로 정함(2026-11-12, 총괄): 백엔드 nightly lane과 같은 모양(design-docs `template-program/README.md` 5절 p, w2-fe-2가 올린 O1) | | 의존성 캐시는 merge job만 | 2026-11-13 | merge job 셋(`merge_static`·`merge_test`·`merge_browser`)만 Node toolcache·corepack·pnpm store와 메타데이터 캐시를 `.nvmrc`·`pnpm-lock.yaml` 해시 키로 복원하고, 저장은 main run만 한다. release·promotion·provider job은 공급망 증거를 만들므로 매번 새로 설치한다. 이유: worker를 늘리지 않고 job마다 되풀이하던 내려받기와 공급망 검증 요청을 없앤다. 캐시가 없거나 깨져도 frozen install이 같은 node_modules를 만든다. 짝 백엔드의 JDK·Gradle·Trivy 캐시와 같은 저장 규칙이다. 버린 안: CI 이미지에 의존성을 굽기(레지스트리 쓰기 토큰이 든다). 규칙의 정본은 `scripts/contracts/ci-gates.ts`의 `DEPENDENCY_CACHE`. (2026-11-20 FE-7 행이 바꿈) | 권하는 안으로 정함(2026-11-13, 총괄): 의존성 캐시는 merge job만, 공급망 증거 job은 매번 새로 설치 | | PR은 바뀐 범위의 merge 게이트만 | 2026-11-13 | PR run의 merge job은 `config/ci/pr-gate-selection.json` 경로표로 바뀐 파일이 닿는 게이트만 돌고, 안 도는 게이트는 `건너뜀: <게이트 ID> — <이유>` 한 줄을 남긴다. 전역 파일·표에 없는 파일·빈 diff·diff를 못 읽음이면 전부 돈다. main·release run은 늘 전부 돈다. 판정은 `scripts/lib/pr-gate-selection.ts`, 계약 시험은 `tests/unit/pr-gate-selection.test.ts`다 | 소유자 결정(2026-11-13 18:3x, design-docs `ci/manual.md` 4절). PR 경로표가 놓친 것은 main이 잡는다. main push에서 선택 때문에 놓친 실패가 나오면 경로표를 고친다 | -| FE-6 `@a11y` 시험은 FE-GATE-009에서만 | 2026-11-20 | round9 R9-D11을 바꾼다. FE-GATE-008의 `test:e2e`는 이름에 `@a11y`가 붙은 시험을 빼고(`--grep-invert @a11y`) 돈다. 그 시험은 FE-GATE-009의 `test:a11y`가 자기 실행으로 돈다. 두 실행은 같은 Playwright 설정을 써서, 그 시험이 도는 project(chromium·firefox·webkit)도 같다. 전제(게이트마다 증거를 새로 만든다)는 그대로다. 버린 안(FE-GATE-009가 FE-GATE-008 결과를 읽기)도 계속 버린다. 이유: merge browser job이 같은 `@a11y` 시험 33개를 두 번 돌았다. 대가: FE-GATE-008만 돌리면 `@a11y` 시험(axe 스캔, 생성 기능 목록의 빈·오류 상태 화면)은 돌지 않는다. 재검토: CI run에서 FE-GATE-008이 돌고 FE-GATE-009가 돌지 않는 경우(단계에서 009를 빼기, 두 게이트를 다른 조건의 job으로 나누기, PR 경로표)가 생기면 그 run에서 `@a11y` 시험이 돌지 않으므로 되돌린다. 두 실행의 Playwright project가 달라지면(설정을 나누는 등) 그 시험이 도는 브라우저를 다시 대조한다 | 총괄(2026-11-20): 소유자 2026-11-19 CI 속도 지시, design-docs `ci/06-frontend-ci-speed-handoff.md` 4.1절 | +| FE-6 `@a11y` 시험은 FE-GATE-009에서만 | 2026-11-20 | round9 R9-D11을 바꾼다. FE-GATE-008의 `test:e2e`는 이름에 `@a11y`가 붙은 시험을 빼고(`--grep-invert @a11y`) 돈다. 그 시험은 FE-GATE-009의 `test:a11y`가 자기 실행으로 돈다. `test:a11y`의 설정(`playwright.a11y.config.ts`)은 e2e 설정을 펼치고 결과 경로만 바꾼다(2026-11-20, 008의 e2e 결과를 덮던 것을 고침). 그래서 그 시험이 도는 project(chromium·firefox·webkit)도 같고, 결과 경로 시험(`tests/unit/playwright-result-paths.test.ts`)이 결과 경로 밖 설정이 같은지 본다. 전제(게이트마다 증거를 새로 만든다)는 그대로다. 버린 안(FE-GATE-009가 FE-GATE-008 결과를 읽기)도 계속 버린다. 이유: merge browser job이 같은 `@a11y` 시험 33개를 두 번 돌았다. 대가: FE-GATE-008만 돌리면 `@a11y` 시험(axe 스캔, 생성 기능 목록의 빈·오류 상태 화면)은 돌지 않는다. 재검토: CI run에서 FE-GATE-008이 돌고 FE-GATE-009가 돌지 않는 경우(단계에서 009를 빼기, 두 게이트를 다른 조건의 job으로 나누기, PR 경로표)가 생기면 그 run에서 `@a11y` 시험이 돌지 않으므로 되돌린다. a11y 설정이 결과 경로 밖에서 e2e 설정과 달라지면 그 시험이 도는 브라우저를 다시 대조한다 | 총괄(2026-11-20): 소유자 2026-11-19 CI 속도 지시, design-docs `ci/06-frontend-ci-speed-handoff.md` 4.1절 | | FE-7 main job도 의존성 캐시 | 2026-11-20 | 2026-11-13 「의존성 캐시는 merge job만」을 바꾼다. main job(`main_gate`, FE-GATE-029·030)도 merge job 셋과 같은 키·경로로 캐시를 복원한다. 저장은 그대로 main run만 하고, 설치는 그대로 `--frozen-lockfile`이다. release·promotion·provider job은 그대로 매번 새로 설치한다. 이유: main job만 install이 15~24초였다(merge job은 1~2초). main job은 공급망 증거를 만들지 않는다. 재검토: main job이 공급망 증거를 만들게 되면 release·promotion job처럼 매번 새로 설치하게 되돌린다. main run 로그의 install step이 캐시를 복원해도 줄지 않으면 캐시 step을 뺀다 | 총괄(2026-11-20): design-docs `ci/06-frontend-ci-speed-handoff.md` 4.2절 | | FE-4 005 안 일반 실행 빼기 | 2026-11-20 | FE-GATE-005는 `tests/unit`·`tests/contract`를 `test:coverage`에서 한 번만 돈다. `test:unit`·`test:contract` 명령을 게이트에서 빼고, 같은 coverage 실행에서 `scripts/lib/coverage-bundle-junit-reporter.ts`가 `artifacts/tests/unit.xml`·`contract.xml`을 쓴다. 증거 이름과 게이트 ID는 그대로이고, 두 증거는 FE-GATE-005의 명령이 그 실행 중에 새로 만든다. 전제(게이트마다 증거를 새로 만든다)는 그대로다. 버린 안: coverage 실행 한 번이 FE-GATE-004·006·007의 증거까지 내기(design-docs `ci/04-…` R-3 (가), 약 −1:30). 그 세 게이트가 FE-GATE-005의 결과를 읽게 되어 FE-6에서 버린 꼴과 같다: coverage 실행이 죽으면 세 게이트도 판정을 못 내고, 혼자 돌릴 수 없다. 004는 005보다 앞이라 차례도 바꿔야 했다. 이유: FE-GATE-005 안에서 같은 시험 파일을 두 번 돌았다(약 0:57). 대가: unit·contract 시험은 이제 coverage 계측 아래에서만 돈다. 시간에 기대는 시험이 가려질 수 있다. 004·006·007의 묶음은 coverage에서 한 번 더 돈다(약 0:33). 재검토: coverage 실행에서 안 보이고 일반 실행에서만 보이는 unit·contract 실패가 나오면 일반 실행을 되돌린다. Vitest를 올릴 때는 reporter가 그 JUnit reporter에 기대므로 분할한 보고서를 일반 실행과 다시 대조한다 | 총괄(2026-11-20): 소유자 2026-11-19 CI 속도 지시, design-docs `ci/06-frontend-ci-speed-handoff.md` 4.3·6.2절 | | 구조·기술 결정 기록 | 2026-07-26~ | `VD-01`~(빈 번호 있음) | `docs/adr/` | diff --git a/package.json b/package.json index ff0edb44..6dacf78b 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "check:http-scenario-evidence:fixture": "node scripts/check-test-evidence.ts --scenario-only --source-root tests/fixtures/test-evidence/scenarios/source --policy tests/fixtures/test-evidence/scenarios/policy.json --catalog tests/fixtures/test-evidence/scenarios/catalog.json --receipt tests/fixtures/test-evidence/scenarios/receipt.json --artifact artifacts/quality/http-scenario-evidence-fixture.json", "check:test-evidence:source": "node scripts/check-test-evidence.ts --source-only --artifact artifacts/quality/test-evidence-source.json", "check:test-evidence:fixture": "node scripts/check-test-evidence.ts --source-root tests/fixtures/test-evidence/forbidden --artifact artifacts/quality/test-evidence-fixture.json", - "test:a11y": "node scripts/generate-product-feature-index.ts && playwright test --grep @a11y && node scripts/write-a11y-report.ts", + "test:a11y": "node scripts/generate-product-feature-index.ts && playwright test --config playwright.a11y.config.ts --grep @a11y && node scripts/write-a11y-report.ts", "review:a11y-manual": "node scripts/generate-product-feature-index.ts && node scripts/verify-a11y-manual.ts", "test:sample-removal": "node scripts/generate-product-feature-index.ts && node scripts/test-sample-removal.ts", "test:feature-scaffold": "node scripts/generate-product-feature-index.ts && node scripts/test-feature-scaffold.ts", diff --git a/playwright.a11y.config.ts b/playwright.a11y.config.ts new file mode 100644 index 00000000..1940ad0d --- /dev/null +++ b/playwright.a11y.config.ts @@ -0,0 +1,24 @@ +import { defineConfig } from "@playwright/test"; + +import e2eConfig from "./playwright.config.ts"; +import { testRunPath } from "./scripts/lib/run-isolation.ts"; + +// test:a11y (FE-GATE-009) runs the @a11y specs on the e2e build, browsers and +// server. It used playwright.config.ts as it was and wrote the e2e results, +// report and results.xml, so in the merge browser job, which runs FE-GATE-008 +// and then FE-GATE-009 in one checkout, the e2e evidence it uploaded was this +// run's. Only the result paths differ from the e2e config +// (tests/unit/playwright-result-paths.test.ts). +export default defineConfig({ + ...e2eConfig, + // The e2e config's, as a literal: FE-GATE-029 reads testDir in the text of + // the config a gate runs (scripts/lib/ungated-tests.ts). + testDir: "./tests/e2e", + forbidOnly: true, + outputDir: testRunPath("artifacts/tests/a11y/results"), + reporter: [ + ["list"], + ["html", { outputFolder: testRunPath("artifacts/tests/a11y/report"), open: "never" }], + ["junit", { outputFile: testRunPath("artifacts/tests/a11y/results.xml") }], + ], +}); diff --git a/playwright.dev.config.ts b/playwright.dev.config.ts index 0c772faf..68df3e99 100644 --- a/playwright.dev.config.ts +++ b/playwright.dev.config.ts @@ -6,6 +6,7 @@ import { reservePort, RUN_OUTPUT_ROOT_VARIABLE, TEST_PORT_VARIABLES, + testRunPath, testRunRoot, } from "./scripts/lib/run-isolation.ts"; @@ -18,6 +19,15 @@ const origin = `http://127.0.0.1:${port}`; export default defineConfig({ ...releaseConfig, + // Its own result paths: with the e2e config's, a local test:e2e:dev run + // replaced the results, report and results.xml FE-GATE-008 had written + // (tests/unit/playwright-result-paths.test.ts). + outputDir: testRunPath("artifacts/tests/e2e-dev/results"), + reporter: [ + ["list"], + ["html", { outputFolder: testRunPath("artifacts/tests/e2e-dev/report"), open: "never" }], + ["junit", { outputFile: testRunPath("artifacts/tests/e2e-dev/results.xml") }], + ], use: { ...releaseConfig.use, baseURL: origin, diff --git a/scripts/lib/removal-fixture.ts b/scripts/lib/removal-fixture.ts index b83a7052..f6e9bac6 100644 --- a/scripts/lib/removal-fixture.ts +++ b/scripts/lib/removal-fixture.ts @@ -104,11 +104,15 @@ export function removalFixtureExcludedTests( * cannot be used to tell the two apart. `keepsReleaseEvidence` in * tests/unit/removal-fixture.test.ts pins both halves of this split. */ +// Each Playwright config's results and report folder is in one of these +// (tests/unit/playwright-result-paths.test.ts). const REGENERATED_ARTIFACT_TREES: readonly string[] = Object.freeze([ "artifacts/storybook", + "artifacts/tests/a11y", "artifacts/tests/browser-capabilities", "artifacts/tests/coverage", "artifacts/tests/e2e", + "artifacts/tests/e2e-dev", "artifacts/tests/storybook", "artifacts/tests/visual", ]); diff --git a/tests/helpers/playwright-run-isolation.ts b/tests/helpers/playwright-run-isolation.ts index 40c2024a..56c42ec4 100644 --- a/tests/helpers/playwright-run-isolation.ts +++ b/tests/helpers/playwright-run-isolation.ts @@ -1,25 +1,28 @@ import { createServer, type Server } from "node:net"; import path from "node:path"; +import { pathToFileURL } from "node:url"; import type { PlaywrightTestConfig } from "@playwright/test"; import { describe, expect, it, vi } from "vitest"; /** * 1105/12-04. The run-isolation checks every Playwright config shares, for - * tests/unit/playwright-run-isolation.test.ts (the four configs every project + * tests/unit/playwright-run-isolation.test.ts (the five configs every project * has) and tests/unit/playwright-capabilities-run-isolation.test.ts (the * capabilities config, which goes with the browser file/storage runtime). * * 1106/10-01. Each file imports its configs by name and passes them here, so * no check depends on which config files a checkout happens to have. */ -export type ConfigName = "e2e" | "visual" | "capabilities" | "storybook" | "dev"; +export type ConfigName = "e2e" | "a11y" | "visual" | "capabilities" | "storybook" | "dev"; export type ConfigLoaders = Readonly< Partial Promise<{ default: PlaywrightTestConfig }>>> >; const PORT_VARIABLES: Readonly> = { e2e: "TEST_E2E_PORT", + // The a11y config spreads the e2e one, server included. + a11y: "TEST_E2E_PORT", visual: "TEST_VISUAL_PORT", capabilities: "TEST_CAPABILITIES_PORT", storybook: "TEST_STORYBOOK_PORT", @@ -57,6 +60,28 @@ export type ConfigRuns = Readonly<{ load(name: ConfigName, environment?: Readonly>): Promise; }>; +async function loadInProcess( + loader: () => Promise<{ default: PlaywrightTestConfig }>, + environment: Readonly>, +): Promise { + const saved = RUN_VARIABLES.map((variable) => [variable, process.env[variable]] as const); + for (const variable of RUN_VARIABLES) delete process.env[variable]; + Object.assign(process.env, environment); + vi.resetModules(); + try { + const config = (await loader()).default; + return { + config, + after: Object.fromEntries(RUN_VARIABLES.map((variable) => [variable, process.env[variable]])), + }; + } finally { + for (const [variable, value] of saved) { + if (value === undefined) delete process.env[variable]; + else process.env[variable] = value; + } + } +} + /** Each load evaluates the config again with the environment of one process. */ export function configRuns(loaders: ConfigLoaders): ConfigRuns { async function loadProcess( @@ -65,22 +90,7 @@ export function configRuns(loaders: ConfigLoaders): ConfigRuns { ): Promise { const loader = loaders[name]; if (loader === undefined) throw new TypeError(`no loader for the ${name} config`); - const saved = RUN_VARIABLES.map((variable) => [variable, process.env[variable]] as const); - for (const variable of RUN_VARIABLES) delete process.env[variable]; - Object.assign(process.env, environment); - vi.resetModules(); - try { - const config = (await loader()).default; - return { - config, - after: Object.fromEntries(RUN_VARIABLES.map((variable) => [variable, process.env[variable]])), - }; - } finally { - for (const [variable, value] of saved) { - if (value === undefined) delete process.env[variable]; - else process.env[variable] = value; - } - } + return loadInProcess(loader, environment); } return { loadProcess, @@ -88,6 +98,21 @@ export function configRuns(loaders: ConfigLoaders): ConfigRuns { }; } +/** + * The config a package script names (a path from the checkout root), as a + * process with `environment` and no other run variable sees it. Without a run + * ID its results are where the gates read them. + */ +export async function loadConfigFile( + file: string, + environment: Readonly> = {}, +): Promise { + const url = pathToFileURL(path.resolve(file)).href; + return ( + await loadInProcess(() => import(url) as Promise<{ default: PlaywrightTestConfig }>, environment) + ).config; +} + export function portOf(config: PlaywrightTestConfig): number { return Number(new URL(String(config.use?.baseURL)).port); } @@ -110,7 +135,8 @@ function reporterOption(config: PlaywrightTestConfig, reporter: string, option: return String(entry?.[1][option]); } -function outputs(config: PlaywrightTestConfig) { +/** Absolute paths of the config's results folder, HTML report folder and JUnit file. */ +export function outputs(config: PlaywrightTestConfig) { return { results: path.resolve(String(config.outputDir)), report: path.resolve(reporterOption(config, "html", "outputFolder")), diff --git a/tests/unit/ci-workflow-generation.test.ts b/tests/unit/ci-workflow-generation.test.ts index c26403af..76e1cdd4 100644 --- a/tests/unit/ci-workflow-generation.test.ts +++ b/tests/unit/ci-workflow-generation.test.ts @@ -587,13 +587,11 @@ describe("CI gate contract", () => { }); // FE-6 (decisions.md): every @a11y browser test runs once, in FE-GATE-009. - // Both runs use playwright.config.ts (no --config), so the projects are the same. + // How test:e2e and test:a11y split the browser tests, and that the a11y + // config is the e2e one less its result paths, is in + // tests/unit/playwright-result-paths.test.ts: the sample removal fixture + // deletes this file, and a current document names that one. it("leaves the @a11y browser tests to FE-GATE-009 and every other browser test to FE-GATE-008", async () => { - const scripts = (JSON.parse(await readFile("package.json", "utf8")) as { scripts: Record }).scripts; - const playwrightRuns = (script: string) => - script.split("&&").map((part) => part.trim()).filter((part) => part.startsWith("playwright test")); - expect(playwrightRuns(scripts["test:e2e"]!)).toEqual(["playwright test --grep-invert @a11y"]); - expect(playwrightRuns(scripts["test:a11y"]!)).toEqual(["playwright test --grep @a11y"]); const contract = await loadCiGateContract(process.cwd()); const commandsOf = (gateId: string) => contract.gates.find(({ id }) => id === gateId)!.commandIds; expect(commandsOf("FE-GATE-008")).toContain("test-e2e"); diff --git a/tests/unit/playwright-result-paths.test.ts b/tests/unit/playwright-result-paths.test.ts new file mode 100644 index 00000000..75b73bb9 --- /dev/null +++ b/tests/unit/playwright-result-paths.test.ts @@ -0,0 +1,217 @@ +import { readFile } from "node:fs/promises"; +import path from "node:path"; + +import { afterEach, describe, expect, it } from "vitest"; + +import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts"; +import { reachablePackageScripts } from "../../scripts/lib/package-script-graph.ts"; +import { RELEASE_EVIDENCE_REGENERATED_TREES } from "../../scripts/lib/removal-fixture.ts"; +import { loadConfigFile, outputs, releaseRuns } from "../helpers/playwright-run-isolation.ts"; + +/** + * 1106 review 11. test:a11y (FE-GATE-009) ran with playwright.config.ts as it + * was, so it wrote the e2e results folder, HTML report and results.xml. The + * merge browser job runs FE-GATE-008 and then FE-GATE-009 in one checkout and + * uploads artifacts/: the e2e evidence it uploaded was the a11y run's, and + * FE-GATE-009 kept no JUnit file or report of its own. test:e2e:dev (no gate) + * spread the same paths, so a local run replaced the gate's results too. + * + * The configs are the ones the package scripts name, loaded without a run ID: + * the paths the gates and the CI upload read. + */ +const scripts = (JSON.parse(await readFile("package.json", "utf8")) as { scripts: Record }) + .scripts; + +afterEach(releaseRuns); + +type Writer = Readonly<{ name: string; paths: readonly string[] }>; + +/** The config of each `playwright test` a script runs, following the scripts it calls. */ +function playwrightConfigs(script: string, packageScripts: Readonly> = scripts): string[] { + const configs: string[] = []; + for (const reached of reachablePackageScripts(packageScripts, [script])) { + for (const segment of packageScripts[reached]!.split("&&")) { + const tokens = segment.trim().split(/\s+/u); + const test = tokens.findIndex((token, index) => token === "test" && tokens[index - 1] === "playwright"); + if (test < 0) continue; + const flag = tokens.findIndex((token, index) => index > test && (token === "--config" || token === "-c")); + const joined = tokens.find((token) => token.startsWith("--config=")); + configs.push( + flag >= 0 ? tokens[flag + 1]! : joined !== undefined ? joined.slice("--config=".length) : "playwright.config.ts", + ); + } + } + return configs; +} + +const relative = (absolute: string) => path.relative(process.cwd(), absolute); + +async function resultPaths(config: string): Promise { + const { results, report, junit } = outputs(await loadConfigFile(config)); + return [results, report, junit].map(relative); +} + +/** Playwright empties its results folder at start, so a path inside another's is a clash too. */ +function overlap(left: string, right: string): boolean { + return left === right || left.startsWith(`${right}/`) || right.startsWith(`${left}/`); +} + +function clashes(writers: readonly Writer[]): string[] { + const found: string[] = []; + writers.forEach((left, index) => { + for (const right of writers.slice(index + 1)) { + for (const leftPath of left.paths) { + const rightPath = right.paths.find((candidate) => overlap(leftPath, candidate)); + if (rightPath !== undefined) found.push(`${left.name} writes ${leftPath}, ${right.name} writes ${rightPath}`); + } + } + }); + return found; +} + +/** Every config a package script runs. */ +function namedConfigs(): string[] { + return [...new Set(Object.keys(scripts).flatMap((script) => playwrightConfigs(script)))].sort(); +} + +async function gatedWriters(): Promise { + const contract = await loadCiGateContract(process.cwd()); + const gated = new Set(contract.gates.flatMap(({ commandIds }) => commandIds)); + const writers: Writer[] = []; + for (const command of contract.commands) { + if (!gated.has(command.id)) continue; + for (const [run, config] of playwrightConfigs(command.script).entries()) { + writers.push({ name: `${command.id} run ${run + 1} (${config})`, paths: await resultPaths(config) }); + } + } + return writers; +} + +describe("Playwright result paths", () => { + // The three checks below pass on an empty list, so the helpers that build + // it have to find what they are given. + it("finds every config a script runs, through the scripts it calls, and none in a script that runs none", () => { + const fake = { + gate: "corepack pnpm build && corepack pnpm browser", + browser: + "playwright test --config playwright.a11y.config.ts --grep @a11y && playwright test -c other.config.ts && playwright test --config=third.config.ts && playwright test --grep-invert @a11y", + build: "node scripts/build.ts && playwright show-report", + }; + + expect(playwrightConfigs("gate", fake)).toEqual([ + "playwright.a11y.config.ts", + "other.config.ts", + "third.config.ts", + "playwright.config.ts", + ]); + expect(playwrightConfigs("build", fake)).toEqual([]); + }); + + it("reports a writer pair that writes one path or a path inside the other's, and not a pair that shares a name prefix", () => { + expect( + clashes([ + { name: "inner", paths: ["artifacts/tests/e2e/results/nested"] }, + { name: "e2e", paths: ["artifacts/tests/e2e/results", "artifacts/tests/e2e/results.xml"] }, + { name: "junit", paths: ["artifacts/tests/e2e/results.xml"] }, + { name: "dev", paths: ["artifacts/tests/e2e-dev/results", "artifacts/tests/e2e/results.xml.bak"] }, + { name: "trace", paths: ["artifacts/tests/e2e/results/trace.zip"] }, + ]), + ).toEqual([ + "inner writes artifacts/tests/e2e/results/nested, e2e writes artifacts/tests/e2e/results", + "e2e writes artifacts/tests/e2e/results.xml, junit writes artifacts/tests/e2e/results.xml", + "e2e writes artifacts/tests/e2e/results, trace writes artifacts/tests/e2e/results/trace.zip", + ]); + }); + + it("are each config's own: no two configs the package scripts name write the same results, report or JUnit file", async () => { + const configs = namedConfigs(); + expect(configs).toContain("playwright.config.ts"); + expect(configs.length).toBeGreaterThan(1); + const writers: Writer[] = []; + for (const config of configs) writers.push({ name: config, paths: await resultPaths(config) }); + + expect(clashes(writers)).toEqual([]); + }); + + it("are each gate command's own, so a gate that runs after another in one job keeps the first one's results", async () => { + const writers = await gatedWriters(); + expect(writers.map(({ name }) => name)).toEqual( + expect.arrayContaining([expect.stringMatching(/^test-e2e /u), expect.stringMatching(/^test-a11y /u)]), + ); + + expect(clashes(writers)).toEqual([]); + }); + + it("are the evidence of the gate that runs the command, with that command as the producer", async () => { + const contract = await loadCiGateContract(process.cwd()); + const failures: string[] = []; + let checked = 0; + for (const gate of contract.gates) { + for (const commandId of gate.commandIds) { + const command = contract.commands.find(({ id }) => id === commandId)!; + for (const config of playwrightConfigs(command.script)) { + const { report, junit } = outputs(await loadConfigFile(config)); + for (const file of [relative(junit), relative(path.join(report, "index.html"))]) { + checked += 1; + const artifact = contract.artifacts.find((candidate) => candidate.path === file); + if (artifact === undefined) { + failures.push(`${gate.id} ${commandId} (${config}) writes ${file}, which config/ci/gates.json has no artifact for`); + continue; + } + if (!gate.evidenceArtifactIds.includes(artifact.id)) { + failures.push(`${gate.id} ${commandId} (${config}) writes ${file}, which is not in ${gate.id}'s evidence`); + } + if (artifact.production !== "command-generated" || !artifact.producerCommandIds.includes(commandId)) { + failures.push(`${gate.id} ${commandId} (${config}) writes ${file}, whose producer is not ${commandId}`); + } + } + } + } + } + expect(checked).toBeGreaterThan(2); + + expect(failures).toEqual([]); + }); + + // fe-ci-next-9. The removal fixtures copy artifacts/ less the regenerated + // trees (copyReleaseEvidenceTree). Out of artifacts/tests/e2e/, the a11y and + // dev results and reports went into every fixture, traces included: a local + // verify.sh merge runs FE-GATE-009 before FE-GATE-013 and FE-GATE-020 in one + // checkout. + it("are trees the removal fixture copy leaves behind", async () => { + const failures: string[] = []; + for (const config of namedConfigs()) { + const { results, report } = outputs(await loadConfigFile(config)); + for (const folder of [relative(results), relative(report)]) { + if (!RELEASE_EVIDENCE_REGENERATED_TREES.some((tree) => folder === tree || folder.startsWith(`${tree}/`))) { + failures.push(`${config} writes ${folder}, which the removal fixture copy keeps (scripts/lib/removal-fixture.ts)`); + } + } + } + + expect(failures).toEqual([]); + }); + + // FE-6 (decisions.md): every @a11y browser test runs once, in FE-GATE-009, + // on the projects, build and server FE-GATE-008 runs every other one on. + it("are all the a11y config changes from the e2e config, and test:e2e and test:a11y split the browser tests on @a11y", async () => { + const playwrightRuns = (script: string) => + script.split("&&").map((part) => part.trim()).filter((part) => part.startsWith("playwright test")); + expect(playwrightRuns(scripts["test:e2e"]!)).toEqual(["playwright test --grep-invert @a11y"]); + expect(playwrightRuns(scripts["test:a11y"]!)).toEqual([ + "playwright test --config playwright.a11y.config.ts --grep @a11y", + ]); + // One pinned port, so the two loads start the same server. + const samePort = { TEST_E2E_PORT: "41731" }; + const withoutResultPaths = (config: Awaited>) => { + const rest = { ...config }; + delete rest.outputDir; + delete rest.reporter; + return rest; + }; + const e2eConfig = await loadConfigFile("playwright.config.ts", samePort); + const a11yConfig = await loadConfigFile("playwright.a11y.config.ts", samePort); + expect(e2eConfig.projects?.length).toBeGreaterThan(1); + expect(withoutResultPaths(a11yConfig)).toEqual(withoutResultPaths(e2eConfig)); + }); +}); diff --git a/tests/unit/playwright-run-isolation.test.ts b/tests/unit/playwright-run-isolation.test.ts index ce1f3f85..f6266b22 100644 --- a/tests/unit/playwright-run-isolation.test.ts +++ b/tests/unit/playwright-run-isolation.test.ts @@ -32,11 +32,12 @@ import { * 1106/10-01. The capabilities config is checked in * tests/unit/playwright-capabilities-run-isolation.test.ts: it goes with the * browser file/storage runtime, and test:browser-file-storage-removal deletes - * the config and that file by name. This file has the four configs every - * project has. + * the config and that file by name. This file has the five configs every + * project has; the a11y config spreads the e2e one. */ const runs = configRuns({ e2e: () => import("../../playwright.config.ts"), + a11y: () => import("../../playwright.a11y.config.ts"), visual: () => import("../../playwright.visual.config.ts"), storybook: () => import("../../playwright.storybook.config.ts"), dev: () => import("../../playwright.dev.config.ts"), @@ -46,8 +47,10 @@ afterEach(releaseRuns); describeResultFolders(runs, [ ["e2e", "e2e"], + ["a11y", "a11y"], ["visual", "visual"], ["storybook", "storybook"], + ["dev", "e2e-dev"], ]); describe("the build a run serves", () => { diff --git a/tests/unit/removal-fixture.test.ts b/tests/unit/removal-fixture.test.ts index c3bd9f6e..f191b224 100644 --- a/tests/unit/removal-fixture.test.ts +++ b/tests/unit/removal-fixture.test.ts @@ -254,8 +254,15 @@ describe("release evidence fixture copy", () => { evidence.startsWith("artifacts/") ); expect(evidencePaths.length).toBeGreaterThan(0); + // A tree's name is not a prefix of what it leaves out: artifacts/tests/a11y + // leaves artifacts/tests/a11y.json and artifacts/tests/a11y-data-state/ in. + const siblings = RELEASE_EVIDENCE_REGENERATED_TREES.flatMap((tree) => [ + `${tree}.json`, + `${tree}-data-state/state.json`, + ]); for (const relative of [ ...evidencePaths, + ...siblings, ...RELEASE_EVIDENCE_REGENERATED_TREES.map((tree) => `${tree}/trace.zip`), ]) { await mkdir(path.dirname(path.join(source, relative)), { recursive: true }); @@ -267,7 +274,7 @@ describe("release evidence fixture copy", () => { // Every release artifact has to survive the copy; a fixture missing one // cannot build a candidate at all, and every provider suite then fails // while constructing its own fixture. - for (const evidence of evidencePaths) { + for (const evidence of [...evidencePaths, ...siblings]) { await expect(access(path.join(target, evidence)), evidence).resolves.toBeUndefined(); } // The regenerated trees are why this is a filter and not a plain copy: they diff --git a/tests/unit/ungated-tests.test.ts b/tests/unit/ungated-tests.test.ts index 93ea3024..0080401a 100644 --- a/tests/unit/ungated-tests.test.ts +++ b/tests/unit/ungated-tests.test.ts @@ -4,6 +4,7 @@ import { readFile } from "node:fs/promises"; import { describe, expect, it } from "vitest"; import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts"; +import { reachablePackageScripts } from "../../scripts/lib/package-script-graph.ts"; import { gatedTestPaths, gatedTestTargets, @@ -107,6 +108,34 @@ describe("ungated test files", () => { ]); }); + // fe-ci-next-9. The parser reads `testDir:` in the text of the file + // `--config` names, not in a config that file spreads. test:a11y + // (FE-GATE-009) ran playwright.a11y.config.ts, which spread the e2e config + // without the literal, so it gated no folder; tests/e2e passed only because + // test:e2e gates it too. + it("finds a Playwright testDir for every playwright test run a gate command reaches", async () => { + const contract = await loadCiGateContract(process.cwd()); + const { scripts } = JSON.parse(await readFile("package.json", "utf8")) as { scripts: Record }; + const runs = reachablePackageScripts(scripts, contract.commands.map(({ script }) => script)).flatMap((name) => + scripts[name]! + .split("&&") + .map((segment) => segment.trim()) + .filter((segment) => /(?:^|\s)playwright test(?:\s|$)/u.test(segment)) + .map((segment) => ({ name, segment })), + ); + expect(runs.map(({ name }) => name)).toEqual(expect.arrayContaining(["test:e2e", "test:a11y"])); + + const withoutTestDir = runs + .filter( + ({ segment }) => + !gatedTestTargets({ run: segment }, ["run"], (file) => readFileSync(file, "utf8")).some( + ({ runner }) => runner === "playwright", + ), + ) + .map(({ name, segment }) => `${name}: ${segment}`); + expect(withoutTestDir).toEqual([]); + }); + it("requires a reason for every exclusion", () => { expect(() => parseUngatedTestExclusions({