-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.base.ts
41 lines (37 loc) · 1.05 KB
/
jest.config.base.ts
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
import type { Config } from '@jest/types'
import { jsWithTsESM as preset } from 'ts-jest/presets'
import { pathsToModuleNameMapper } from 'ts-jest/utils'
import { compilerOptions } from './tsconfig.json'
/**
* @file Jest Base Configuration
* @see https://jestjs.io/docs/next/configuration
*/
const prefix = '<rootDir>/'
const config: Config.InitialOptions = {
...preset,
clearMocks: true,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.test.json',
useESM: true
}
},
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['js', 'json', 'ts'],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix }),
prettierPath: '<rootDir>/node_modules/prettier',
roots: [prefix.slice(0, prefix.length - 1)],
setupFilesAfterEnv: ['<rootDir>/__tests__/setup.ts'],
testPathIgnorePatterns: [
'__mocks__/',
'__tests__/__fixtures__/',
'__tests__/matchers.ts',
'__tests__/setup.ts',
'__tests__/utils.ts',
'dist/',
'node_modules/',
'(.*).d.ts'
],
verbose: true
}
export default config