-
Notifications
You must be signed in to change notification settings - Fork 0
/
web-test-runner.config.mjs
56 lines (53 loc) · 1.43 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
53
54
55
56
import fs from 'fs-extra';
import path from 'path';
import { visualRegressionPlugin } from '@web/test-runner-visual-regression/plugin';
import { playwrightLauncher } from '@web/test-runner-playwright';
const html = fs.readFileSync('./dist/src/index.html').toString();
const versions = fs.readJSONSync('test/temp/docs/.typedoc-plugin-versions');
const version = versions.versions[0];
fs.copyFileSync(
path.join('./test', 'dist', 'frontend', 'index.spec.js'),
path.join('./test', 'temp', 'docs', version, 'index.spec.js')
);
export default {
testRunnerHtml: (testFramework) =>
html.replace(
'<!-- insert test code here -->',
`<script type="module" src="${testFramework}"></script>`
),
coverage: true,
files: `./test/temp/docs/${version}/index.spec.js`,
rootDir: `./test/temp/docs/${version}`,
nodeResolve: true,
coverageConfig: {
report: true,
reporters: ['html', 'clover'],
reportDir: 'test/coverage/frontend',
include: ['dist/src/frontend/**/*.js'],
},
browsers: [
playwrightLauncher({
product: 'chromium',
launchOptions: {
headless: true,
},
}),
],
plugins: [
visualRegressionPlugin({
// eslint-disable-next-line no-undef
update: process.argv.includes('--update-visual-baseline'),
baseDir: './test/screenshots',
failureThresholdType: 'percent',
failureThreshold: 1.2,
}),
],
manual: false,
open: false,
testFramework: {
config: {
bail: true,
},
},
testsFinishTimeout: 960000,
};