-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjest.config.js
More file actions
73 lines (62 loc) · 1.55 KB
/
jest.config.js
File metadata and controls
73 lines (62 loc) · 1.55 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* Jest Configuration for DesignSetGo
*
* Configuration for JavaScript unit tests using Jest.
* Extends @wordpress/scripts default Jest configuration.
*
* @see https://jestjs.io/docs/configuration
*/
module.exports = {
// Extend @wordpress/scripts default config
...require('@wordpress/scripts/config/jest-unit.config'),
// Use V8 coverage instead of babel-plugin-istanbul
// (babel-plugin-istanbul is incompatible with glob v10 override)
coverageProvider: 'v8',
// Test match patterns
testMatch: [
'**/tests/unit/**/*.test.js',
'**/src/**/__tests__/**/*.js',
'**/src/**/test/*.js',
],
// Setup files
setupFilesAfterEnv: ['<rootDir>/tests/unit/setup.js'],
// Module paths
modulePaths: ['<rootDir>/src'],
// Transform files
transform: {
'^.+\\.[jt]sx?$': ['@wordpress/scripts/config/babel-transform'],
},
// Module name mapper for CSS and asset files
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|svg|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/tests/unit/__mocks__/fileMock.js',
},
// Coverage configuration
collectCoverageFrom: [
'src/**/*.{js,jsx}',
'!src/**/index.js',
'!src/**/*.stories.{js,jsx}',
'!**/node_modules/**',
'!**/vendor/**',
'!**/build/**',
],
// Coverage thresholds
coverageThreshold: {
global: {
branches: 50,
functions: 50,
lines: 50,
statements: 50,
},
},
// Ignore patterns
testPathIgnorePatterns: [
'/node_modules/',
'/vendor/',
'/build/',
'/tests/e2e/',
],
// Verbose output
verbose: true,
};