-
Notifications
You must be signed in to change notification settings - Fork 4
/
web-test-runner.config.mjs
52 lines (43 loc) · 1.6 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// @ts-check
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { a11ySnapshotPlugin } from '@web/test-runner-commands/plugins';
import { playwrightLauncher } from '@web/test-runner-playwright';
import { readFile } from 'fs/promises';
import { env } from 'node:process';
const styles = await readFile('./packages/themes/sanoma-learning/light.css', 'utf-8');
/** @type {import('@web/test-runner').TestRunnerConfig} */
const config = {
nodeResolve: true,
rootDir: '.',
files: [
'packages/components/**/src/**/*.spec.ts',
],
browsers: [playwrightLauncher({ product: 'chromium' })],
plugins: [a11ySnapshotPlugin(), esbuildPlugin({ ts: true, tsconfig: './tsconfig.base.json' })],
filterBrowserLogs: ({ type, args }) => {
if (type === 'warn' && args?.at(0)?.startsWith('Lit is in dev mode.')) {
return false;
} else if (type === 'error' && args?.at(0) === null) {
// This is unwanted output due to the `setupIgnoreWindowResizeObserverLoopErrors`
// function from `@lit-labs/virtualizer/support/resize-observer-errors.js`.
return false;
}
return true;
},
staticLogging: env.CI === 'true',
coverageConfig: {
report: true,
include: ['**/*.ts'],
exclude: ['**/index.ts', '**/register.ts', '**/*.scss.ts']
},
testRunnerHtml: testFramework => `
<html>
<body>
<script src="/node_modules/@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min.js"></script>
<script type="module" src="${testFramework}"></script>
<style>${styles}</style>
</body>
</html>
`
};
export default config;