-
-
Notifications
You must be signed in to change notification settings - Fork 310
/
vitest.base.browser.config.ts
64 lines (63 loc) · 1.8 KB
/
vitest.base.browser.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import path from "node:path";
import {defineConfig} from "vitest/config";
const __dirname = new URL(".", import.meta.url).pathname;
import {nodePolyfills} from "vite-plugin-node-polyfills";
import topLevelAwait from "vite-plugin-top-level-await";
import {blsBrowserPlugin} from "./scripts/vite/plugins/blsBrowserPlugin.js";
export default defineConfig({
plugins: [
topLevelAwait(),
blsBrowserPlugin(),
nodePolyfills({
include: ["buffer", "process", "util", "string_decoder", "url", "querystring", "events"],
globals: {Buffer: true, process: true},
protocolImports: true,
}),
// TODO: Should be removed when the vite issue is fixed
// https://github.com/vitest-dev/vitest/issues/6203#issuecomment-2245836028
{
name: "defineArgv",
config() {
return {
define: {
"process.argv": "[]",
"process.nextTick": "function noop(){}",
},
};
},
},
],
test: {
include: ["**/*.test.ts"],
exclude: [
"**/*.node.test.ts",
"**/node_modules/**",
"**/dist/**",
"**/lib/**",
"**/cypress/**",
"**/.{idea,git,cache,output,temp}/**",
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
],
setupFiles: [path.join(__dirname, "./scripts/vitest/setupFiles/customMatchers.ts")],
reporters: ["default", "hanging-process"],
coverage: {
enabled: false,
},
browser: {
name: "chrome",
headless: true,
provider: "webdriverio",
screenshotFailures: false,
providerOptions: {
capabilities: {
browserVersion: "latest",
},
},
},
},
resolve: {
alias: {
"node:perf_hooks": path.join(__dirname, "scripts/vitest/polyfills/perf_hooks.js"),
},
},
});