forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.mjs
More file actions
46 lines (45 loc) · 1.67 KB
/
Copy pathvitest.config.mjs
File metadata and controls
46 lines (45 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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"],
},
},
},
});