Skip to content

Commit

Permalink
fix: update moduleNameMapper jest config to recognize .js files
Browse files Browse the repository at this point in the history
the "cannot find module *.js from *.spec.ts" is a known Typescript
+ Node + Jest combination issue.

Refer the following for more info:
https://stackoverflow.com/questions/73735202/typescript-jest-imports-with-js-extension-cause-error-cannot-find-module
kulshekhar/ts-jest#1057 (comment)
  • Loading branch information
9akashnp8 committed Sep 27, 2023
1 parent 8ef1190 commit 4fb0415
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ export default {
'!<rootDir>/src/**/*.spec.ts',
'!<rootDir>/src/**/*.test.ts',
'!<rootDir>/src/**/*.d.ts'
]
],
moduleNameMapper: {
'(.+)\\.js': '$1'
},
};

0 comments on commit 4fb0415

Please sign in to comment.