test(web): run the dashboard test project in development mode
React 19 only ships `act` in its development build. The jsdom suites in `web/` drive components through `act()`, so when vitest inherits an ambient `NODE_ENV=production` — the shell that launched the app, a packaged CI step, an editor terminal — `React.act` resolves to undefined and every `createRoot` test in the project fails with `TypeError: act is not a function`. Pin the test worker to `NODE_ENV=development` via the project's `test.env` so the suite no longer depends on the ambient environment. App runtime and production builds are unaffected; this only applies to the vitest worker. Same class of failure as #77409 (and the same fix shape as #77421), one workspace over: that issue and PR cover `apps/desktop/vitest.config.ts`, while `web/vitest.config.ts` has no equivalent guard. Before (clean main, NODE_ENV=production): Test Files 3 failed | 33 passed (36) Tests 43 failed | 232 passed (275) After: Test Files 36 passed (36) Tests 275 passed (275)
This commit is contained in:
@@ -26,5 +26,16 @@ export default defineConfig({
|
||||
// timeout (main run 34600757569: 5079ms). Same headroom rationale as
|
||||
// apps/desktop/vitest.config.ts; genuinely hung tests still fail.
|
||||
testTimeout: 15_000,
|
||||
// React 19 ships `act` only in its development build, and the jsdom suites
|
||||
// here drive components through `act()`. A shell that already exports
|
||||
// NODE_ENV=production (the one that launched the app, a packaged CI step,
|
||||
// an editor terminal) is inherited by vitest, `React.act` resolves to
|
||||
// undefined, and every `createRoot` test in this project fails with
|
||||
// "act is not a function". Pin the worker to development so the suite is
|
||||
// independent of the ambient environment; app runtime and production
|
||||
// builds are untouched.
|
||||
env: {
|
||||
NODE_ENV: "development",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user