-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathjest.config.ts
32 lines (29 loc) · 871 Bytes
/
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
import { pathsToModuleNameMapper } from 'ts-jest';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { compilerOptions } = require('./tsconfig.json');
const EXCLUDE_PATHS = new Set(['class-transformer/cjs/storage']);
module.exports = {
clearMocks: true,
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/?(*.)+(spec|test).+(ts|tsx|js)',
],
transform: {
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
diagnostics: { warnOnly: process.env.NODE_ENV === 'development' },
},
],
},
modulePaths: [compilerOptions.baseUrl],
moduleNameMapper: pathsToModuleNameMapper(
Object.fromEntries(
Object.entries(compilerOptions.paths).filter(
(e): e is [string, string[]] => !EXCLUDE_PATHS.has(e[0]),
),
),
),
setupFiles: ['./test/setup.ts'],
setupFilesAfterEnv: ['jest-extended/all'],
};