Files
DongHyeonka ede99cb9b9 fix(test-run): FE-GATE-009와 test:e2e:dev가 e2e 결과를 덮지 않는다
문제: `test:a11y`(FE-GATE-009)가 `playwright.config.ts`를 그대로 써서
e2e의 결과 폴더·HTML report·`results.xml`에 쓴다. merge browser job은
한 checkout에서 FE-GATE-008 다음 FE-GATE-009를 돌고 `artifacts/`를
올리므로, 올린 e2e 증거는 a11y 실행의 것이다. FE-GATE-009에는 자기
JUnit·report 증거가 없다. 게이트 밖 `test:e2e:dev`도 e2e 설정을 펼쳐
같은 경로에 쓰므로, 로컬 실행이 FE-GATE-008 결과를 지운다
(Playwright는 시작할 때 결과 폴더를 비운다).

고른 방법:
- `playwright.a11y.config.ts`가 e2e 설정을 펼치고 결과 경로만
  `artifacts/tests/a11y/`로 바꾼다. `forbidOnly: true`는 글자로 둔다
  (`check-test-evidence.ts`가 등록 설정마다 그 글자를 찾는다).
  `test:a11y`는 `--config playwright.a11y.config.ts --grep @a11y`.
- `playwright.dev.config.ts`도 결과 경로를 `artifacts/tests/e2e-dev/`로
  둔다.
- `config/ci/gates.json`: a11y `results.xml`·`report/index.html`
  증거(producer `test-a11y`)를 더하고 FE-GATE-009 증거에 넣는다.
- 새 시험 `tests/unit/playwright-result-paths.test.ts`: package script가
  부르는 Playwright 설정을 run ID 없이 불러 결과 경로를 모은다.
  (1) 서로 다른 설정 둘이 같은 경로(또는 한쪽 안의 경로)에 쓰면 실패,
  (2) 게이트 명령 둘이 같은 경로에 쓰면 실패, (3) 게이트 명령이 쓰는
  JUnit·report가 그 게이트의 증거이고 producer가 그 명령이 아니면 실패.
- FE-6 시험의 Playwright 쪽(`test:e2e`·`test:a11y`의 `playwright test`
  두 줄과 「같은 설정이라 project가 같다」)을
  `ci-workflow-generation.test.ts`에서 새 시험으로 옮긴다. 글자로 보던
  것을, 같은 포트로 두 설정을 불러 결과 경로 밖 설정 전체가 같은지 보는
  단언으로 바꾼다. gate 계약 쪽(008·009의 commandIds, merge browser
  job)은 그 자리에 둔다.
- 제거 fixture 사본(FE-GATE-013·020)은 `artifacts/`에서 재생성 트리만
  빼고 복사한다. 결과 경로를 옮기면 a11y·dev 결과와 report(실패하면
  trace까지)가 사본에 들어가므로, `scripts/lib/removal-fixture.ts`의
  목록에 `artifacts/tests/a11y`·`artifacts/tests/e2e-dev`를 더한다.
  새 시험 (4): 각 Playwright 설정의 results·report 폴더가 그 목록 안에
  있다. `a11y.json`·`a11y-data-state/`는 계속 복사되는지 fixture 시험이
  본다.
- `playwright.a11y.config.ts`가 `testDir: "./tests/e2e"`를 글자로 둔다.
  FE-GATE-029는 게이트 명령이 부르는 설정 파일 본문에서 `testDir:`를
  찾으므로, 펼치기만 하면 `test:a11y`가 게이트하는 폴더가 0개다.
  새 시험(`ungated-tests.test.ts`): 게이트 명령이 닿는
  `playwright test`마다 testDir을 찾는다.
- decisions.md FE-6 행은 옮긴 단언의 자리
  `tests/unit/playwright-result-paths.test.ts`를 백틱으로 적는다.
  샘플 제거 드릴(FE-GATE-020)은 사본에서 `ci-workflow-generation.test.ts`를
  지우고, 사본의 `verify:documentation`은 살아 있는 문서의 백틱 경로를
  대조한다. 그 시험 경로를 백틱으로 적은 첫 판은 020에서 실패했다.
  버린 안: 경로를 백틱 없이 적기. `.claude/rules/docs.md`가 「검사를
  피하려고 백틱을 빼지 않는다」고 정한다(1105/14-03). 드릴 쪽(문서
  검사에 예외 경로 넘기기, 그 시험을 지우지 않기)은 b6bfc9b7에서 버린
  안이라 손대지 않는다. 다른 살아 있는 문서에는 드릴이 지우는 네
  파일을 백틱으로 적은 곳이 없다(`git grep`).
- 시험 helper(설정 찾기·경로 겹침)에 거절 입력 시험을 둔다.
- 버린 안: `test:a11y`에 `--output`·`--reporter` 인자를 붙이기. 결과
  경로가 설정과 script 두 곳에 나뉘고, run ID 격리(`testRunPath`)를
  다시 만들어야 한다.
- 막지 않은 것: `test:visual:update`는 `test:visual`과 같은 설정이라 같은
  경로에 쓴다. 같은 시험을 골든 갱신으로 도는 것이라 그 결과가 visual
  결과다. 시험 (1)은 설정 단위라 이것을 막지 않는다.

위험·한계: FE-GATE-009의 증거가 둘 늘어 그 게이트가 JUnit·report 없이
끝나면 실패한다. 하류 프로젝트가 `test:a11y`를 고쳐 `--config` 없이 쓰면
새 시험이 실패한다(CHANGELOG 「먼저 할 일」). 결과 경로를 script 인자로
바꾸는 설정(`--output` 등)은 새 시험이 읽지 않는다. FE-GATE-029
파서는 `--grep-invert @a11y`를 읽지 않아 `@a11y` 시험을 008이 도는
것으로 센다(FE-6부터 있던 것, 이 커밋 밖).

검증(desktop `scripts/verify.sh exec`):
- RED(트리 1e2c4a8f, 고치기 전): 새 시험 3개 모두 실패. dev 설정이 e2e
  경로 셋, test-e2e·test-a11y가 같은 경로 셋, test-a11y의 JUnit·report가
  FE-GATE-009 증거가 아니고 producer가 test-e2e.
- GREEN: 새 시험, playwright-run-isolation, ci-workflow-generation,
  repository-layout, test-evidence-repository-configs 503개 통과.
- 변이: a11y 결과 경로를 e2e로 → 새 시험 3개와 a11y 결과 폴더 시험
  실패. dev 설정의 결과 경로 빼기 → 새 시험 (1)과 dev 결과 폴더 시험
  실패. a11y 설정에 `workers: 1` → FE-6 시험 실패.
- `check:types`·바꾼 파일 eslint·`check:ci` rc=0.
- 리뷰 반영 RED(트리 a36e8676, 시험만 더함): 새 시험 (4)가 a11y·dev의
  results·report 4개로, testDir 시험이 `test:a11y` 한 줄로 실패.
  거절 입력 시험 둘과 fixture 형제 경로 단언은 통과.
- 리뷰 반영 GREEN(트리 155a93de): 위 시험과 removal-fixture,
  ungated-tests, documentation-readiness 7파일 549개 통과,
  `check:types`·바꾼 파일 eslint rc=0.
- FE-GATE-020: 첫 판(트리 ac0ea6d7)의 desktop merge에서 rc=1
  (「decisions.md names paths that do not exist」).
- FE-6 단언 옮김 RED(트리 eed3c87f): a11y 설정에 `retries: 7` 변이 →
  옮긴 단언이 새 시험에서 실패(1 failed, 6 passed). 옛 자리에 그 단언이
  없다(`ci-workflow-generation.test.ts`에서 `loadConfigFile`·
  `withoutResultPaths`·`playwrightRuns` grep 0건).
- GREEN(트리 d2d941c3): 새 시험, ci-workflow-generation, ungated-tests,
  removal-fixture 4파일 485개 통과, `check:types`·바꾼 파일 eslint rc=0.

Refs: 1106 리뷰 11 영역 3.2 (3) 증거 읽기 주의
2026-11-20 22:20:28 +09:00

426 lines
18 KiB
TypeScript

import { spawnSync } from "node:child_process";
import { existsSync } from "node:fs";
import { mkdir, mkdtemp, readdir, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { pathToFileURL } from "node:url";
import { parseAsync } from "@babel/core";
import { afterEach, describe, expect, it } from "vitest";
import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts";
import {
assertNoRuntimeImports,
pruneRemovalFixtureCiContract,
REMOVAL_FIXTURE_COPY_TARGETS,
REMOVAL_FIXTURE_DOCUMENT_TARGETS,
REMOVAL_FIXTURE_DOCUMENT_TESTS,
removalFixtureExcludedTests,
removeRuntimeDependentTests,
renderRemovalJunit,
runtimeImportGraph,
} from "../../scripts/lib/removal-fixture.ts";
import { REPOSITORY_LAYOUT, REPOSITORY_LAYOUT_FILE } from "../../scripts/lib/repository-layout.ts";
import { childProcessTimeout } from "../helpers/child-process-timeout.ts";
const temporaryRoots: string[] = [];
afterEach(async () => {
await Promise.all(
temporaryRoots.splice(0).map((root) => rm(root, { recursive: true, force: true })),
);
});
it("rejects an empty scanned module universe", async () => {
const root = await mkdtemp(path.join(tmpdir(), "removal-fixture-empty-modules-"));
temporaryRoots.push(root);
await expect(runtimeImportGraph(root, ["src/runtime"])).rejects.toThrow(
/scanned module universe is empty/i,
);
});
it("rejects a runtime removal scan that discovers no dependent tests", async () => {
const root = await mkdtemp(path.join(tmpdir(), "removal-fixture-zero-dependent-tests-"));
temporaryRoots.push(root);
await mkdir(path.join(root, "src/runtime"), { recursive: true });
await mkdir(path.join(root, "tests"), { recursive: true });
await writeFile(path.join(root, "src/runtime/index.ts"), "export const runtime = true;\n");
await writeFile(path.join(root, "tests/unrelated.test.ts"), "export const unrelated = true;\n");
await expect(removeRuntimeDependentTests(root, ["src/runtime"])).rejects.toThrow(
/no runtime-dependent tests discovered/i,
);
});
it("allows zero runtime imports after the runtime has been removed", async () => {
const root = await mkdtemp(path.join(tmpdir(), "removal-fixture-post-removal-"));
temporaryRoots.push(root);
await mkdir(path.join(root, "tests"), { recursive: true });
await writeFile(path.join(root, "tests/unrelated.test.ts"), "export const unrelated = true;\n");
await expect(
assertNoRuntimeImports(root, ["src/runtime"], "fixture runtime"),
).resolves.toBeUndefined();
});
async function copyCiContract(prefix: string): Promise<string> {
const root = await mkdtemp(path.join(tmpdir(), prefix));
temporaryRoots.push(root);
await mkdir(path.join(root, "config/ci"), { recursive: true });
for (const file of ["config/ci/gates.json", "package.json"]) {
await writeFile(path.join(root, file), await readFile(file));
}
return root;
}
it("prunes removed command and evidence references and loads the reduced contract", async () => {
const root = await copyCiContract("removal-fixture-contract-");
// A command with evidence of its own, as a removed sample's tests had. Not
// one a removal drill deletes: this test also runs inside those copies
// (test:recipes is gone in the optional-recipe removal copy).
await pruneRemovalFixtureCiContract({
root,
removedScripts: new Set(["test:integration"]),
removedEvidencePathFragments: ["integration.xml"],
});
const contract = await loadCiGateContract(root);
expect(contract.commands.some(({ script }) => script === "test:integration")).toBe(false);
expect(contract.artifacts.some(({ path }) => path.includes("integration.xml"))).toBe(false);
expect(contract.gates.some(({ commandIds }) => commandIds.includes("test-integration"))).toBe(false);
expect(contract.gates.some(({ evidenceArtifactIds }) =>
evidenceArtifactIds.includes("artifact-artifacts-tests-integration-xml")
)).toBe(false);
const packageDocument = JSON.parse(await readFile(path.join(root, "package.json"), "utf8")) as {
scripts: Record<string, string>;
};
expect(packageDocument.scripts["check:ci"]).not.toMatch(/reduced/u);
});
// 1103/16-02. A product feature owns no CI script, so its removal prunes
// nothing, and the contract still loads.
it("loads a removal that prunes no CI script", async () => {
const root = await copyCiContract("removal-fixture-no-scripts-");
await pruneRemovalFixtureCiContract({
root,
removedScripts: new Set(),
removedEvidencePathFragments: [],
});
await expect(loadCiGateContract(root)).resolves.toBeDefined();
});
it("rejects pruning that leaves a reduced gate without commands", async () => {
const root = await copyCiContract("removal-fixture-empty-gate-");
await expect(pruneRemovalFixtureCiContract({
root,
removedScripts: new Set(["test:runtime-schema"]),
removedEvidencePathFragments: ["runtime-schema.xml"],
})).rejects.toThrow(/commandIds|too small|at least 1/i);
});
type BabelOptions = NonNullable<Parameters<typeof parseAsync>[1]>;
type BabelParserPlugin = NonNullable<NonNullable<BabelOptions["parserOpts"]>["plugins"]>[number];
type SyntaxNode = { type: string } & Record<string, unknown>;
/**
* 1106/12-01. The document paths the code of `source` spells out: string and
* template literal parts that are a document target (README.md, CHANGELOG.md,
* docs) or a path under one. Comments are not code.
*/
async function documentsNamedInCode(file: string, source: string): Promise<string[]> {
const plugins: BabelParserPlugin[] = [["typescript", { dts: false }]];
const tree = (await parseAsync(source, {
filename: file,
babelrc: false,
configFile: false,
sourceType: "module",
parserOpts: { plugins },
})) as unknown as SyntaxNode | null;
if (!tree) throw new Error(`cannot parse ${file}`);
const strings: string[] = [];
const visit = (node: SyntaxNode): void => {
const literal = node["value"];
if (node.type === "StringLiteral" && typeof literal === "string") strings.push(literal);
if (node.type === "TemplateElement") {
const cooked = (literal as { cooked?: unknown } | undefined)?.cooked;
if (typeof cooked === "string") strings.push(cooked);
}
for (const [key, value] of Object.entries(node)) {
if (key === "comments" || key.endsWith("Comments")) continue;
for (const child of Array.isArray(value) ? value : [value]) {
if (child && typeof child === "object" && typeof (child as SyntaxNode).type === "string") {
visit(child as SyntaxNode);
}
}
}
};
visit(tree);
return strings.filter((value) =>
REMOVAL_FIXTURE_DOCUMENT_TARGETS.some(
(target) => value === target || value.startsWith(`${target}/`),
),
);
}
// 1103/02-06. Three FE-GATE-020 drills copied the repository without its
// documents and still ran the tests that read them, so each failed its `test`
// check on ENOENT whatever it removed. Only the sample drill excluded them.
describe("document tests in a removal fixture", () => {
it("leaves the document tests out exactly when the documents are not copied", () => {
expect(removalFixtureExcludedTests(REMOVAL_FIXTURE_COPY_TARGETS))
.toEqual(REMOVAL_FIXTURE_DOCUMENT_TESTS);
expect(removalFixtureExcludedTests([
...REMOVAL_FIXTURE_COPY_TARGETS,
...REMOVAL_FIXTURE_DOCUMENT_TARGETS,
])).toEqual([]);
});
// This file also runs inside the capability fixtures, which hold neither
// the documents nor these tests; the two go together.
it("names tests that read the documents, present exactly where the documents are", async () => {
const documentsPresent = REMOVAL_FIXTURE_DOCUMENT_TARGETS.every((target) => existsSync(target));
for (const test of REMOVAL_FIXTURE_DOCUMENT_TESTS) {
expect(existsSync(test), test).toBe(documentsPresent);
if (documentsPresent) {
// 1106/12-01. Named in its code, not in a comment. A comment naming
// the contract document let backend-contract-pin.test.ts on the list,
// and its fourteen checks of config and code left those drills with
// the one that read the document.
expect(await documentsNamedInCode(test, await readFile(test, "utf8")), test).not.toEqual([]);
}
}
});
it("counts a document named in code, not one named in a comment", async () => {
const commentOnly = [
"// Reads docs/architecture/a.md (README.md, CHANGELOG.md).",
"/** docs/manual/b.md */",
'const pin = JSON.parse(readFileSync("config/pin.json", "utf8"));',
"readFileSync(pin.document);",
].join("\n");
expect(await documentsNamedInCode("comment-only.test.ts", commentOnly)).toEqual([]);
const reads = [
'readFileSync("CHANGELOG.md", "utf8");',
"const name: string = 'a';",
"readFileSync(`docs/manual/${name}.md`, 'utf8');",
'z.string().startsWith("docs/");',
'const notADocument = "src/docs/x.ts";',
].join("\n");
expect((await documentsNamedInCode("reads.test.ts", reads)).sort()).toEqual([
"CHANGELOG.md",
"docs/",
"docs/manual/",
]);
});
it("is the only exclusion list: every drill prepares its fixture through it", async () => {
const drills: string[] = [];
for (const name of await readdir("scripts")) {
if (!/^test-.*\.ts$/u.test(name)) continue;
const source = await readFile(path.join("scripts", name), "utf8");
if (!source.includes("./lib/removal-fixture.ts")) continue;
drills.push(name);
expect(source, name).toContain("prepareRemovalFixture(");
for (const test of REMOVAL_FIXTURE_DOCUMENT_TESTS) {
expect(source, name).not.toContain(test);
}
}
expect(drills).toEqual(expect.arrayContaining(["test-sample-removal.ts", "test-feature-scaffold.ts"]));
});
});
describe("release evidence fixture copy", () => {
it("keeps the release evidence and leaves the regenerated trees behind", async () => {
const { copyReleaseEvidenceTree, RELEASE_EVIDENCE_REGENERATED_TREES } =
await import("../../scripts/lib/removal-fixture.ts");
const { RELEASE_CANDIDATE_EVIDENCE_PATHS } = await import(
"../../scripts/lib/release-candidate.ts"
);
const { access, readdir } = await import("node:fs/promises");
// The source is a fake checkout, not process.cwd(): release evidence is
// git-ignored, so a fresh clone has none of it and the copy would be
// checked against nothing.
const source = await mkdtemp(path.join(tmpdir(), "release-evidence-source-"));
const target = await mkdtemp(path.join(tmpdir(), "release-evidence-target-"));
temporaryRoots.push(source, target);
const evidencePaths = RELEASE_CANDIDATE_EVIDENCE_PATHS.filter((evidence) =>
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 });
await writeFile(path.join(source, relative), "{}\n");
}
await copyReleaseEvidenceTree(source, target);
// 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, ...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
// are tens of megabytes of traces and coverage HTML. They still exist,
// because the repository inventory expects the directories.
for (const tree of RELEASE_EVIDENCE_REGENERATED_TREES) {
await expect(readdir(path.join(target, tree)), tree).resolves.toEqual([]);
}
});
});
describe("removal JUnit report (14-08)", () => {
it("counts every failure and gives each check its own cause", () => {
const xml = renderRemovalJunit("sample-feature-removal", [
{ name: "typecheck", passed: false, failure: "corepack pnpm check:types exited 2" },
{ name: "architecture", passed: true },
{ name: "build", passed: false, failure: "corepack pnpm build exited 1" },
{
name: "fixture-id-residue",
passed: false,
failure: "residue: tests/a.test.ts, tests/<b>&c.ts",
},
]);
expect(xml).toContain('tests="4" failures="3"');
expect(xml).toContain(
'<testcase name="typecheck"><failure message="corepack pnpm check:types exited 2" /></testcase>',
);
expect(xml).toContain('<testcase name="architecture"></testcase>');
expect(xml).toContain(
'<failure message="corepack pnpm build exited 1" />',
);
expect(xml).toContain(
'message="residue: tests/a.test.ts, tests/&lt;b&gt;&amp;c.ts"',
);
expect(xml.match(/residue:/gu)).toHaveLength(1);
});
});
// fe-ci-next (3a). prepareRemovalFixture copied every path it was given with
// cp, so a checkout that lacked one ended on cp's ENOENT before the drill
// began. That included `recipes`, which the registry marks optional: a drill
// or a product copy may lack it, and a selection skips it when absent. Each
// run prepares a fixture from a small checkout (the child's working
// directory) that has only package.json and an empty node_modules, into a
// fixture folder that already exists with a marker file in it, as the one
// createRemovalFixtureRoot gives the drills.
describe("fixture copy of the registry's paths", () => {
/**
* Longest desktop run of a test in this block: the last one, in FE-GATE-005's
* test:unit of a merge run at load 4 (2026-11-20); their test:coverage runs
* there were shorter.
*/
const PREPARE_MS = 594;
const MODULE = pathToFileURL(path.resolve("scripts/lib/removal-fixture.ts")).href;
async function prepareFrom(targets: readonly string[], arrange?: (checkout: string) => Promise<void>) {
const checkout = await mkdtemp(path.join(tmpdir(), "removal-fixture-checkout-"));
const parent = await mkdtemp(path.join(tmpdir(), "removal-fixture-root-"));
temporaryRoots.push(checkout, parent);
await writeFile(path.join(checkout, "package.json"), "{}\n");
await mkdir(path.join(checkout, "node_modules"));
await arrange?.(checkout);
const fixture = path.join(parent, "fixture");
await mkdir(fixture);
await writeFile(path.join(fixture, "marker"), "made before the preparation\n");
const result = spawnSync(
process.execPath,
[
"--input-type=module",
"-e",
`const { prepareRemovalFixture } = await import(${JSON.stringify(MODULE)});
await prepareRemovalFixture(process.env.FIXTURE_ROOT, JSON.parse(process.env.FIXTURE_TARGETS));`,
],
{
cwd: checkout,
encoding: "utf8",
env: { ...process.env, FIXTURE_ROOT: fixture, FIXTURE_TARGETS: JSON.stringify(targets) },
},
);
return { result, fixture };
}
const optional = (root: string) => REPOSITORY_LAYOUT.find((entry) => entry.path === root)?.optional;
// A tracked root item the fixture copy selects and a drill or a product may
// lack (recipes when this was written).
const lackable =
REPOSITORY_LAYOUT.find(
(entry) => entry.optional && entry.kind !== "untracked" && entry.sets.includes("fixture-copy"),
)?.path ?? "";
it("skips an optional entry the checkout lacks and prepares the rest", async () => {
expect(lackable).not.toBe("");
const { result, fixture } = await prepareFrom(["package.json", lackable]);
expect(result.status, result.stderr).toBe(0);
expect(existsSync(path.join(fixture, "package.json"))).toBe(true);
expect(existsSync(path.join(fixture, lackable))).toBe(false);
expect(existsSync(path.join(fixture, ".git"))).toBe(true);
}, childProcessTimeout(PREPARE_MS));
it("names every other path the checkout lacks with the registry entry that selects it", async () => {
expect(lackable).not.toBe("");
expect(optional("playwright.capabilities.config.ts")).toBe(false);
expect(optional("docs")).toBe(false);
expect(optional("not-registered.txt")).toBeUndefined();
expect(REPOSITORY_LAYOUT.find((entry) => entry.path === "docs")?.setPaths["fixture-copy"]).toContain(
"docs/accessibility/route-reviews",
);
const { result, fixture } = await prepareFrom([
"package.json",
lackable,
"playwright.capabilities.config.ts",
"docs/accessibility/route-reviews",
"docs/not-selected",
"not-registered.txt",
]);
expect(result.status).not.toBe(0);
expect(result.stderr).not.toMatch(/ENOENT/u);
expect(result.stderr).toContain(
`playwright.capabilities.config.ts: ${REPOSITORY_LAYOUT_FILE} entry playwright.capabilities.config.ts is not optional, but this checkout has no such path; restore it or remove the entry`,
);
expect(result.stderr).toContain(
`docs/accessibility/route-reviews: ${REPOSITORY_LAYOUT_FILE} entry docs selects it in setPaths and is not optional, but this checkout has no such path; restore it or remove it from that entry's setPaths`,
);
const unselected = (target: string) =>
`${target}: the fixture copy names it, but no ${REPOSITORY_LAYOUT_FILE} entry selects it and this checkout has no such path`;
expect(result.stderr).toContain(unselected("docs/not-selected"));
expect(result.stderr).toContain(unselected("not-registered.txt"));
expect(result.stderr).not.toContain(`${lackable}:`);
// It ends before the fixture is touched, not after emptying it or halfway
// through the copy.
expect(existsSync(path.join(fixture, "marker"))).toBe(true);
}, childProcessTimeout(PREPARE_MS));
// Only a missing file is named. Another error (here `docs` is a file, so a
// path under it is not a directory entry) is not one the registry explains,
// so the preparation still ends on it.
it("ends on an error other than a missing file", async () => {
const { result } = await prepareFrom(["package.json", "docs/accessibility/route-reviews"], (checkout) =>
writeFile(path.join(checkout, "docs"), "not a folder\n"),
);
expect(result.status).not.toBe(0);
expect(result.stderr).toMatch(/ENOTDIR/u);
expect(result.stderr).not.toContain("this checkout has no such path");
}, childProcessTimeout(PREPARE_MS));
});