forked from patternfly/patternfly-react-seed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
84 lines (69 loc) · 2.16 KB
/
jest.config.js
File metadata and controls
84 lines (69 loc) · 2.16 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
74
75
76
77
78
79
80
81
82
83
84
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
// Indicates whether the coverage information should be collected while executing the test
collectCoverage: false,
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// Coverage collection configuration
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/index.tsx',
'!src/**/*.test.{ts,tsx}',
'!src/**/__tests__/**',
],
// Coverage thresholds
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70,
},
},
// An array of directory names to be searched recursively up from the requiring module's location
moduleDirectories: [
"node_modules",
"<rootDir>/src"
],
// A map from regular expressions to module names that allow to stub out resources with a single module
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"@app/(.*)": '<rootDir>/src/app/$1'
},
// A preset that is used as a base for Jest's configuration
preset: "ts-jest/presets/js-with-ts",
// The test environment that will be used for testing.
testEnvironment: "jest-fixed-jsdom",
// Setup files after environment
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
// Test match patterns
testMatch: [
'**/__tests__/**/*.(test|spec).(ts|tsx|js)',
'**/*.(test|spec).(ts|tsx|js)',
],
// Transform files with ts-jest
transform: {
'^.+\\.(ts|tsx)$': ['ts-jest', {
tsconfig: {
jsx: 'react',
esModuleInterop: true,
allowSyntheticDefaultImports: true,
},
}],
},
// Module file extensions
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
// Ignore patterns
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/coverage/',
],
// Verbose output
verbose: true,
};