-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
44 lines (42 loc) · 1.11 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
import type { Config } from "jest";
/**
* Gets the default jest configuration for DevHouse Node backend projects
*
* @param {Options} [options] Jest config object. If you want to extend a default value, you can modify the returned object.
* @returns A jest config object
*/
export const getDefaultJestConfig = (options: Config) => ({
collectCoverage: true,
coverageDirectory: "<rootDir>/test-reports/coverage",
coverageReporters: ["lcov", "text-summary", "json-summary"],
moduleFileExtensions: ["ts", "js", "json", "node", "mjs"],
preset: "ts-jest",
reporters: [
"default",
[
"jest-junit",
{
suiteName: "Unit tests",
outputDirectory: "./test-reports",
outputName: "unit-tests.xml",
},
],
],
rootDir: "./",
transform: {
"^.+\\.m?(ts|js)$": "ts-jest",
},
...options,
});
export default getDefaultJestConfig({
collectCoverageFrom: ["<rootDir>/src/**/*.(ts|js)"],
coverageThreshold: {
global: {
branches: 50,
functions: 50,
lines: 50,
statements: 50,
},
},
testMatch: ["<rootDir>/tests/**/*.test.+(ts|js)"],
});