-
Notifications
You must be signed in to change notification settings - Fork 0
/
web-test-runner.config.js
75 lines (73 loc) · 2.7 KB
/
web-test-runner.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
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
process.env.NODE_ENV = 'test';
const vite = require("vite-web-test-runner-plugin");
const { playwrightLauncher } = require('@web/test-runner-playwright');
const ignoredBrowserLogs = [
'[vite] connecting...',
'[vite] connected.',
];
module.exports = {
testFramework: {
config: {
timeout: '3600000', // 1 hour
},
},
testsFinishTimeout: 3600000, // 1 hour
coverageConfig: {
include: [
'src/**/*.{js,jsx,ts,tsx}'
],
},
plugins: [vite()],
testRunnerHtml: testFramework => `
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="GitFeatures: BDD specification writing tool" />
<meta name="gf:config" content="%7B%22currentRepositoryURL%22%3A%22https%3A%2F%2Fgithub.com%2Fsengac%2Fgitfeatures-spec.git%22%2C%22localRepositories%22%3A%7B%7D%2C%22isCommitPushChecked%22%3Afalse%2C%22gitProfiles%22%3A%7B%22Default%22%3A%7B%22profile-name%22%3A%22Default%22%2C%22cors-proxy-address%22%3A%22https%3A%2F%2Fcors.gitfeatures.com%22%2C%22author-name%22%3A%22Sir%20Testsalot%22%2C%22author-email%22%3A%22sir%40testsalot.com%22%2C%22default-branch%22%3A%22master%22%2C%22remote-name%22%3A%22origin%22%2C%22pgp-private-key%22%3A%22%22%2C%22username%22%3A%22sirtestsalot%22%2C%22password%22%3A%22%22%7D%7D%7D" />
<style type="text/css">
html, body {
overscroll-behavior: contain;
overscroll-behavior-y: contain;
height: 100%;
margin: 0;
}
</style>
<script type="module">
// Note: globals expected by @testing-library/react
window.global = window;
window.process = { env: {} };
// Note: adapted from https://github.com/vitejs/vite/issues/1984#issuecomment-778289660
// Note: without this you'll run into https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201
window.__vite_plugin_react_preamble_installed__ = true;
</script>
<script type="module" src="${testFramework}"></script>
</head>
</html>
`,
filterBrowserLogs: ({ args }) => {
return !args.some((arg) => ignoredBrowserLogs.includes(arg));
},
browsers: [
playwrightLauncher({
product: 'chromium',
launchOptions: {
headless: true,
devtools: false
},
}),
playwrightLauncher({
product: 'firefox',
launchOptions: {
headless: true,
devtools: false
},
}),
playwrightLauncher({
product: 'webkit',
launchOptions: {
headless: true,
devtools: false
},
}),
]
};