-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb-test-runner.config.js
35 lines (32 loc) · 1.06 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
import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { defaultReporter, summaryReporter } from '@web/test-runner';
import { junitReporter } from '@web/test-runner-junit-reporter';
const { values } = parseArgs({ options: { ci: { type: 'boolean', default: false } } });
const { ci: isCi } = values;
export default {
files: 'src/**/*.test.ts',
nodeResolve: true,
puppeteer: true,
esbuild: true,
plugins: [
esbuildPlugin({
ts: true,
tsconfig: fileURLToPath(new URL('./tsconfig.test.json', import.meta.url)),
}),
],
testRunnerHtml: (testFramework) => `
<script type="module" src="${testFramework}"></script>
<script type="module" src="/web-test-runner.setup.js"></script>
`,
reporters: isCi
? [
junitReporter({
outputPath: './reports/test-results.xml',
reportLogs: true,
}),
summaryReporter({ flatten: false }),
]
: [defaultReporter({ reportTestResults: true, reportTestProgress: true })],
};