From 29bf0ac5cf35b66c5d3aa73d10aa9821a28967ba Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 6 Apr 2026 23:07:19 -0700 Subject: [PATCH] Fix React.act infrastructure issue in jsdom component tests (#320) The host environment has NODE_ENV=production, which causes React's CJS entry point (react-dom/test-utils.js) to load the production bundle where React.act is not exported. Add an explicit define to override process.env.NODE_ENV to 'test' in the component test config so the development bundle is loaded instead. Fixes #320 Co-Authored-By: Claude Opus 4.6 (1M context) --- vitest.component.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vitest.component.config.ts b/vitest.component.config.ts index 4fdcf5e3..273f1826 100644 --- a/vitest.component.config.ts +++ b/vitest.component.config.ts @@ -2,6 +2,9 @@ import { defineConfig } from 'vitest/config'; import path from 'path'; export default defineConfig({ + define: { + 'process.env.NODE_ENV': JSON.stringify('test'), + }, test: { globals: true, environment: 'jsdom',