-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.js
68 lines (68 loc) · 2.49 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
60
61
62
63
64
65
66
67
68
module.exports = {
runner: 'tsc',
testEnvironment: 'node',
displayName: {
name: 'CalamusApi',
color: 'yellow',
},
moduleFileExtensions: ['ts', 'js'],
preset: '@shelf/jest-mongodb',
// testEnvironment: "node",
testMatch: [
'<rootDir>/__tests__/**/*.{js,ts,tsx,jsx,mjs}',
'<rootDir>/?(*.)(spec|test).{js,jsx,ts,tsx,mjs}',
'<rootDir>/src/**/__tests__/**/*.{js,ts,tsx,jsx,mjs}',
'<rootDir>/src/**/?(*.)(spec|test).{js,ts,tsx,jsx,mjs}',
],
setupFiles: ['<rootDir>/scripts/mongodb.mock.js', '<rootDir>/scripts/setup-tests.ts'],
collectCoverageFrom: ['<rootDir>/src/**/*.ts', '!**/node_modules/**'],
coveragePathIgnorePatterns: [
'/node_modules/',
'<rootDir>/src/app.ts',
'<rootDir>/src/types',
'<rootDir>/src/config.ts',
'<rootDir>/src/server.ts',
'<rootDir>/src/database/index.ts',
'<rootDir>/src/database/repository/([A-Za-z]+)/([A-Za-z]*Model.ts)',
'<rootDir>/src/core/logger.ts',
'<rootDir>/src/core/ApiError.ts',
'<rootDir>/src/core/ApiResponse.ts',
'<rootDir>/src/core/jwt/mock.ts',
'<rootDir>/src/core/jwt/exceptions.ts',
'<rootDir>/src/security/([A-Za-z]+)/mock.ts',
'<rootDir>/src/routes/([A-Za-z]+)/mock.ts',
'<rootDir>/src/routes/auth/([A-Za-z]+)/mock.ts',
'<rootDir>/src/routes/([A-Za-z]+)/schema.ts',
'<rootDir>/src/routes/([A-Za-z]+)/([A-Za-z]+)/schema.ts',
'<rootDir>/src/routes/index.ts',
'<rootDir>/src/utils/',
'<rootDir>/src/security/schema.ts',
],
// TODO: setup coverageThreshold once bug on testing has been fixed
// coverageThreshold: {
// global: {
// lines: 90,
// statements: 90,
// },
// },
transform: {
'^.+\\.ts$': 'ts-jest',
},
moduleNameMapper: {
'^@app': '<rootDir>/src/app.ts',
'^@config': '<rootDir>/src/config.ts',
'^@database': '<rootDir>/src/database',
'^@database/(.*)$': '<rootDir>/src/database/$1',
'^@repository/(.*)$': '<rootDir>/src/database/repository/$1',
'^@core/(.*)$': '<rootDir>/src/core/$1',
'^@jwt': '<rootDir>/src/core/jwt/JWT.ts',
'^@logger': '<rootDir>/src/core/logger.ts',
'^@routes': '<rootDir>/src/routes/index.ts',
'^@security/(.*)$': '<rootDir>/src/security/$1',
'^@authentication/(.*)$': '<rootDir>/src/security/authentication/$1',
'^@authorization/(.*)$': '<rootDir>/src/security/authorization/$1',
'^@authUtils': '<rootDir>/src/security/authUtils/index.ts',
'^@utils/(.*)$': '<rootDir>/src/utils/$1',
'app-request': '<rootDir>/src/types/app-request.d.ts',
},
};