-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb-test-runner.config.js
50 lines (48 loc) · 1.39 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
import {removeViteLogging, vitePlugin} from '@remcovaes/web-test-runner-vite-plugin';
import {playwrightLauncher} from '@web/test-runner-playwright';
import {globbySync} from 'globby';
export default {
rootDir: '.',
files: 'src/**/*.test.ts',
concurrentBrowsers: 3,
plugins: [
vitePlugin()
],
filterBrowserLogs: removeViteLogging,
browsers: [
playwrightLauncher({product: 'chromium'}),
playwrightLauncher({product: 'webkit'})
],
testRunnerHtml: testFramework => `
<!doctype html>
<html lang="en">
<head>
<script type="module" src="${testFramework}"></script>
<script type="module">
window.process = {env: {NODE_ENV: 'production'}}
/* Hack to disable Lit dev mode warnings */
const systemWarn = window.console.warn;
window.console.warn = (...args) => {
if (args[0].indexOf('Lit is in dev mode.') === 0) {
return;
}
if (args[0].indexOf('Multiple versions of Lit loaded.') === 0) {
return;
}
systemWarn(...args);
};
</script>
</head>
<body>
</body>
</html>
`,
groups: globbySync('src/**/*.test.ts').map(path =>
{
const groupName = path.match(/^.*\/(?<fileName>.*)\.test\.ts/).groups.fileName;
return {
name: groupName,
files: path
};
})
};