forked from scaljeri/oh-my-mock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
50 lines (47 loc) · 1.44 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
const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('./tsconfig');
const esModules = ['@angular'];
module.exports = {
preset: 'jest-preset-angular',
roots: ['<rootDir>/src/'],
globalSetup: 'jest-preset-angular/global-setup',
testMatch: ['**/+(*.)+(spec).+(ts)'],
setupFilesAfterEnv: ['<rootDir>/src/test.ts'],
// preset: 'jest-preset-angular/presets/defaults-esm',
extensionsToTreatAsEsm: ['.ts'],
testEnvironment: 'jsdom',
collectCoverage: true,
coverageReporters: ['html'],
coverageDirectory: 'coverage/app',
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths || {}, {
prefix: '<rootDir>/'
}),
// transform: {
// '^.+\\.(ts|js|html|svg)$': 'ts-jest'
// },
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular'
},
moduleFileExtensions: ['ts', 'js', 'html', 'svg'],
globals: {
'ts-jest': {
useESM: true // ts-jest
}
},
transformIgnorePatterns: [
`<rootDir>/node_modules/(?!.*\\.mjs$|${esModules.join('|')})` // jest-preset-angular
],
// moduleNameMapper: {
// "@shared(.*)": "<rootDir>/src/shared/$1"
// },
moduleFileExtensions: ['ts', 'js', 'html', 'svg']
// moduleDirectories: ['node_modules', 'src']
// extensionsToTreatAsEsm: ['.ts'],
// globals: {
// 'ts-jest': {
// tsconfig: '<rootDir>/tsconfig.spec.json',
// stringifyContentPathRegex: '\\.html$',
// useESM: true,
// },
// }
};