diff --git a/.github/workflows/ci-quality.yml b/.github/workflows/ci-quality.yml index 1b7185d1b..dffb6550b 100644 --- a/.github/workflows/ci-quality.yml +++ b/.github/workflows/ci-quality.yml @@ -53,6 +53,9 @@ jobs: lifecycle-scripts: 'false' - run: npx tsc --noEmit working-directory: gitnexus + - name: Typecheck tests + run: npm run typecheck:tests + working-directory: gitnexus typecheck-web: runs-on: ubuntu-latest diff --git a/TESTING.md b/TESTING.md index 9febb8283..4be0f73c5 100644 --- a/TESTING.md +++ b/TESTING.md @@ -19,6 +19,7 @@ From `gitnexus/`: | Command | What it runs | When to use | | ----------------------------- | -------------------------------------------------- | ------------------------------------- | | `npm test` | Full suite (all 3 vitest projects) | Before opening a PR | +| `npm run typecheck:tests` | TypeScript checks for source, tests, and helpers | Before opening a PR | | `npm run test:unit` | Unit tests only (`test/unit/`) | Tight development loop | | `npm run test:integration` | Integration tests (`test/integration/`) | After changing pipelines, DB, workers | | `npm run test:coverage` | Full suite + v8 coverage with thresholds | Checking coverage impact | @@ -26,6 +27,11 @@ From `gitnexus/`: | `npm run test:cross-platform` | Platform-sensitive subset only | Debugging a Windows/macOS issue | | `npm run test:watch` | Vitest in watch mode | Active development | +Vitest transpiles TypeScript without checking types. Run `npm run typecheck:tests` +in `gitnexus/` to check test code and helpers against the production types. This +uses `tsc --noEmit -p tsconfig.test.json`; parser input files under `test/fixtures/` +are excluded because they are sample source code, not part of the test program. + ### `gitnexus-web/` commands From `gitnexus-web/`: @@ -41,7 +47,7 @@ From `gitnexus-web/`: ```bash # gitnexus-shared/dist must exist first. `npm install` / `npm run build` in # gitnexus/ compiles it via parent `lib/tsc.js` (do not npm ci gitnexus-shared). -cd gitnexus && npx tsc --noEmit && npm test +cd gitnexus && npx tsc --noEmit && npm run typecheck:tests && npm test cd ../gitnexus-web && npx tsc -b --noEmit && npm test ``` @@ -121,6 +127,9 @@ GitHub Actions (`.github/workflows/ci.yml`) orchestrate: The `CI Gate` job in `ci.yml` is the single required check for branch protection. It requires quality, tests, e2e, and scope-parity to all pass. +The `typecheck` job runs both the production compiler check and +`npm run typecheck:tests`. A type error in either check fails the job and the CI gate. + ## Regression testing Re-run the full relevant suite when: diff --git a/gitnexus/package.json b/gitnexus/package.json index 1db831d0d..99422e958 100644 --- a/gitnexus/package.json +++ b/gitnexus/package.json @@ -52,6 +52,7 @@ "serve": "tsx src/cli/index.ts serve", "dev": "tsx watch src/cli/index.ts", "test": "vitest run", + "typecheck:tests": "tsc --noEmit -p tsconfig.test.json", "test:unit": "vitest run test/unit", "pretest:integration": "node scripts/build.js", "test:integration": "vitest run test/integration",