-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
65 lines (53 loc) · 2.28 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('./tsconfig');
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
export default {
// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,
// https://joshtronic.com/2017/10/24/configuring-jest-to-show-code-coverage-for-all-of-your-files/
collectCoverageFrom: ['src/**/*.{js,ts}'],
// https://stackoverflow.com/questions/48813882/testing-typescript-interface-with-jest
coveragePathIgnorePatterns: [
"<rootDir>/src/logging/index\.ts",
"<rootDir>/src/persistence/mongodb\.ts",
"<rootDir>/src/persistence/entity/comment\.entity\.ts",
"<rootDir>/src/persistence/entity/site\.entity\.ts",
"<rootDir>/src/persistence/entity/user\.entity\.ts",
"<rootDir>/src/remark42/api/admin\.api\.ts",
"<rootDir>/src/remark42/api/image\.api\.ts",
"<rootDir>/src/remark42/api/store\.api\.ts",
"<rootDir>/src/web/controller/index\.ts",
"<rootDir>/src/web/jrpc/endpoint\.ts",
"<rootDir>/src/web/jrpc/request\.ts",
"<rootDir>/src/web/jrpc/response\.ts",
"<rootDir>/src/web/server/options\.ts",
"<rootDir>/src/index\.ts"
],
// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
// Indicates which provider should be used to instrument code for coverage
coverageProvider: "v8",
// A preset that is used as a base for Jest's configuration
preset: '@shelf/jest-mongodb',
// The test environment that will be used for testing
// testEnvironment: "jest-environment-node",
// The glob patterns Jest uses to detect test files
testMatch: [
"**/test/**/*.test.ts",
],
// A map from regular expressions to paths to transformers
transform: {
'^.+\\.ts?$': 'ts-jest',
},
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
transformIgnorePatterns: [
"\\\\node_modules\\\\",
"\\.pnp\\.[^\\\\]+$"
],
watchPathIgnorePatterns: ['globalConfig'],
// https://stackoverflow.com/questions/51080947/how-to-use-path-alias-in-a-react-project-with-typescript-jest
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' })
};