-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
35 lines (34 loc) · 1.05 KB
/
jest.config.js
File metadata and controls
35 lines (34 loc) · 1.05 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
const path = require('path');
const { pathsToModuleNameMapper } = require('ts-jest');
const paths = require(path.join(process.cwd(), 'tsconfig.json')).compilerOptions.paths ?? {};
/** @type {import('ts-jest').JestConfigWithTsJest} **/
module.exports = {
testRegex: '\\.spec\\.ts$',
preset: 'ts-jest',
coverageDirectory: './coverage',
moduleFileExtensions: ['js', 'json', 'ts'],
collectCoverageFrom: ['**/src/**/*.ts', "!**/node_modules/**"],
testEnvironment: 'node',
cacheDirectory: '../../.jest',
forceExit: true,
cache: true,
moduleDirectories: ['node_modules', '../node_modules'],
clearMocks: true,
resetModules: true,
detectOpenHandles: false,
restoreMocks: true,
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: '<rootDir>/' }),
transform: {
'^.+\\.(t|j)s$': [
'ts-jest',
{
astTransformers: {
before: [
'../../node_modules/tsconfig-paths-hook/transformer',
],
},
},
],
},
setupFilesAfterEnv: ['jest-extended/all', '<rootDir>/test/jest-setup.ts'],
};