-
Notifications
You must be signed in to change notification settings - Fork 0
/
web-test-runner.config.js
55 lines (50 loc) · 1.41 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
import {legacyPlugin} from '@web/dev-server-legacy';
import {playwrightLauncher} from '@web/test-runner-playwright';
const mode = process.env.MODE || 'dev';
if (!['dev', 'prod'].includes(mode)) {
throw new Error(`MODE must be "dev" or "prod"`);
}
const browsers = {
chromium: playwrightLauncher({product: 'chromium'}),
// firefox: playwrightLauncher({product: 'firefox'}),
webkit: playwrightLauncher({product: 'webkit'})
}
const noBrowser = (b) => {
throw new Error(`No browser configured; using defaults`);
};
let commandLineBrowsers;
try {
commandLineBrowsers = process.env.BROWSERS?.split(',').map(
(b) => browsers[b] ?? noBrowser(b)
);
} catch (e) {
console.warn(e);
}
export default {
rootDir: '.',
files: ['./src/**/*_test.js'],
nodeResolve: {exportConditions: mode === 'dev' ? ['development'] : []},
preserveSymlinks: true,
browsers: commandLineBrowsers ?? Object.values(browsers),
testFramework: {
config: {
ui: 'tdd',
timeout: '60000',
},
},
plugins: [
legacyPlugin({
polyfills: {
webcomponents: true,
custom: [
{
name: 'lit-polyfill-support',
path: 'node_modules/lit/polyfill-support.js',
test: "!('attachShadow' in Element.prototype) || !('getRootNode' in Element.prototype) || window.ShadyDOM && window.ShadyDOM.force",
module: false,
},
],
},
}),
],
};