generated from obetancourthunicah/express-ts-sw-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjest.config.js
59 lines (59 loc) · 1.6 KB
/
jest.config.js
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
49
50
51
52
53
54
55
56
57
58
59
const {compilerOptions} = require('./tsconfig.json');
const {pathsToModuleNameMapper} = require('ts-jest');
const path = require('path');
const rootDirector = path.resolve(__dirname);
const paths = pathsToModuleNameMapper(compilerOptions.paths, {prefix: '<rootDir>/'});
const mongoPreset = require('@shelf/jest-mongodb/jest-preset');
const tsPreset = require('ts-jest/jest-preset');
console.log('paths', paths);
module.exports ={...mongoPreset, ...tsPreset, ...{
verbose: true,
clearMocks: true,
collectCoverage: true,
coverageDirectory: 'coverage',
coverageProvider: 'v8',
coverageThreshold: {
global: {
branches: 70,
function: 80,
lines: 80,
statements: 80,
},
},
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
...paths,
},
reporters: [
'default',
[
path.resolve(__dirname, 'node_modules', 'jest-html-reporter'),
{
pageTitle: 'Demo test Report',
outputPath: 'test-report.html',
},
],
],
rootDir: rootDirector,
roots: [rootDirector],
setupFiles:[
'dotenv/config',
],
setupFilesAfterEnv: [`${rootDirector}/__tests__/setup.js`],
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/build',
`${rootDirector}/__tests__/fixtures`,
`${rootDirector}/__tests__/setup.js`,
],
transform: {
'^.+\\.ts$': [
'ts-jest', {
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
},
],
},
testRegex: ['((/__tests__/.*)|(\\.|/)(test|spec))\\.tsx?$'],
watchPathIgnorePatterns: ['globalConfig'],
}};