-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathweb-test-runner.config.js
61 lines (58 loc) · 2.21 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
import json from '@rollup/plugin-json';
import { rollupAdapter } from '@web/dev-server-rollup';
import { defaultReporter, summaryReporter } from '@web/test-runner';
import { chromeLauncher } from '@web/test-runner-chrome';
import { cemAnalyzerPlugin } from './wds/cem-analyzer-plugin.js';
import { commonjsPluginWithConfig, esbuildBundlePluginWithConfig } from './wds/wds-common.js';
// sets the language used by the headless browser
// normally we'd set it through the `chromeLauncher` options but it makes the debug mode crash
process.env.LANGUAGE = 'en';
export default {
files: ['test/**/*.test.*', 'src/components/**/*.test.*'],
filterBrowserLogs: ({ args }) => {
const logsToExclude = [
'Lit is in dev mode. Not recommended for production! See https://lit.dev/msg/dev-mode for more information.',
'Multiple versions of Lit loaded. Loading multiple versions is not recommended. See https://lit.dev/msg/multiple-versions for more information.',
];
const logMessage = args[0];
return logMessage != null && !logsToExclude.includes(logMessage);
},
browsers: [
chromeLauncher({
// Fixes random timeouts with Chrome > 127, see https://github.com/CleverCloud/clever-components/issues/1146 for more info
concurrency: 1,
async createPage({ context }) {
const page = await context.newPage();
// We need that for unit tests working with dates and timezones
await page.emulateTimezone('Europe/Paris');
return page;
},
}),
],
nodeResolve: true,
mimeTypes: {
'**/*.json': 'js',
},
reporters: [
// mocha like report
process.env.CI !== 'true' ? summaryReporter({ flatten: false }) : [],
// report global tests progress
defaultReporter({ reportTestResults: true, reportTestProgress: true }),
],
testFramework: {
config: {
ui: 'bdd',
timeout: '10000',
},
},
testRunnerHtml: (testFramework) => `
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="src/styles/default-theme.css" >
<script type="module" src="${testFramework}"></script>
</head>
</html>
`,
plugins: [cemAnalyzerPlugin, rollupAdapter(json()), esbuildBundlePluginWithConfig, commonjsPluginWithConfig],
};