-
Notifications
You must be signed in to change notification settings - Fork 14
/
vitest.config.ts
36 lines (34 loc) · 1.02 KB
/
vitest.config.ts
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
import { defineConfig } from "vitest/config";
import solidPlugin from "vite-plugin-solid";
export default defineConfig(({ mode }) => {
// to test in server environment, run with "--mode ssr" or "--mode test:ssr" flag
// loads only server.test.ts file
const testSSR = mode === "test:ssr" || mode === "ssr";
return {
plugins: [
solidPlugin({
// https://github.com/solidjs/solid-refresh/issues/29
hot: false,
// For testing SSR we need to do a SSR JSX transform
solid: { generate: testSSR ? "ssr" : "dom" }
})
],
test: {
watch: false,
isolate: !testSSR,
environment: testSSR ? "node" : "jsdom",
transformMode: { web: [/\.[jt]sx$/] },
...(testSSR
? {
include: ["test/server.test.{ts,tsx}"]
}
: {
include: ["test/*.test.{ts,tsx}"],
exclude: ["test/server.test.{ts,tsx}"]
})
},
resolve: {
conditions: testSSR ? ["node"] : ["browser", "development"]
}
};
});