Skip to content

Commit da7703e

Browse files
committed
🔧(jest) update jest configuration to resolve alias path
We also have to update our jest configuration to map aliased paths to the real path.
1 parent ae13c8b commit da7703e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ module.exports = {
22
coverageDirectory: '.coverage',
33
moduleDirectories: ['<rootDir>/src', 'node_modules'],
44
moduleFileExtensions: ['js', 'ts', 'tsx'],
5+
moduleNameMapper: {
6+
// Map aliases defined in tsconfig.json to the absolute path of the module
7+
'^:/(.*)$': '<rootDir>/src/$1',
8+
},
59
resolver: '<rootDir>/jest/resolver.js',
610
setupFilesAfterEnv: ['<rootDir>/jest/setup.js'],
711
testEnvironment: 'jsdom',

0 commit comments

Comments
 (0)