-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathweb-test-runner.config.js
More file actions
56 lines (49 loc) · 1.62 KB
/
Copy pathweb-test-runner.config.js
File metadata and controls
56 lines (49 loc) · 1.62 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
54
55
56
import { playwrightLauncher } from '@web/test-runner-playwright'
/**
* Web Test Runner Configuration
*
* This configuration runs browser-native ES module tests using Playwright.
* Tests run in real Chromium browser environments for accurate results.
*
* Commands:
* npm test - Run tests once
* npm run test:watch - Run tests in watch mode
* npm run test:coverage - Run tests with coverage report
* @see https://modern-web.dev/docs/test-runner/overview/
*/
export default {
// Test file pattern - all .test.js files in test/ directory
files: 'test/**/*.test.js',
// Enable ES module resolution from node_modules
nodeResolve: true,
// Enable code coverage collection
coverage: true,
// Coverage configuration
coverageConfig: {
// Include these directories in coverage
include: ['js/**/*.js', 'components/**/*.js'],
// Exclude these from coverage
exclude: ['node_modules/**', 'js/lib/**', 'test/**']
},
// Browser configuration - using Chromium via Playwright
browsers: [
playwrightLauncher({
product: 'chromium',
// Reduce motion to skip CSS animations in tests, avoiding
// pending setTimeout delays from animateRemove/animateClose
// and preventing browser session hangs from animation timers.
createBrowserContext: ({ browser }) => browser.newContext({
reducedMotion: 'reduce'
})
})
],
// Maximum time for a test file to finish after all tests complete
testsFinishTimeout: 60000,
// Test framework configuration
testFramework: {
config: {
// Default timeout for each test (5 seconds)
timeout: 5000
}
}
}