-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
40 lines (38 loc) · 1.34 KB
/
jest.config.js
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
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { compilerOptions } = require('./tsconfig.json');
const { getConstants } = require('./build-tools/build-time-constants');
const serverBuildTimeConstants = getConstants({
type: 'server',
dev: true,
isServer: true,
isTest: true,
});
module.exports = {
transform: {
// Use official TypeScript Jest transformer
'\\.(ts|tsx)?$': 'ts-jest',
// Use our custom transformer only for the *.js and *.jsx files
'\\.(js|jsx)?$': '<rootDir>/test/transform.js',
// Custom transformer for statics, to output its path as a string
'\\.(jpg|png|gif|svg|ttf|woff)?$': '<rootDir>/test/transform-path.js',
},
transformIgnorePatterns: ['/node_modules/(?!(lodash-es)/)'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testMatch: ['**/*.(test|spec).(ts|tsx)'],
globals: {
...serverBuildTimeConstants,
'ts-jest': {
babelConfig: true,
tsconfig: 'tsconfig.json',
},
},
setupFilesAfterEnv: [],
collectCoverage: true,
coverageDirectory: '<rootDir>/.coverage',
coverageReporters: ['json', 'lcov', 'text', 'text-summary'],
collectCoverageFrom: ['<rootDir>/utils/**/*.{ts,tsx}'],
coveragePathIgnorePatterns: ['/node_modules/'],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
}),
};