-
Notifications
You must be signed in to change notification settings - Fork 133
/
Copy pathvitest.config.mjs
84 lines (80 loc) · 2.03 KB
/
vitest.config.mjs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { defineConfig } from "vitest/config";
function getBrowserConfig(browser) {
switch (browser) {
case "chrome":
return {
enabled: true,
name: "chrome",
provider: "webdriverio",
headless: true,
providerOptions: {
capabilities: {
"goog:chromeOptions": {
args: [
"--autoplay-policy=no-user-gesture-required",
"--enable-precise-memory-info",
"--js-flags=--expose-gc",
],
},
},
},
};
case "firefox":
return {
enabled: true,
name: "firefox",
provider: "webdriverio",
headless: true,
providerOptions: {
capabilities: {
"moz:firefoxOptions": {
prefs: {
"media.autoplay.default": 0,
"media.autoplay.enabled.user-gestures-needed": false,
"media.autoplay.block-webaudio": false,
"media.autoplay.ask-permission": false,
"media.autoplay.block-event.enabled": false,
"media.block-autoplay-until-in-foreground": false,
},
},
},
},
};
default:
return {
enabled: false,
};
}
}
export default defineConfig({
define: {
// global variables
__TEST_CONTENT_SERVER__: {
URL: "127.0.0.1",
PORT: 3000,
},
__ENVIRONMENT__: {
PRODUCTION: 0,
DEV: 1,
CURRENT_ENV: 1,
},
__LOGGER_LEVEL__: {
CURRENT_LEVEL: '"NONE"',
},
__BROWSER_NAME__: JSON.stringify(process.env.BROWSER_CONFIG),
},
test: {
watch: false,
globals: false,
reporters: "dot",
include: [
// integration tests
"tests/integration/scenarios/**/*.[jt]s?(x)",
"tests/integration/**/*.test.[jt]s?(x)",
// memory tests
"tests/memory/**/*.[jt]s?(x)",
],
globalSetup: "tests/globalSetup.mjs",
browser: getBrowserConfig(process.env.BROWSER_CONFIG ?? "chrome"),
},
});