fix(scaffold): 기능 생성 드릴이 merge 단계 명령을 gates.json에서 뽑아 돈다
문제 create:feature는 "모든 merge 게이트를 통과하는 가장 작은 기능"을 만든다고 적고, test:feature-scaffold(FE-GATE-020)가 그 주장을 지키는 유일한 드릴이다. 그런데 드릴은 손으로 적은 15개 명령만 돌았고 merge 단계는 명령 참조가 88개다. 그 범위 밖(시각 회귀, a11y, 번들, 계약·스키마·시나리오 테스트 등)에서 생성 기능을 깨는 템플릿 변경이 생겨도 FE-GATE-020은 통과했다(12-01·12-03이 실제로 그렇게 생겼다). 또 제품 기능 제거 드릴 (test:sample-removal -- --feature=<id>)은 어떤 게이트도 돌지 않아, 빈 사유 결함(16-02)이 드러나지 않았다. 고른 방법 - 새 scripts/lib/feature-scaffold-drill.ts가 fixture의 config/ci/gates.json merge 단계를 단계 순서대로, 명령마다 한 번 뽑는다. 음성 fixture 명령은 run-ci-gate.ts처럼 등록된 종료 코드와 진단 ID로 판정한다. - 돌지 않는 명령은 SCAFFOLD_DRILL_EXCLUDED_SCRIPTS에 이유와 함께 둔다: 브라우저 명령 7개(FE-GATE-020 job에 브라우저가 없다. merge_gate matrix browser: false), test:system(bubblewrap·systemd·cgroup 필요, 기능과 무관한 provider 샌드박스 검사), verify:lockfile(연결한 node_modules에 install한다), 제거 드릴 5개(저장소를 다시 복사한다. 이 드릴 자신 포함). merge 단계에 없는 스크립트를 제외 목록에 두면 실패한다. - 생성 기능을 merge 명령 뒤에 test:sample-removal -- --feature=scaffold-feature로 다시 지운다(16-02 둘째 절반). - 생성 명령의 주석·Next 출력과 매뉴얼 두 곳의 주장을 실제 범위로 고쳤다. - 버린 대안: 손 목록에 빠진 명령 더하기. 다음 merge 명령이 다시 빠진다. 복사본 에서 브라우저 게이트까지 전부(리뷰 5.1 (d)). 드릴 job에 브라우저가 없고 수십 분이 든다. 생성 경로만 도는 chromium a11y·시각 1회(5.1 (c)). 12-01·12-03을 고치는 다른 작업이 진행 중이라 지금 넣으면 그 수정 전까지 드릴이 실패한다. 그 둘이 들어오면 제외 목록에서 빼는 것을 다시 본다. 위험·한계 - 드릴 시간이 크게 는다(빌드·release candidate·coverage·제거 드릴 한 번). FE-GATE-020 job(45분)의 임계 경로를 넘으면 리뷰 5.1 재검토 조건대로 줄인다. tests/unit이 한 merge에서 도는 횟수(1101/10-06)도 는다. - 이 커밋 메시지에는 드릴 전체 실행 결과를 적지 않았다(공유 잠금 대기). 검증 - RED: 새 tests/unit/feature-scaffold-drill.test.ts의 "is what test:feature-scaffold runs"가 수정 전 실패. - 수정 뒤 feature-scaffold-drill 5건(merge 명령 전부가 실행 또는 제외, 음성 fixture 기대 유지, merge 단계에 명령을 더하면 드릴이 돈다, 낡은 제외 거부, 드릴이 이 목록을 씀), create-feature, removal-fixture 합계 43건 통과. verify:documentation PASS_SCOPED, check:types 통과, eslint 통과. Refs: docs/reviews/2026-11-03-maturity-review/12-guardrails-ci.md 12-02 Refs: docs/reviews/2026-11-03-maturity-review/16-structure-patterns.md 16-02
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
이 폴더는 이 템플릿으로 만든 프로젝트에 **새 기능 하나를 추가하는 절차**를 적는다.
|
이 폴더는 이 템플릿으로 만든 프로젝트에 **새 기능 하나를 추가하는 절차**를 적는다.
|
||||||
기능 하나는 화면(라우트와 페이지)과 그 화면이 쓰는 API 호출을 함께 뜻한다.
|
기능 하나는 화면(라우트와 페이지)과 그 화면이 쓰는 API 호출을 함께 뜻한다.
|
||||||
|
|
||||||
시작은 `corepack pnpm create:feature <id>`다. 이 명령이 모든 merge 게이트를 통과하는 가장 작은 기능을 만든다.
|
시작은 `corepack pnpm create:feature <id>`다. 이 명령이 모든 merge 게이트를 통과하도록 만든 가장 작은 기능을 만든다(브라우저 게이트는 드릴 밖, `docs/manual/reference/create-feature.md`).
|
||||||
그 뒤 이 매뉴얼의 단계대로 뼈대를 실제 기능으로 바꾼다.
|
그 뒤 이 매뉴얼의 단계대로 뼈대를 실제 기능으로 바꾼다.
|
||||||
|
|
||||||
## 누가 읽는가
|
## 누가 읽는가
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# create:feature 참조
|
# create:feature 참조
|
||||||
|
|
||||||
모든 merge 게이트를 통과하는 가장 작은 기능을 만드는 명령이다. 정본은 `scripts/create-feature.ts`다.
|
모든 merge 게이트를 통과하도록 만든 가장 작은 기능을 만드는 명령이다. 정본은 `scripts/create-feature.ts`다.
|
||||||
|
`test:feature-scaffold`가 생성한 기능으로 `config/ci/gates.json`의 merge 단계 명령을 돌려 확인한다. 브라우저 게이트(FE-GATE-008·009의 브라우저 명령)와 `test:system`은 빼고 돈다. 뺀 명령과 이유는 `scripts/lib/feature-scaffold-drill.ts`에 있다.
|
||||||
템플릿 문자열이 그 파일 안에 있고, 참조 기능을 import하지 않는다. 그래서 참조 기능을 지운 프로젝트에서도 동작한다.
|
템플릿 문자열이 그 파일 안에 있고, 참조 기능을 import하지 않는다. 그래서 참조 기능을 지운 프로젝트에서도 동작한다.
|
||||||
|
|
||||||
## 사용법
|
## 사용법
|
||||||
@@ -98,7 +99,7 @@ create:feature: <id> in <context> (new context), route <ROUTE_ID> at <path>
|
|||||||
|
|
||||||
Next:
|
Next:
|
||||||
1. Before a release, have a person review and sign artifacts/tests/a11y-manual/<ROUTE_ID>.md (FE-GATE-028). ...
|
1. Before a release, have a person review and sign artifacts/tests/a11y-manual/<ROUTE_ID>.md (FE-GATE-028). ...
|
||||||
2. Run the merge gates: corepack pnpm check:types, lint, ...
|
2. Run the merge gates: corepack pnpm ci:gate -- FE-GATE-<NNN> for each gate of the merge stage ...
|
||||||
The feature's own tests: node scripts/run-vitest.ts run tests/features/<id> ...
|
The feature's own tests: node scripts/run-vitest.ts run tests/features/<id> ...
|
||||||
The registry baseline does not change: ...
|
The registry baseline does not change: ...
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -13,8 +13,11 @@ import {
|
|||||||
import { createFileSystemDeclarationSource } from "./generate-product-feature-index.ts";
|
import { createFileSystemDeclarationSource } from "./generate-product-feature-index.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* U7. `pnpm create:feature <id>` writes the smallest feature that passes every
|
* U7. `pnpm create:feature <id>` writes the smallest feature meant to pass
|
||||||
* merge gate: one list route without params, one GET (SAFE, EXTERNAL_BEARER),
|
* every merge gate. test:feature-scaffold runs the merge stage on it except the
|
||||||
|
* commands SCAFFOLD_DRILL_EXCLUDED_SCRIPTS names (browser gates, test:system;
|
||||||
|
* scripts/lib/feature-scaffold-drill.ts). The feature has one list route
|
||||||
|
* without params, one GET (SAFE, EXTERNAL_BEARER),
|
||||||
* one query, one invalidation topic, one CollectionPage with ko-KR and en-US
|
* one query, one invalidation topic, one CollectionPage with ko-KR and en-US
|
||||||
* copy, and a router page test plus an input test. The templates live in this
|
* copy, and a router page test plus an input test. The templates live in this
|
||||||
* file and import nothing from a sample feature, so the command keeps working
|
* file and import nothing from a sample feature, so the command keeps working
|
||||||
@@ -1415,7 +1418,7 @@ function report(plan: FeaturePlan): string {
|
|||||||
"",
|
"",
|
||||||
"Next:",
|
"Next:",
|
||||||
` 1. Before a release, have a person review and sign artifacts/tests/a11y-manual/${plan.routeId}.md (FE-GATE-028). The merge gates check only its format.`,
|
` 1. Before a release, have a person review and sign artifacts/tests/a11y-manual/${plan.routeId}.md (FE-GATE-028). The merge gates check only its format.`,
|
||||||
" 2. Run the merge gates: corepack pnpm check:types, lint, check:architecture, check:registries, check:i18n, check:design-system, check:diagnostics, verify:documentation, test:unit, test:component, test:integration, test:coverage, check:ci, build.",
|
" 2. Run the merge gates: corepack pnpm ci:gate -- FE-GATE-<NNN> for each gate of the merge stage in config/ci/gates.json (README lists the loop). test:feature-scaffold runs them on a generated feature except the browser gates FE-GATE-008/009 and test:system.",
|
||||||
` The feature's own tests: node scripts/run-vitest.ts run tests/features/${plan.id} (test:coverage runs them in CI)`,
|
` The feature's own tests: node scripts/run-vitest.ts run tests/features/${plan.id} (test:coverage runs them in CI)`,
|
||||||
" The registry baseline does not change: new routes, operations, schemas and invalidation topics are additive.",
|
" The registry baseline does not change: new routes, operations, schemas and invalidation topics are additive.",
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
import { spawnSync } from "node:child_process";
|
||||||
|
|
||||||
|
import type { CiGateContract } from "../contracts/ci-gates.ts";
|
||||||
|
import { classifyGateStepResult, type GateStepExpectation } from "./ci-step-result.ts";
|
||||||
|
import { FIXTURE_PNPM_ENVIRONMENT } from "./fixture-node-modules.ts";
|
||||||
|
import type { RemovalCheck } from "./removal-fixture.ts";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1103/12-02. test:feature-scaffold proves that a feature from
|
||||||
|
* `create:feature` passes the merge gates. It ran a hand-kept list of 15
|
||||||
|
* commands while the merge stage has 88, so a template change that broke a
|
||||||
|
* generated feature in any other merge command passed FE-GATE-020.
|
||||||
|
*
|
||||||
|
* The drill now runs the merge stage of the copy's config/ci/gates.json, in
|
||||||
|
* stage order, each command once. A command added to the merge stage runs here
|
||||||
|
* unless this list names it, with the reason it cannot run in the drill.
|
||||||
|
*/
|
||||||
|
const BROWSER =
|
||||||
|
"needs Playwright browsers. FE-GATE-020 runs in a merge job without them " +
|
||||||
|
"(merge_gate matrix browser: false). The generated routes in the browser " +
|
||||||
|
"gates are reviewed as 1103/12-01 and 12-03.";
|
||||||
|
const DRILL =
|
||||||
|
"a removal drill copies the repository again. The drill runs the generated " +
|
||||||
|
"feature's own removal instead (feature-removal).";
|
||||||
|
|
||||||
|
export const SCAFFOLD_DRILL_EXCLUDED_SCRIPTS: Readonly<Record<string, string>> = Object.freeze({
|
||||||
|
"verify:lockfile":
|
||||||
|
"runs pnpm install, which writes into the node_modules the copy links from " +
|
||||||
|
"the repository (scripts/lib/fixture-node-modules.ts).",
|
||||||
|
"test:e2e": BROWSER,
|
||||||
|
"test:browser-capabilities": BROWSER,
|
||||||
|
"verify:browser-capability-evidence": `reads the test:browser-capabilities results; ${BROWSER}`,
|
||||||
|
"test:storybook": BROWSER,
|
||||||
|
"test:visual": BROWSER,
|
||||||
|
"check:test-evidence:browser": `reads the browser gates' results; ${BROWSER}`,
|
||||||
|
"test:a11y": BROWSER,
|
||||||
|
"test:system":
|
||||||
|
"needs the CI runner's bubblewrap, systemd and cgroup v2 " +
|
||||||
|
"(scripts/check-system-test-prerequisites.ts). It tests the provider " +
|
||||||
|
"sandbox, which a feature does not reach.",
|
||||||
|
"test:sample-removal": DRILL,
|
||||||
|
"test:feature-scaffold": "is this drill.",
|
||||||
|
"test:optional-recipe-removal": DRILL,
|
||||||
|
"test:browser-file-storage-removal": DRILL,
|
||||||
|
"test:realtime-removal": DRILL,
|
||||||
|
});
|
||||||
|
|
||||||
|
export type ScaffoldDrillCommand = Readonly<{
|
||||||
|
/** `<gate>:<command id>`, the check's name in the drill report. */
|
||||||
|
name: string;
|
||||||
|
script: string;
|
||||||
|
args: readonly string[];
|
||||||
|
expectation: GateStepExpectation;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
type ContractShape = Pick<CiGateContract, "commands" | "gates" | "stages">;
|
||||||
|
|
||||||
|
export function scaffoldDrillCommands(
|
||||||
|
contract: ContractShape,
|
||||||
|
excluded: Readonly<Record<string, string>> = SCAFFOLD_DRILL_EXCLUDED_SCRIPTS,
|
||||||
|
): readonly ScaffoldDrillCommand[] {
|
||||||
|
const merge = contract.stages.find(({ id }) => id === "merge");
|
||||||
|
if (!merge) throw new TypeError("the CI contract has no merge stage");
|
||||||
|
const commands = new Map(contract.commands.map((command) => [command.id, command]));
|
||||||
|
const mergeScripts = new Set<string>();
|
||||||
|
const seen = new Set<string>();
|
||||||
|
const selected: ScaffoldDrillCommand[] = [];
|
||||||
|
for (const gateId of merge.gateIds) {
|
||||||
|
const gate = contract.gates.find(({ id }) => id === gateId);
|
||||||
|
if (!gate) throw new TypeError(`the merge stage names an undefined gate: ${gateId}`);
|
||||||
|
for (const commandId of gate.commandIds) {
|
||||||
|
const command = commands.get(commandId);
|
||||||
|
if (!command) throw new TypeError(`${gateId} names an undefined command: ${commandId}`);
|
||||||
|
mergeScripts.add(command.script);
|
||||||
|
if (seen.has(commandId) || Object.hasOwn(excluded, command.script)) continue;
|
||||||
|
seen.add(commandId);
|
||||||
|
selected.push(Object.freeze({
|
||||||
|
name: `${gateId}:${commandId}`,
|
||||||
|
script: command.script,
|
||||||
|
args: Object.freeze([...(command.args ?? [])]),
|
||||||
|
expectation: command.expect === "pass"
|
||||||
|
? Object.freeze({ kind: "pass" as const })
|
||||||
|
: Object.freeze({
|
||||||
|
kind: "fail" as const,
|
||||||
|
expectedExitCode: command.expectedExitCode ?? 1,
|
||||||
|
expectedDiagnosticId: command.expectedDiagnosticId ?? "",
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// An exclusion the merge stage no longer runs would hide nothing today and
|
||||||
|
// silently drop the command if it came back under the same name.
|
||||||
|
const stale = Object.keys(excluded).filter((script) => !mergeScripts.has(script));
|
||||||
|
if (stale.length > 0) {
|
||||||
|
throw new TypeError(
|
||||||
|
`the scaffold drill excludes scripts the merge stage does not run: ${stale.join(", ")}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Object.freeze(selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs one merge command in the fixture. A negative fixture command passes
|
||||||
|
* only with its registered exit code and diagnostic, as in run-ci-gate.ts.
|
||||||
|
*/
|
||||||
|
export function runScaffoldDrillCommand(
|
||||||
|
command: ScaffoldDrillCommand,
|
||||||
|
root: string,
|
||||||
|
pnpmCli: string,
|
||||||
|
): RemovalCheck {
|
||||||
|
const capture = command.expectation.kind === "fail";
|
||||||
|
const result = spawnSync(process.execPath, [pnpmCli, command.script, ...command.args], {
|
||||||
|
cwd: root,
|
||||||
|
encoding: "utf8",
|
||||||
|
stdio: capture ? "pipe" : "inherit",
|
||||||
|
maxBuffer: 64 * 1024 * 1024,
|
||||||
|
env: { ...process.env, ...FIXTURE_PNPM_ENVIRONMENT },
|
||||||
|
});
|
||||||
|
if (capture) {
|
||||||
|
process.stdout.write(result.stdout ?? "");
|
||||||
|
process.stderr.write(result.stderr ?? "");
|
||||||
|
}
|
||||||
|
const classification = classifyGateStepResult(command.expectation, {
|
||||||
|
status: result.status,
|
||||||
|
signal: result.signal,
|
||||||
|
stdout: result.stdout ?? "",
|
||||||
|
stderr: result.stderr ?? "",
|
||||||
|
...(result.error ? { error: { code: (result.error as NodeJS.ErrnoException).code } } : {}),
|
||||||
|
});
|
||||||
|
if (classification.expectationMet) return { name: command.name, passed: true };
|
||||||
|
const invocation = `corepack pnpm ${[command.script, ...command.args].join(" ")}`;
|
||||||
|
return {
|
||||||
|
name: command.name,
|
||||||
|
passed: false,
|
||||||
|
failure: command.expectation.kind === "fail"
|
||||||
|
? `${invocation}: ${classification.kind}, expected exit ${command.expectation.expectedExitCode} with ${JSON.stringify(command.expectation.expectedDiagnosticId)}, got exit ${result.status ?? result.signal}`
|
||||||
|
: `${invocation} exited ${result.status ?? result.signal ?? "on a spawn error"}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
import { mkdir, rm, writeFile } from "node:fs/promises";
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
||||||
|
|
||||||
|
import { loadCiGateContract } from "./contracts/ci-gates.ts";
|
||||||
|
import {
|
||||||
|
runScaffoldDrillCommand,
|
||||||
|
scaffoldDrillCommands,
|
||||||
|
} from "./lib/feature-scaffold-drill.ts";
|
||||||
import {
|
import {
|
||||||
createRemovalFixtureRoot,
|
createRemovalFixtureRoot,
|
||||||
prepareRemovalFixture,
|
prepareRemovalFixture,
|
||||||
@@ -15,7 +20,16 @@ import {
|
|||||||
/**
|
/**
|
||||||
* U7. A feature from `create:feature` passes the merge gates without an edit
|
* U7. A feature from `create:feature` passes the merge gates without an edit
|
||||||
* and breaks no other test. A copy of the repository, sample feature
|
* and breaks no other test. A copy of the repository, sample feature
|
||||||
* included, gets one generated feature and then runs the gates.
|
* included, gets one generated feature and then runs the merge stage of its
|
||||||
|
* config/ci/gates.json: every command except those
|
||||||
|
* SCAFFOLD_DRILL_EXCLUDED_SCRIPTS names with a reason (the browser gates,
|
||||||
|
* test:system, the install check and the removal drills). 1103/12-02: this
|
||||||
|
* used to be a hand-kept list of 15 commands.
|
||||||
|
*
|
||||||
|
* 1103/16-02. The generated feature is then removed again with
|
||||||
|
* `test:sample-removal -- --feature=<id>`, the path the manual tells every
|
||||||
|
* product feature to take and that no gate ran.
|
||||||
|
*
|
||||||
* test:sample-removal repeats the generation after deleting the sample
|
* test:sample-removal repeats the generation after deleting the sample
|
||||||
* (decision 4), which proves the command needs nothing from it.
|
* (decision 4), which proves the command needs nothing from it.
|
||||||
*/
|
*/
|
||||||
@@ -41,23 +55,10 @@ try {
|
|||||||
// Commits the copy with the feature, as a project would: git-based
|
// Commits the copy with the feature, as a project would: git-based
|
||||||
// checks (git grep, git ls-files) then see the feature's files.
|
// checks (git grep, git ls-files) then see the feature's files.
|
||||||
sealRemovalFixtureRepository(fixtureRoot);
|
sealRemovalFixtureRepository(fixtureRoot);
|
||||||
checks.push(
|
for (const command of scaffoldDrillCommands(await loadCiGateContract(fixtureRoot))) {
|
||||||
check("typecheck", "check:types"),
|
checks.push(runScaffoldDrillCommand(command, fixtureRoot, pnpmCli));
|
||||||
check("lint", "lint"),
|
}
|
||||||
check("architecture", "check:architecture"),
|
checks.push(check("feature-removal", "test:sample-removal", ["--", `--feature=${FEATURE_ID}`]));
|
||||||
check("registries", "check:registries"),
|
|
||||||
check("i18n", "check:i18n"),
|
|
||||||
check("design-system", "check:design-system"),
|
|
||||||
check("diagnostics", "check:diagnostics"),
|
|
||||||
check("documentation", "verify:documentation"),
|
|
||||||
check("unit", "test:unit"),
|
|
||||||
check("component", "test:component"),
|
|
||||||
check("integration", "test:integration"),
|
|
||||||
check("features", "exec", ["node", "scripts/run-vitest.ts", "run", "tests/features"]),
|
|
||||||
check("coverage", "test:coverage"),
|
|
||||||
check("ci-contract", "check:ci"),
|
|
||||||
check("build", "build"),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
const failed = checks.filter((entry) => !entry.passed);
|
const failed = checks.filter((entry) => !entry.passed);
|
||||||
await mkdir("artifacts/tests", { recursive: true });
|
await mkdir("artifacts/tests", { recursive: true });
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import { readFile } from "node:fs/promises";
|
||||||
|
|
||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts";
|
||||||
|
import {
|
||||||
|
SCAFFOLD_DRILL_EXCLUDED_SCRIPTS,
|
||||||
|
scaffoldDrillCommands,
|
||||||
|
} from "../../scripts/lib/feature-scaffold-drill.ts";
|
||||||
|
|
||||||
|
// 1103/12-02. The scaffold drill claimed "every merge gate" and ran 15
|
||||||
|
// hand-picked commands of the 88 in the merge stage.
|
||||||
|
describe("feature scaffold drill commands", () => {
|
||||||
|
it("are the merge stage minus the named exclusions, each command once", async () => {
|
||||||
|
const contract = await loadCiGateContract(process.cwd());
|
||||||
|
const merge = contract.stages.find(({ id }) => id === "merge")!;
|
||||||
|
const mergeCommandIds = new Set(
|
||||||
|
merge.gateIds.flatMap((gateId) => contract.gates.find(({ id }) => id === gateId)!.commandIds),
|
||||||
|
);
|
||||||
|
const commands = scaffoldDrillCommands(contract);
|
||||||
|
const runCommandIds = commands.map(({ name }) => name.split(":").slice(1).join(":"));
|
||||||
|
expect(new Set(runCommandIds).size).toBe(runCommandIds.length);
|
||||||
|
for (const commandId of mergeCommandIds) {
|
||||||
|
const command = contract.commands.find(({ id }) => id === commandId)!;
|
||||||
|
expect(
|
||||||
|
runCommandIds.includes(commandId) || Object.hasOwn(SCAFFOLD_DRILL_EXCLUDED_SCRIPTS, command.script),
|
||||||
|
commandId,
|
||||||
|
).toBe(true);
|
||||||
|
}
|
||||||
|
expect(commands.map(({ script }) => script)).toEqual(expect.arrayContaining([
|
||||||
|
"check:types", "lint", "test:unit", "test:coverage", "build", "check:bundle",
|
||||||
|
"test:contract", "test:runtime-schema", "check:request-fanout", "build:release-candidate",
|
||||||
|
]));
|
||||||
|
for (const reason of Object.values(SCAFFOLD_DRILL_EXCLUDED_SCRIPTS)) {
|
||||||
|
expect(reason.length).toBeGreaterThan(10);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("keeps a negative fixture's registered exit and diagnostic", async () => {
|
||||||
|
const contract = await loadCiGateContract(process.cwd());
|
||||||
|
expect(scaffoldDrillCommands(contract).find(({ script }) => script === "check:types:fixture"))
|
||||||
|
.toMatchObject({ expectation: { kind: "fail", expectedExitCode: 1, expectedDiagnosticId: "error TS2322:" } });
|
||||||
|
});
|
||||||
|
|
||||||
|
it("runs a command added to the merge stage without an edit to the drill", async () => {
|
||||||
|
const contract = structuredClone(await loadCiGateContract(process.cwd()));
|
||||||
|
contract.commands.push({ id: "check-probe", script: "check:probe", expect: "pass" } as never);
|
||||||
|
contract.gates.find(({ id }) => id === "FE-GATE-010")!.commandIds.push("check-probe");
|
||||||
|
expect(scaffoldDrillCommands(contract).map(({ name }) => name)).toContain("FE-GATE-010:check-probe");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("refuses an exclusion for a script the merge stage does not run", async () => {
|
||||||
|
const contract = await loadCiGateContract(process.cwd());
|
||||||
|
expect(() => scaffoldDrillCommands(contract, {
|
||||||
|
...SCAFFOLD_DRILL_EXCLUDED_SCRIPTS,
|
||||||
|
"check:gone": "no longer in the merge stage",
|
||||||
|
})).toThrow(/does not run: check:gone/u);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("is what test:feature-scaffold runs", async () => {
|
||||||
|
const drill = await readFile("scripts/test-feature-scaffold.ts", "utf8");
|
||||||
|
expect(drill).toContain("scaffoldDrillCommands(");
|
||||||
|
expect(drill).toContain("loadCiGateContract(fixtureRoot)");
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user