-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
57 lines (54 loc) · 1.38 KB
/
jest.config.js
File metadata and controls
57 lines (54 loc) · 1.38 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
const { defaults: tsjPreset } = require('ts-jest/presets')
const { pathsToModuleNameMapper } = require('ts-jest/utils')
/**
* @see https://github.com/jpavon/react-scripts-ts/blob/master/scripts/test.js#L43
*/
const setupJestConfig = (dirName = '<rootDir>') => {
const jestConfig = {
verbose: true,
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|ts|tsx)$',
],
setupFilesAfterEnv: ['./jest.setup.js'],
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
testMatch: [
dirName + '/__tests__/**/*.(j|t)s?(x)',
dirName + '/src/**/__tests__/**/*.(j|t)s?(x)',
dirName + '/src/**/?(*.)(test).(j|t)s?(x)',
],
testPathIgnorePatterns: [
dirName + '/__tests__/deps/*.(j|t)s?(x)',
dirName + '/__tests__/fixtures/*.(j|t)s?(x)',
],
testEnvironment: 'node',
transform: {
...tsjPreset.transform,
},
moduleFileExtensions: [
'web.ts',
'ts',
'web.tsx',
'tsx',
'web.js',
'js',
'web.jsx',
'jsx',
'mjs',
'json',
'node',
],
/**
* @see https://kulshekhar.github.io/ts-jest/user/config/
*/
globals: {
'ts-jest': {
tsConfig: require('./tsconfig.test.json').compilerOptions,
diagnostics: {
warnOnly: true,
},
},
},
}
return jestConfig
}
module.exports = setupJestConfig()