Skip to content

Commit b688d2f

Browse files
authored
test: support import aliases (#660)
1 parent b26b56b commit b688d2f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
const {pathsToModuleNameMapper} = require('ts-jest');
2+
const {compilerOptions} = require('./tsconfig.json');
3+
14
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
25
// eslint-disable-next-line no-undef
36
module.exports = {
@@ -6,6 +9,7 @@ module.exports = {
69
testPathIgnorePatterns: ['spec.js', 'spec.ts'],
710
setupFilesAfterEnv: ['<rootDir>tests/setup.ts'],
811
moduleNameMapper: {
12+
...pathsToModuleNameMapper(compilerOptions.paths, {prefix: '<rootDir>/'}),
913
'\\.(css|less|scss|sss|styl)$': '<rootDir>/node_modules/jest-css-modules',
1014
'.+\\.(svg|png|jpg)$': 'identity-obj-proxy',
1115
},

0 commit comments

Comments
 (0)