-
Notifications
You must be signed in to change notification settings - Fork 713
Expand file tree
/
Copy pathvitest.config.mts
More file actions
50 lines (48 loc) · 1.68 KB
/
vitest.config.mts
File metadata and controls
50 lines (48 loc) · 1.68 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
47
48
49
50
import { defineConfig } from "vitest/config";
import path from "path";
import { fileURLToPath } from "url";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import solid from "vite-plugin-solid";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
plugins: [
svelte({
hot: false,
compilerOptions: { runes: true },
// Also transform bits-ui and vaul-svelte .svelte files so getContext works in tests
include: ["**/*.svelte", "**/bits-ui/**/*.svelte", "**/vaul-svelte/**/*.svelte"],
}),
solid({
// Only transform files in the solid package to avoid interfering with React JSX
include: ["packages/solid/**/*.{ts,tsx}"],
}),
],
resolve: {
// Ensure Svelte resolves to browser bundle, not server
conditions: ["browser"],
// Deduplicate React, Vue, and Solid so tests don't get two copies
// (pnpm strict resolution can cause packages to resolve different copies)
alias: {
react: path.resolve(__dirname, "node_modules/react"),
"react-dom": path.resolve(__dirname, "node_modules/react-dom"),
vue: path.resolve(__dirname, "packages/vue/node_modules/vue"),
"solid-js": path.resolve(__dirname, "node_modules/solid-js"),
},
},
test: {
globals: true,
environment: "jsdom",
include: ["packages/**/*.test.ts", "packages/**/*.test.tsx"],
server: {
deps: {
inline: [/bits-ui/, /runed/, /vaul-svelte/, /@lucide\/svelte/],
},
},
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
include: ["packages/*/src/**/*.{ts,tsx,svelte}"],
exclude: ["**/*.test.{ts,tsx}", "**/index.ts"],
},
},
});