fix(ci): fail on TypeScript errors in tests (#3472)

This commit is contained in:
Gergő Magyar 2026-10-05 05:13:27 +01:00 • committed by GitHub
parent c474a811ba
commit 4758df1c6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 1 deletions

View file

@ -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

View file

@ -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:

View file

@ -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",