forked from ls1intum/Artemis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
58 lines (56 loc) · 2.4 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
const esModules = ['ngx-treeview', 'lodash-es', 'franc-min', 'trigram-utils', 'n-gram', 'collapse-white-space'].join('|');
const {
compilerOptions: { paths = {}, baseUrl = './' },
} = require('./tsconfig.json');
const environment = require('./webpack/environment');
module.exports = {
globals: {
...environment,
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.html$',
isolatedModules: true,
diagnostics: {
ignoreCodes: [151001],
},
},
},
testRunner: "jest-jasmine2",
roots: ['<rootDir>', `<rootDir>/${baseUrl}`],
modulePaths: [`<rootDir>/${baseUrl}`],
setupFiles: ['jest-date-mock'],
cacheDirectory: '<rootDir>/build/jest-cache',
coverageDirectory: '<rootDir>/build/test-results/',
reporters: ['default', ['jest-junit', { outputDirectory: '<rootDir>/build/test-results/', outputName: 'TESTS-results-jest.xml' }]],
collectCoverageFrom: ['src/main/webapp/**/*.{js,jsx,ts,tsx}', '!src/main/webapp/**/*.module.{js,jsx,ts,tsx}'],
coverageThreshold: {
global: {
// TODO: in the future, the following values should be increase to at least 80%
statements: 76.8,
branches: 63.5,
functions: 67.5,
lines: 76.3,
},
},
setupFilesAfterEnv: ['<rootDir>/src/test/javascript/spec/jest-test-setup.ts', 'jest-sinon', 'jest-extended/all'],
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
modulePathIgnorePatterns: [],
testTimeout: 2000,
testMatch: [
'<rootDir>/src/test/javascript/spec/component/**/*.ts',
'<rootDir>/src/test/javascript/spec/directive/**/*.ts',
'<rootDir>/src/test/javascript/spec/integration/**/*.ts',
'<rootDir>/src/test/javascript/spec/pipe/**/*.ts',
'<rootDir>/src/test/javascript/spec/service/**/*.ts',
'<rootDir>/src/test/javascript/spec/util/**/*.ts',
],
moduleNameMapper: {
'^app/(.*)': '<rootDir>/src/main/webapp/app/$1',
'test/(.*)': '<rootDir>/src/test/javascript/spec/$1',
'@assets/(.*)': '<rootDir>/src/main/webapp/assets/$1',
'@core/(.*)': '<rootDir>/src/main/webapp/app/core/$1',
'@env': '<rootDir>/src/main/webapp/environments/environment',
'@src/(.*)': '<rootDir>/src/src/$1',
'@state/(.*)': '<rootDir>/src/app/state/$1',
},
};