Commit 6066a4b
fix(cli): stop tests from leaking jest's own exit code
With coverage finally over the line, the Unit Tests job stayed red — 1250
tests passing, branches 75.54% against a 75% threshold, and jest still
exiting 1 with no failure printed anywhere.
The difference was `--runInBand`, which is how CI runs and how nobody runs
locally. Without workers every suite shares jest's process, so a command
that sets `process.exitCode = 1` to carry its verdict (ADR-0073) leaves it
set for the rest of the run. In worker mode the same test is harmless,
which is exactly why this only ever appeared in CI.
Worth stating plainly: the leak in `scaffold.command.spec.ts` PREDATES this
session's coverage work — it reproduces on HEAD~1. So the Unit Tests job
could not have gone green even at 100% coverage; the coverage gate was
taking the blame for two failures while hiding one of them. The `update`
spec picked up the same leak from the tests added yesterday.
Fixed once, in `setupFilesAfterEnv`, rather than in the two specs that
happen to leak today. A unit test setting the runner's exit code is always
an artifact and never a signal — jest reports real failures on its own —
so restoring it after every test makes the whole class impossible instead
of waiting for the next command to reintroduce it.
Refs GT-562
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 7cffd73 commit 6066a4b
2 files changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments