-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvitest.config.js
45 lines (41 loc) · 1.65 KB
/
vitest.config.js
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
import path from "path";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vitest/config";
import dsv from "@rollup/plugin-dsv";
export default defineConfig({
resolve: {
alias: {
"package.json": path.resolve(__dirname, "./package.json")
}
},
test: {
globals: true,
// "happy-dom" costs us about 1/2 second per test run (including each update)
// it is the cause of the "Download the React DevTools..." message
environment: "happy-dom",
// About 20% of our tests rely browser environment of happy-dom.
//environment: "node",
//deps: { interopDefault: true }, // needed this when I was attempting environment:"node" see https://github.com/vitest-dev/vitest/issues/2544
include: ["./**/*.spec.ts"],
// Note: the __mocks__ system seems to not be working. In mainProcess/__mocks__ there is a MainProcessApiAccess.ts, but it is ignored,
// so I had to detect when we're tesitng within the real MainProcessApiAccess.ts and create a mock there.
setupFiles: ["./src/vitest.mock.ts"],
/**
* The default timeout of 5000ms is sometimes not enough for playwright.
*/
testTimeout: 30_000,
hookTimeout: 30_000
},
plugins: [
react({
babel: {
// makes lingui macros work. There is a some performance penalty, but I
//don't know how much. See https://github.com/skovhus/vite-lingui
plugins: ["macros"]
// I don't know why, but css props work without this or the 'macros' thing above
// plugins: ["@emotion/babel-plugin"],
}
}),
dsv() // without this, importing genres.csv causes a failure when it sees `"foo",,"bar"`
]
});