-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathweb-test-runner.config.js
More file actions
53 lines (51 loc) · 1.85 KB
/
web-test-runner.config.js
File metadata and controls
53 lines (51 loc) · 1.85 KB
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
import { importMapsPlugin } from '@web/dev-server-import-maps'
import { chromeLauncher, defaultReporter } from '@web/test-runner'
import { vitePlugin } from '@remcovaes/web-test-runner-vite-plugin';
import ConsoleReporter from './ConsoleReporter.js'
process.env.NODE_ENV = 'development'
if (!process.env.ESW_OCS_ENG_UI_LOGS)
process.env.ESW_OCS_ENG_UI_LOGS = false
console.log('process.logs', process.env.ESW_OCS_ENG_UI_LOGS)
export default {
concurrency: 1,
concurrentBrowsers: 1,
testsFinishTimeout: 500000,
testFramework: {
config: {
timeout: '3000'
}
},
plugins: [
vitePlugin(),
importMapsPlugin({
inject: {
importMap: {
imports: {
// this path needs to be absolute url whatever browser trys to load. cannot be relative path. prod file path: mocked file path
'/src/features/sequencer/hooks/useSequencerService.ts':
'/test/mocks/useSequencerService.ts',
'/src/contexts/ConfigServiceContext.tsx':
'/test/mocks/ConfigServiceContext.tsx'
}
}
}
})
],
testRunnerHtml: (testFramework) => `
<html>
<head>
<script type="module">
// Note: globals expected by @testing-library/react
window.global = window;
window.process = { env: {} };
// Note: adapted from https://github.com/vitejs/vite/issues/1984#issuecomment-778289660
// Note: without this you'll run into https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201
window.__vite_plugin_react_preamble_installed__ = true;
</script>
<script type="module" src="${testFramework}"></script>
</head>
</html>
`,
reporters: [defaultReporter({ reportTestResults: true, reportTestProgress: true }), ConsoleReporter()],
browserLogs: Boolean(process.env.ESW_OCS_ENG_UI_LOGS)
}