Last active
March 7, 2022 20:28
-
-
Save jonathas/b8962fadf419bc336ed9d1644d265267 to your computer and use it in GitHub Desktop.
moduleNameMapper mapping for Angular
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { pathsToModuleNameMapper } = require('ts-jest'); | |
| const { compilerOptions } = require('./tsconfig.json'); | |
| const moduleNameMapper = Object.keys(compilerOptions.paths).reduce((acc, curr) => { | |
| return { | |
| ...acc, | |
| [curr]: '<rootDir>' + compilerOptions.paths[curr] | |
| } | |
| }, {}) | |
| module.exports = { | |
| preset: 'jest-preset-angular', | |
| globalSetup: 'jest-preset-angular/global-setup', | |
| setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'], | |
| testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/dist/', '<rootDir>/cypress/', '<rootDir>/src/test.ts'], | |
| roots: ['<rootDir>'], | |
| modulePaths: [compilerOptions.baseUrl], | |
| moduleNameMapper, | |
| collectCoverage: true, | |
| coverageReporters: ['json', 'html', 'text', 'lcov'], | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment