A local-first multi-agent app development platform, built on PenguinHarness
fix(web,gallery): 依赖装成副本时,测试不再整片报 React is not defined
lmliheng55e6d7e33bcf
diff --git a/packages/ui-gallery/vitest.config.ts b/packages/ui-gallery/vitest.config.tsindex 31764127..c1e33fb5 100644--- a/packages/ui-gallery/vitest.config.ts+++ b/packages/ui-gallery/vitest.config.ts@@ -11,5 +11,12 @@ import { mockWebNetwork } from "./src/app/mock/vite-plugin";export default defineConfig({plugins: [mockWebNetwork()],+ // `@adelie/ui` is a workspace package the repository asks pnpm to inject+ // (`injectWorkspacePackages`), and an injected copy is a real directory under `node_modules`:+ // Vite's esbuild step finds no tsconfig above it there, falls back to the classic JSX runtime and+ // every test that reaches `@adelie/ui` dies with "React is not defined". The automatic runtime is+ // what the package's own tsconfig declares (`jsx: react-jsx`), so it is named here as well; the+ // difference only shows when the copy is injected rather than linked.+ esbuild: { jsx: "automatic" },test: { environment: "node", include: ["test/**/*.test.ts"] },});diff --git a/packages/web/vitest.config.ts b/packages/web/vitest.config.tsindex 8f2033a7..b662d634 100644--- a/packages/web/vitest.config.ts+++ b/packages/web/vitest.config.ts@@ -7,6 +7,13 @@import { defineConfig } from "vitest/config";export default defineConfig({+ // `@adelie/ui` is a workspace package the repository asks pnpm to inject+ // (`injectWorkspacePackages`), and an injected copy is a real directory under `node_modules`:+ // Vite's esbuild step finds no tsconfig above it there, falls back to the classic JSX runtime and+ // every suite that reaches `@adelie/ui` dies with "React is not defined". The automatic runtime is+ // what the package's own tsconfig declares (`jsx: react-jsx`), so it is named here as well; the+ // difference only shows when the copy is injected rather than linked.+ esbuild: { jsx: "automatic" },test: {environment: "node",include: ["test/**/*.test.ts"],