forked from material-svelte/vite-web-test-runner-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb-test-runner.config.js
36 lines (33 loc) · 1002 Bytes
/
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
const vite = require('vite-web-test-runner-plugin');
const ignoredBrowserLogs = [
'[vite] connecting...',
'[vite] connected.',
];
module.exports = {
plugins: [
vite(),
],
coverageConfig: {
include: [
'src/**/*.{js,jsx,ts,tsx}'
]
},
testRunnerHtml: testFramework => `
<html>
<head>
<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));
},
};