Commit 0bd76ea
fix(ui): pin NODE_ENV=test in vitest config so prod env shells pass (RAN-40) (#81)
React 19 ships separate CJS builds and selects between them via
process.env.NODE_ENV at require-time; the production build omits `act`,
which @testing-library/react needs. Any developer whose shell exports
NODE_ENV=production (CI-adjacent shells, the Paperclip agent harness, etc.)
would see 78/97 tests fail with `TypeError: React.act is not a function`,
even though CI runners (NODE_ENV unset) pass.
Vitest already does `process.env.NODE_ENV ||= 'test'`, but only when unset;
when it's already `production` it's preserved, hence the bug. `--mode test`
also doesn't override an already-set NODE_ENV in vitest 4.
Force NODE_ENV=test at the top of vitest.config.ts before any worker forks
so the test suite is deterministic regardless of caller env.
Verified locally:
- NODE_ENV=production npm --prefix ui run test → 97/97 pass
- NODE_ENV=production npm --prefix ui run test:coverage → coverage generated
- NODE_ENV unset npm --prefix ui run test → 97/97 pass (CI parity)
Co-authored-by: Paperclip <noreply@paperclip.ing>1 parent 742c839 commit 0bd76ea
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
5 | 11 | | |
6 | 12 | | |
7 | 13 | | |
| |||
0 commit comments