This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
web-test-runner.config.js
69 lines (68 loc) · 1.85 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
const { esbuildPlugin } = require('@web/dev-server-esbuild');
const { importMapsPlugin } = require('@web/dev-server-import-maps');
const { legacyPlugin } = require('@web/dev-server-legacy');
const { playwrightLauncher } = require('@web/test-runner-playwright');
module.exports = {
nodeResolve: true,
browsers: [
playwrightLauncher({ product: 'chromium' }),
playwrightLauncher({ product: 'firefox' }),
],
files: [
'./src/web-components/**/*.test.ts',
'./src/web-components/**/*.spec.ts',
'!**/node_modules/**/*',
],
plugins: [
importMapsPlugin({
inject: {
importMap: {
imports: {
lodash: '/node_modules/lodash-es/lodash.js',
},
},
},
}),
esbuildPlugin({
ts: true,
tsx: true,
jsxFactory: 'h',
jsxFragment: 'Fragment',
}),
legacyPlugin({
polyfills: {
webcomponents: true,
// Inject lit's polyfill-support module into test files, which is required
// for interfacing with the webcomponents polyfills
custom: [
{
name: 'lit-polyfill-support',
path: 'node_modules/lit/polyfill-support.js',
test: "!('attachShadow' in Element.prototype)",
module: false,
},
],
},
}),
],
coverageConfig: {
report: true,
reportDir: 'coverage-components',
threshold: {
statements: 70,
branches: 70,
functions: 70,
lines: 70,
},
include: ['src/web-components/**/*.ts'],
},
testRunnerHtml: (testFramework) => `
<html>
<head>
<style id="superviz-style">@import"https://unpkg.com/@superviz/[email protected]/css/style.css";</style>
<script type="module" src="${testFramework}"></script>
<script type="module">import 'jest-browser-globals';</script>
</head>
</html>
`,
};