-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
99 lines (91 loc) · 2.06 KB
/
jest.config.js
File metadata and controls
99 lines (91 loc) · 2.06 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
const { compilerOptions } = require('./tsconfig.json');
const path = require('path');
const basicIgnorePatterns = [
'<rootDir>/node_modules',
'<rootDir>/\\.cache',
'<rootDir>/\\.vscode',
'<rootDir>.*/public',
'<rootDir>/cypress',
'<rootDir>/coverage',
'__snapshots__',
];
const testPathIgnorePatterns = [...basicIgnorePatterns, 'gatsby-types.d.ts'];
const transformIgnorePatterns = [
...basicIgnorePatterns,
'gatsby-types.d.ts',
'<rootDir>/node_modules/(?!(gatsby)/)',
];
const watchPathIgnorePatterns = [...basicIgnorePatterns];
const common = {
testPathIgnorePatterns,
transformIgnorePatterns,
watchPathIgnorePatterns,
};
const commonForJestTests = {
...common,
globals: {
__PATH_PREFIX__: '',
},
prettierPath: null,
moduleNameMapper: {
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/test/__mocks__/file-mock.js',
},
setupFiles: ['<rootDir>/test/loadershim.js'],
testEnvironmentOptions: {
url: 'http://localhost',
},
transform: {
'^.+\\.[jt]sx?$': '<rootDir>/test/jest-preprocess.js',
},
};
const commonForLintRunners = {
...common,
testMatch: ['<rootDir>/src/**/*'],
};
module.exports = {
collectCoverageFrom: [
'**/src/**/*.{js,jsx,ts,tsx}',
'!**/__tests__/**',
'!**/gatsby-types.d.ts/**',
'!**/__server_tests__/**',
'!**/node_modules/**',
],
coverageThreshold: {
global: {
statements: 15,
branches: 10,
functions: 15,
lines: 15,
},
},
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
'jest-watch-select-projects',
],
projects: [
{
...commonForJestTests,
displayName: 'client',
testEnvironment: 'jest-environment-jsdom',
},
{
...commonForLintRunners,
displayName: 'eslint',
runner: 'jest-runner-eslint',
},
{
...commonForLintRunners,
displayName: 'prettier',
preset: 'jest-runner-prettier',
},
{
...commonForLintRunners,
displayName: 'stylelint',
preset: 'jest-runner-stylelint',
moduleFileExtensions: ['css'],
},
],
};