frontend-quality-gates / merge / static checks (pull_request) Canceled after 0s
frontend-quality-gates / merge / tests (pull_request) Canceled after 0s
frontend-quality-gates / merge / browser tests (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Canceled after 0s
frontend-quality-gates / external-vulnerability-provider (pull_request) Canceled after 0s
frontend-quality-gates / external-provenance-provider (pull_request) Canceled after 0s
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Canceled after 0s
frontend-quality-gates / deploy-promoted-release (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Canceled after 0s
frontend-quality-gates / main / self-tests and removal drills (pull_request) Canceled after 0s
문제: `check:ci:gating`(FE-GATE-029)은 `*.test.*`와 `*.spec.*`를 모두 모은 뒤
게이트 명령이 닿는 경로 접두어만 본다. 그래서 `tests/unit/x.spec.ts`는
「게이트 안」으로 세지만 vitest.config.ts는 `*.test.{ts,tsx}`만 모아 아무
게이트도 그 파일을 돌리지 않는다.
고른 방법: 경로마다 그 경로를 돌리는 runner를 함께 적는다
(`gatedTestTargets`: Vitest 경로와 Playwright `testDir`). Vitest 경로는
`*.test.*`만, Playwright `testDir`는 기본 testMatch처럼 `*.spec.*`와
`*.test.*`를 게이트 안으로 본다. 판정(`ungatedTestFailures`)은 이 목록을
받고, 문자열만 주면 Vitest 경로로 본다. `gatedTestPaths`(경로만)는 다른
호출자를 위해 그대로 둔다.
위험·한계: Playwright 설정이 testMatch를 좁혀도 그 testDir의 두 꼴을 모두
게이트 안으로 본다(예전과 같다).
검증(desktop): 새 시험이 판정 규칙을 빼는 변이에서 실패(RED), 고친 뒤
ungated-tests·ungated-scripts·test-all-paths·removal-drill-test-paths 29개
통과, 실제 `check:ci:gating` PASS, `tests/unit/probe.spec.ts`를 두면 그
파일 이름으로 rc=1, eslint·check:types rc=0. 로그
/tmp/claude-gates/w2fe2-ung3/.
Refs: 0929/12-06
119 lines
4.5 KiB
TypeScript
119 lines
4.5 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { readFile } from "node:fs/promises";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts";
|
|
import {
|
|
gatedTestPaths,
|
|
gatedTestTargets,
|
|
listTestFiles,
|
|
parseUngatedTestExclusions,
|
|
ungatedTestFailures,
|
|
} from "../../scripts/lib/ungated-tests.ts";
|
|
|
|
/**
|
|
* 12-04 / 09-11. A test file only protects anything if a CI gate runs it.
|
|
* Several directories were reachable only from local scripts, and nothing
|
|
* noticed a new one.
|
|
*/
|
|
async function repositoryInputs() {
|
|
const contract = await loadCiGateContract(process.cwd());
|
|
const packageDocument = JSON.parse(await readFile("package.json", "utf8")) as {
|
|
scripts: Record<string, string>;
|
|
};
|
|
return {
|
|
testFiles: await listTestFiles(process.cwd()),
|
|
gatedPaths: gatedTestTargets(
|
|
packageDocument.scripts,
|
|
contract.commands.map(({ script }) => script),
|
|
(file) => readFileSync(file, "utf8"),
|
|
),
|
|
exclusions: parseUngatedTestExclusions(
|
|
JSON.parse(await readFile("config/ci/ungated-tests.json", "utf8")),
|
|
),
|
|
};
|
|
}
|
|
|
|
describe("ungated test files", () => {
|
|
it("runs every test file in a CI gate or names why it does not", async () => {
|
|
expect(ungatedTestFailures(await repositoryInputs())).toEqual([]);
|
|
});
|
|
|
|
it.each([
|
|
"tests/features/feature-module.test.ts",
|
|
"tests/architecture/observability-boundaries.test.ts",
|
|
"tests/release/old-asset-reachability.test.ts",
|
|
"tests/scripts/verify-extreme-scale.test.ts",
|
|
"tests/scale/browser-soak.contract.test.ts",
|
|
"tests/e2e/app-shell.spec.ts",
|
|
// 11-03: the CPU-independent scale PR tier runs in FE-GATE-005.
|
|
"tests/scale/growth-regression.test.ts",
|
|
"tests/scale/traffic/amplification-metrics.test.ts",
|
|
])("gates %s", async (file) => {
|
|
const inputs = await repositoryInputs();
|
|
expect(ungatedTestFailures({ ...inputs, testFiles: [file] })).toEqual([]);
|
|
expect(inputs.exclusions.some(({ path }) => path === file)).toBe(false);
|
|
});
|
|
|
|
it("reads the Vitest paths of a scale tier the gate command runs (11-03)", () => {
|
|
expect(
|
|
gatedTestPaths({ gate: "node scripts/scale/run-scale-profile.ts pr" }, ["gate"], () => ""),
|
|
).toEqual(expect.arrayContaining(["tests/scale/growth-regression.test.ts", "tests/scale/traffic"]));
|
|
expect(
|
|
gatedTestPaths({ gate: "node scripts/scale/run-scale-profile.ts pr" }, ["gate"], () => ""),
|
|
).not.toContain("tests/scale/session");
|
|
});
|
|
|
|
it("rejects a new test directory that no gate runs", async () => {
|
|
const inputs = await repositoryInputs();
|
|
expect(
|
|
ungatedTestFailures({
|
|
...inputs,
|
|
testFiles: [...inputs.testFiles, "tests/new-area/new-area.test.ts"],
|
|
}),
|
|
).toEqual([
|
|
"test file is not run by any CI gate command and is not in config/ci/ungated-tests.json: tests/new-area/new-area.test.ts",
|
|
]);
|
|
});
|
|
|
|
it("rejects an exclusion that a gate already runs", async () => {
|
|
const inputs = await repositoryInputs();
|
|
expect(
|
|
ungatedTestFailures({
|
|
...inputs,
|
|
exclusions: [...inputs.exclusions, { path: "tests/unit/ungated-tests.test.ts", reason: "stale" }],
|
|
}),
|
|
).toEqual([
|
|
"ungated test exclusion is stale; a CI gate runs it: tests/unit/ungated-tests.test.ts",
|
|
]);
|
|
});
|
|
|
|
// 0929/12-06. A `*.spec.ts` under a Vitest path counted as gated, but
|
|
// vitest.config.ts includes only `*.test.{ts,tsx}`: nothing ran it.
|
|
it("gates a Vitest path's test files only, and a Playwright testDir's specs", async () => {
|
|
expect(
|
|
ungatedTestFailures({ testFiles: ["tests/unit/probe.spec.ts"], gatedPaths: ["tests/unit"], exclusions: [] }),
|
|
).toEqual([
|
|
"test file is not run by any CI gate command and is not in config/ci/ungated-tests.json: tests/unit/probe.spec.ts",
|
|
]);
|
|
const inputs = await repositoryInputs();
|
|
expect(inputs.gatedPaths).toContainEqual({ path: "tests/e2e", runner: "playwright" });
|
|
expect(inputs.gatedPaths).toContainEqual({ path: "tests/unit", runner: "vitest" });
|
|
expect(
|
|
ungatedTestFailures({ ...inputs, testFiles: ["tests/unit/probe.spec.ts", "tests/e2e/probe.spec.ts"] }),
|
|
).toEqual([
|
|
"test file is not run by any CI gate command and is not in config/ci/ungated-tests.json: tests/unit/probe.spec.ts",
|
|
]);
|
|
});
|
|
|
|
it("requires a reason for every exclusion", () => {
|
|
expect(() =>
|
|
parseUngatedTestExclusions({
|
|
schemaVersion: 1,
|
|
entries: [{ path: "tests/scale/benchmark.test.ts", reason: " " }],
|
|
}),
|
|
).toThrow(/reason/u);
|
|
});
|
|
});
|