-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathjest.conf.js
53 lines (48 loc) · 2.25 KB
/
jest.conf.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
const { pathsToModuleNameMapper } = require('ts-jest');
// const { compilerOptions } = require('./tsconfig')
const {
compilerOptions: { paths = {}, baseUrl = './' },
} = require('./tsconfig.json');
const environment = require('./webpack/environment');
module.exports = {
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$|dayjs/esm|export-to-csv/output/)'],
resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',
// preset: 'jest-preset-angular/presets/defaults-esm',
preset: 'jest-preset-angular',
testEnvironment: 'jsdom',
globals: {
...environment,
},
roots: ['<rootDir>', `<rootDir>/${baseUrl}`],
modulePaths: [`<rootDir>/${baseUrl}`],
setupFiles: ['jest-date-mock'],
setupFilesAfterEnv: [`<rootDir>/${baseUrl}__tests__/setup.ts`],
cacheDirectory: '<rootDir>/target/jest-cache',
coverageDirectory: '<rootDir>/target/test-results/',
moduleNameMapper: Object.assign(
pathsToModuleNameMapper(paths, { prefix: `<rootDir>/${baseUrl}/` }),
{ '^uuid$': 'uuid' },
{ '\\.(scss|css|less)$': '<rootDir>/__mocks__/styleMock.js' },
{ 'export-to-csv': '<rootDir>/__mocks__/exportCsvMock.js' },
),
reporters: ['default', ['jest-junit', { outputDirectory: '<rootDir>/target/test-results/', outputName: 'TESTS-results-jest.xml' }]],
testResultsProcessor: 'jest-sonar-reporter',
testMatch: ['<rootDir>/src/main/webapp/app/**/@(*.)@(spec.ts)'],
// testURL: 'http://localhost/',
/* transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$|dayjs/esm)'],
resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',
globals: {
...environment,
},
roots: ['<rootDir>', `<rootDir>/${baseUrl}`],
modulePaths: [`<rootDir>/${baseUrl}`],
setupFiles: ['jest-date-mock'],
setupFilesAfterEnv: [`<rootDir>/${baseUrl}__tests__/setup.ts`],
cacheDirectory: '<rootDir>/target/jest-cache',
coverageDirectory: '<rootDir>/target/test-results/',
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: `<rootDir>/${baseUrl}/` }),
reporters: ['default', ['jest-junit', { outputDirectory: '<rootDir>/target/test-results/', outputName: 'TESTS-results-jest.xml' }]],
testResultsProcessor: 'jest-sonar-reporter',*/
// testMatch: ['<rootDir>/src/main/webapp/app/**/@(*.)@(spec.ts)'],
// testURL: 'http://localhost/',
};