Cannot find module '/lib/utils/common' from 'src/test/resources/lib/utils/common.test.js'
1 | let convertDateFormatInReverse = require('/lib/utils/common');
| ^
2 |
3 | describe("common js file test", () => {
4 | test('test convertDateFormatInReverse', () => {
at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
at Object.<anonymous> (src/test/resources/lib/utils/common.test.js:1:62)
It seems the js files path using enonic is different in jest since it is basically for react or node js based projects, Is there any way to resolve this issue?
Not really. This is not a Enonic challenge though. This is a general Jest challenge. So you should be able to use the jest documentation to create a virtual module mock: