diff --git a/docs/testing/taxonomy.md b/docs/testing/taxonomy.md index f3a199e9..585f876f 100644 --- a/docs/testing/taxonomy.md +++ b/docs/testing/taxonomy.md @@ -18,9 +18,13 @@ Each gate is blocking in its declared scope. Failures are not downgraded with `test:all` is the normal product-development loop. It runs, in order, `test:runtime-schema`, `test:unit`, `test:contract`, `test:component`, -`test:integration`, test:reference-feature (removed with the reference sample), `test:platform` (`tests/platform` +`test:integration`, the rest of what `test:coverage` runs (`tests/features`, +the reference sample's tests among them, `tests/scripts` and +`tests/scale/browser-soak.contract.test.ts`), `test:platform` (`tests/platform` and `tests/architecture`), `check:release-coherence` and `test:recipes` -(`package.json` `test:all`). It does not include `test:system`. CI-runner and +(`package.json` `test:all`). So every Vitest path the merge gate's coverage +run covers also runs here (`tests/unit/test-all-paths.test.ts`, 0929/10-05). +It does not include `test:system`. CI-runner and supply-chain assurance has different host prerequisites and is invoked explicitly in the assurance path. diff --git a/package.json b/package.json index 27a2fa64..4d3c87c7 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "check:v8-coverage-counter-semantics": "node scripts/check-v8-coverage-counter-semantics.ts", "test:coverage": "corepack pnpm check:v8-coverage-counter-semantics && node scripts/run-vitest.ts run tests/runtime-schema tests/unit tests/contract tests/component tests/integration tests/features tests/platform tests/architecture tests/release tests/scripts tests/scale/browser-soak.contract.test.ts --coverage --maxWorkers=4 --reporter=default --reporter=junit --outputFile.junit=artifacts/tests/coverage.xml && node scripts/check-risk-coverage.ts", "check:coverage:fixture": "node scripts/check-risk-coverage.ts --summary tests/fixtures/coverage/below-threshold.json --artifact artifacts/quality/risk-coverage-fixture.json", - "test:all": "corepack pnpm test:runtime-schema && corepack pnpm test:unit && corepack pnpm test:contract && corepack pnpm test:component && corepack pnpm test:integration && corepack pnpm test:reference-feature && corepack pnpm test:platform && corepack pnpm check:release-coherence && corepack pnpm test:recipes", + "test:all": "corepack pnpm test:runtime-schema && corepack pnpm test:unit && corepack pnpm test:contract && corepack pnpm test:component && corepack pnpm test:integration && node scripts/run-vitest.ts run tests/features tests/scripts tests/scale/browser-soak.contract.test.ts --reporter=default && corepack pnpm test:platform && corepack pnpm check:release-coherence && corepack pnpm test:recipes", "verify:lockfile": "corepack pnpm install --frozen-lockfile --ignore-scripts", "check:frozen-lockfile:fixture": "node scripts/check-frozen-lockfile-fixture.ts", "generate:artifact-schemas": "node scripts/generate-product-feature-index.ts && node scripts/generate-artifact-schemas.ts", diff --git a/tests/unit/test-all-paths.test.ts b/tests/unit/test-all-paths.test.ts new file mode 100644 index 00000000..784d4c89 --- /dev/null +++ b/tests/unit/test-all-paths.test.ts @@ -0,0 +1,32 @@ +import { readFileSync } from "node:fs"; + +import { describe, expect, it } from "vitest"; + +import { gatedTestPaths } from "../../scripts/lib/ungated-tests.ts"; + +/** + * 0929/10-05. `test:all` is the local development loop + * (docs/testing/taxonomy.md). When it skips a Vitest path the merge gate's + * coverage run covers, a change passes locally and fails in CI. + */ +const scripts = ( + JSON.parse(readFileSync("package.json", "utf8")) as { + scripts: Record; + } +).scripts; +const readConfig = (file: string) => readFileSync(file, "utf8"); + +describe("test:all", () => { + it("runs every Vitest path test:coverage runs", () => { + const local = gatedTestPaths(scripts, ["test:all"], readConfig); + const coverage = gatedTestPaths(scripts, ["test:coverage"], readConfig); + + expect(coverage.length).toBeGreaterThan(0); + expect( + coverage.filter( + (target) => + !local.some((path) => target === path || target.startsWith(`${path}/`)), + ), + ).toEqual([]); + }); +});