47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
import { defineConfig } from "vitest/config";
|
|
import path from "node:path";
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
// Expo modules are not installed in the monorepo (they live in the
|
|
// user's RN app). Point them at lightweight stubs so Vite's import
|
|
// analysis doesn't fail. Tests override these via vi.mock().
|
|
"expo-document-picker": path.resolve(
|
|
__dirname,
|
|
"src/__tests__/__mocks__/expo-document-picker.ts",
|
|
),
|
|
"expo-file-system": path.resolve(
|
|
__dirname,
|
|
"src/__tests__/__mocks__/expo-file-system.ts",
|
|
),
|
|
// react-native uses Flow syntax that vite/rollup cannot parse.
|
|
// This alias redirects to a minimal stub for test environments.
|
|
"react-native": path.resolve(__dirname, "src/__mocks__/react-native.ts"),
|
|
// react-native-streamdown is a peer dependency that won't be installed
|
|
// in the monorepo dev environment; tests mock it via vi.mock().
|
|
// This alias prevents vite's import-analysis from failing on the import.
|
|
"react-native-streamdown": path.resolve(
|
|
__dirname,
|
|
"src/__mocks__/react-native-streamdown.ts",
|
|
),
|
|
},
|
|
},
|
|
test: {
|
|
environment: "jsdom",
|
|
globals: true,
|
|
include: ["src/**/__tests__/**/*.{test,spec}.{ts,tsx}"],
|
|
setupFiles: ["./src/__tests__/setup.ts"],
|
|
reporters: [["default", { summary: false }]],
|
|
silent: true,
|
|
server: {
|
|
deps: {
|
|
inline: [/@copilotkit/],
|
|
// react-native uses Flow syntax that Vitest/Rollup can't parse outside
|
|
// of Metro. Exclude it so the test runner doesn't attempt to bundle it.
|
|
external: ["react-native"],
|
|
},
|
|
},
|
|
},
|
|
});
|