-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.ts
More file actions
29 lines (26 loc) · 981 Bytes
/
jest.config.ts
File metadata and controls
29 lines (26 loc) · 981 Bytes
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
import type { Config } from 'jest';
import { pathsToModuleNameMapper } from 'ts-jest';
import fs from "fs";
import json from "json5";
const compilerOptions = json.parse(fs.readFileSync('./tsconfig.json').toString()).compilerOptions
const config: Config = {
setupFilesAfterEnv: ['<rootDir>/test/bootstrap.js'],
preset: 'ts-jest',
testEnvironment: 'node',
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{ tsconfig: './tsconfig.json' }
]
},
roots: ['<rootDir>/src', '<rootDir>/test'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleDirectories: ['node_modules', 'src'],
coverageReporters: ['html', 'text', 'text-summary', 'cobertura', 'clover', 'lcov'],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths || {}, { prefix: '<rootDir>/' }),
testMatch: [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[tj]s?(x)"
],
};
export default config;