Skip to content

Commit

Permalink
feat: add trailing js pattern to pathsToModuleNameMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
jjangga0214 committed Sep 4, 2022
1 parent 9019b05 commit b9e977c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/config/paths-to-module-name-mapper.spec.ts
Expand Up @@ -62,6 +62,7 @@ describe('pathsToModuleNameMapper', () => {
'^@foo\\-bar/common$': '../common/dist/library',
'^@pkg/(.*)\\.js$': './packages/$1',
'^@pkg/(.*)$': './packages/$1',
'^(\\.{1,2}/.*)\\.js$': '$1',
})
})

Expand Down
4 changes: 4 additions & 0 deletions src/config/paths-to-module-name-mapper.ts
Expand Up @@ -58,5 +58,9 @@ export const pathsToModuleNameMapper = (
}
}

if (removeJsExtension) {
jestMap['^(\\.{1,2}/.*)\\.js$'] = '$1'
}

return jestMap
}

0 comments on commit b9e977c

Please sign in to comment.