diff --git a/vitest.config.ts b/vitest.config.ts index d5a060c..a6d590e 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -4,7 +4,14 @@ import path from "node:path"; // React only exposes `act` in its development build, so a shell with // NODE_ENV=production would break every component test. Vitest only sets // NODE_ENV when it is unset, so force it. -process.env.NODE_ENV = "test"; +// +// Next's `next/types/global` declares NODE_ENV on ProcessEnv as `readonly`, +// so a plain `process.env.NODE_ENV = "test"` fails the type check that +// `next build` runs over this file (tsconfig includes **/*.ts) and takes +// the whole deployment down. Object.assign has no source-to-target +// assignability constraint, so it compiles while still writing the value +// through process.env's setter at runtime. +Object.assign(process.env, { NODE_ENV: "test" }); export default defineConfig({ resolve: {