문제
workflow는 모든 job에 CI=true와 CI 빌드 식별값을 준다. 메인 세션이 깨끗한
clone에서 그 env 그대로(CI=true 포함) merge 단계 14개를 돌리자 FE-GATE-005·
008·020이 실패했다.
- vitest 안의 fixture 빌드(tests/e2e/support/fixture-builds.ts →
build-frontend.ts)가 CI=true를 물려받아 release 빌드처럼 검사된다.
af312de가 vitest에서 VITE_COMMIT_SHA를 지워 "missing required CI build
environment: VITE_COMMIT_SHA"로 멈춘다(service-worker-build-output 7건이
돌지 않음, 제거 드릴 안에서도 같다).
- 시각 골든 build(9bddfa5)가 VITE_COMMIT_SHA="local"을 받는데 CI=true가
40·64자리 hex를 요구해 webServer가 뜨지 않는다.
내 X4가 CI=true 없이 돌아 놓쳤다. 1103/11-07과 같은 원인이다.
고른 방법
- scripts/lib/build-environment.ts에 둘을 둔다.
- localBuildEnvironment(env): spawn하는 로컬 빌드용. CI와 CI 빌드 식별값을
뺀 사본. fixture-builds.ts, service-worker-builds.ts가 쓴다.
- LOCAL_BUILD_IDENTITY: Playwright web server용. Playwright가 env를
process.env 위에 합치므로 CI를 지우지 않고 ""로 덮는다(검사는
CI === "true"일 때만). visual·capabilities·dev 설정이 쓴다.
- assertCiBuildEnvironment의 CI=true 검사는 그대로다. job 자신의 release
빌드(build:release-candidate 등)는 계속 검사된다.
- 버린 대안: 로컬 빌드에 유효한 가짜 커밋 id(0×40)를 주기. CI=true 검사의
다른 칸(CI_RUNNER_IMAGE, SOURCE_DATE_EPOCH)도 함께 맞춰야 하고, 로컬
빌드가 release 빌드인 척한다.
위험·한계
- 로컬 빌드 안에서 CI를 읽어 동작을 바꾸는 코드가 있으면 그 빌드는 이제
CI가 아닌 쪽으로 돈다(지금은 build-environment 검사뿐이다).
검증
- tests/unit/local-build-environment.test.ts 3건: 구현 전 2건 실패(RED),
CI job 자체 검사는 유지.
- CI=true·VITE_COMMIT_SHA·VITE_BUILD_ID=gitea-41-1·RELEASE_ID·
CI_RUNNER_IMAGE·SOURCE_DATE_EPOCH로: service-worker-build-output 7건,
test:visual 6/6, test:unit 2,883, test:component 270, test:integration 189
통과. 수정 전 service-worker-build-output은 7건 미실행.
- check:types, lint 통과.
Refs: docs/reviews/2026-11-03-maturity-review/README.md 13절 11-08
68 lines
2.3 KiB
TypeScript
68 lines
2.3 KiB
TypeScript
import { fileURLToPath } from "node:url";
|
|
|
|
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
import { LOCAL_BUILD_IDENTITY } from "./scripts/lib/build-environment.ts";
|
|
|
|
export default defineConfig({
|
|
testDir: "./tests/visual",
|
|
forbidOnly: true,
|
|
snapshotDir: "./tests/visual/__snapshots__",
|
|
outputDir: "./artifacts/tests/visual/results",
|
|
reporter: [
|
|
["list"],
|
|
[
|
|
"html",
|
|
{ outputFolder: "./artifacts/tests/visual/report", open: "never" },
|
|
],
|
|
["junit", { outputFile: "./artifacts/tests/visual/results.xml" }],
|
|
],
|
|
expect: {
|
|
toHaveScreenshot: {
|
|
animations: "disabled",
|
|
caret: "hide",
|
|
// 11-03. An absolute count, not a share of the image: 0.2% allowed
|
|
// 2,592 px on the wide shell and let the 1,146 px UI-04 regression
|
|
// pass. With fonts and raster settings pinned (11-02), a clean build
|
|
// differs by 0 px, so this only covers stray anti-aliasing.
|
|
maxDiffPixels: 50,
|
|
scale: "css",
|
|
},
|
|
},
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
baseURL: "http://127.0.0.1:4174",
|
|
colorScheme: "light",
|
|
locale: "en-US",
|
|
trace: "retain-on-failure",
|
|
launchOptions: {
|
|
// 11-02. Chromium sees only the fonts the goldens were captured with,
|
|
// whatever the host or an outer FONTCONFIG_FILE says. The
|
|
// `visual-fonts` project checks them before any screenshot.
|
|
env: {
|
|
...process.env,
|
|
FONTCONFIG_FILE: fileURLToPath(
|
|
new URL("./tests/visual/fonts.conf", import.meta.url),
|
|
),
|
|
},
|
|
},
|
|
},
|
|
webServer: {
|
|
// The home page and the platform overview print the build and release
|
|
// identity. CI sets VITE_BUILD_ID, VITE_COMMIT_SHA and RELEASE_ID for the
|
|
// whole workflow, so its build drew other text than the goldens and every
|
|
// CI run failed here. The goldens are the template's shape, captured with
|
|
// the local identity.
|
|
// 1103/11-08: CI too, or the build is checked as a release build.
|
|
env: { ...LOCAL_BUILD_IDENTITY },
|
|
command:
|
|
"corepack pnpm build && corepack pnpm preview --host 127.0.0.1 --port 4174",
|
|
url: "http://127.0.0.1:4174",
|
|
reuseExistingServer: false,
|
|
},
|
|
projects: [
|
|
{ name: "visual-fonts", testMatch: /fonts\.setup\.ts$/ },
|
|
{ name: "chromium-visual", dependencies: ["visual-fonts"] },
|
|
],
|
|
});
|