forked from adobe/spectrum-web-components
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathweb-test-runner.config.js
116 lines (113 loc) · 3.63 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License")
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
import { playwrightLauncher } from '@web/test-runner-playwright';
import {
sendKeysPlugin,
a11ySnapshotPlugin,
} from '@web/test-runner-commands/plugins';
import { sendMousePlugin } from './test/plugins/send-mouse-plugin.js';
import {
packages,
vrtGroups,
configuredVisualRegressionPlugin,
} from './web-test-runner.utils.js';
import { fromRollup } from '@web/dev-server-rollup';
import rollupJson from '@rollup/plugin-json';
import rollupCommonjs from '@rollup/plugin-commonjs';
const commonjs = fromRollup(rollupCommonjs);
const json = fromRollup(rollupJson);
export default {
plugins: [
commonjs({
include: ['**/node_modules/@formatjs/intl-numberformat/**/*.js'],
}),
sendKeysPlugin(),
sendMousePlugin(),
a11ySnapshotPlugin(),
configuredVisualRegressionPlugin(),
json({}),
],
mimeTypes: {
'**/*.json': 'js',
},
nodeResolve: true,
concurrency: 4,
concurrentBrowsers: 1,
testsFinishTimeout: 20000,
coverageConfig: {
report: true,
reportDir: 'coverage',
exclude: [
'packages/*/stories/*',
'packages/icons-ui/**',
'packages/icons-workflow/**',
// The following file is no longer used in Chrome where coverage is calculated.
'packages/shared/src/focus-visible.*',
'packages/styles/**',
'test/**',
'**/node_modules/**',
],
threshold: {
statements: 98,
branches: 93,
functions: 98,
lines: 98,
},
},
testFramework: {
config: {
timeout: 10000,
},
},
groups: [
{
name: 'unit',
files: 'packages/*/test/*.test.js',
},
...vrtGroups,
...packages.reduce((acc, pkg) => {
const skipPkgs = [
'bundle',
'icons-ui',
'icons-workflow',
'modal',
'styles',
];
if (!skipPkgs.includes(pkg)) {
acc.push({
name: pkg,
files: `packages/${pkg}/test/*.test.js`,
});
}
return acc;
}, []),
],
group: 'unit',
browsers: [
playwrightLauncher({ product: 'chromium' }),
playwrightLauncher({ product: 'webkit' }),
playwrightLauncher({
product: 'firefox',
launchOptions: {
firefoxUserPrefs: {
'toolkit.telemetry.reportingpolicy.firstRun': false,
'browser.shell.checkDefaultBrowser': false,
'browser.bookmarks.restore_default_bookmarks': false,
'dom.disable_open_during_load': false,
'dom.max_script_run_time': 0,
'dom.min_background_timeout_value': 10,
'extensions.autoDisableScopes': 0,
'extensions.enabledScopes': 15,
},
},
}),
],
};