-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.mjs
59 lines (55 loc) · 1.52 KB
/
jest.config.mjs
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
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/en/configuration.html
*/
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const projectConfig = {
preset: 'ts-jest',
testEnvironment: 'node',
rootDir: process.cwd(),
moduleFileExtensions: ['js', 'json', 'ts'],
modulePathIgnorePatterns: ['<rootDir>/dist/', '__mocks__/index.ts'],
testPathIgnorePatterns: ['<rootDir>/dist/.*', '<rootDir>/dist/package.json'],
clearMocks: true,
moduleNameMapper: {
'@klarna/nest-lambda-microservice/(.*)': resolve(__dirname, 'src/$1'),
'@klarna/nest-lambda-microservice': resolve(__dirname, 'src'),
},
}
export default {
collectCoverage: true,
coverageDirectory: 'coverage',
coverageProvider: 'v8',
coverageReporters: ['json', 'lcov', 'clover'],
coverageThreshold: {
global: {
branches: 10,
functions: 10,
lines: 10,
statements: 10,
},
},
testPathIgnorePatterns: ['<rootDir>/dist/.*'],
watchman: true,
projects: [
{
displayName: {
name: 'unit',
color: 'red',
},
testMatch: ['<rootDir>/src/**/*.(test|spec).ts', '<rootDir>/src/**/__tests__/**/*.ts'],
...projectConfig,
},
{
displayName: {
name: 'integration',
color: 'blue',
},
testMatch: ['<rootDir>/test/**/*.(test|spec).ts'],
...projectConfig,
},
],
}