-
Notifications
You must be signed in to change notification settings - Fork 2
/
web-test-runner.config.mjs
30 lines (27 loc) · 901 Bytes
/
web-test-runner.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
process.env.NODE_ENV = 'test'
import vite from 'vite-web-test-runner-plugin'
import {chromeLauncher} from '@web/test-runner'
const ignoredBrowserLogs = [
'[vite] connecting...',
'[vite] connected.',
]
export default {
browserStartTimeout: 20000,
testsFinishTimeout: 10000,
plugins: [vite()],
browsers: [chromeLauncher({launchOptions: {dumpio: !!process.env.DUMP_CHROME_OUT, args: process.env.TEST_CHROME_ARGS?.split(' ')}})],
testRunnerHtml: testFramework =>
`<html>
<body>
<script type="module">
window.global = window
window.process = { env: {NODE_ENV: 'test'} }
</script>
<script type="module" src="/src/setup-tests.ts"></script>
<script type="module" src="${testFramework}"></script>
</body>
</html>`,
filterBrowserLogs: ({args}) => {
return !args.some((arg) => ignoredBrowserLogs.includes(arg))
}
}