-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
48 lines (44 loc) · 1.34 KB
/
jest.config.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
42
43
44
45
46
47
48
import type { JestConfigWithTsJest } from 'ts-jest';
import { pathsToModuleNameMapper } from 'ts-jest';
// In the following statement, replace `./tsconfig` with the path to your `tsconfig` file
// which contains the path mapping (ie the `compilerOptions.paths` option):
import { compilerOptions } from './tsconfig.json';
const jestConfig: JestConfigWithTsJest = {
// preset: 'ts-jest',
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
diagnostics: {
ignoreCodes: [1343],
},
astTransformers: {
before: [
{
path: 'ts-jest-mock-import-meta',
options: {
metaObjectReplacement: {
env: {
DEV: false,
TEST: true,
},
},
},
},
],
},
},
],
},
testEnvironment: 'jsdom',
roots: ['<rootDir>'],
modulePaths: [compilerOptions.baseUrl], // <-- This will be set to 'baseUrl' value
moduleNameMapper: {
...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
'^lodash-es$': 'lodash',
},
testPathIgnorePatterns: ['dist'],
setupFilesAfterEnv: ['./setupTests.ts'],
testMatch: [`**/__tests__/**/*.+(ts|tsx|js)`, `**/?(*.)+(spec|test).+(ts|tsx|js)`],
};
export default jestConfig;