https://github.com/sebastianmusial/jest-module-name-mapper
:shoe: Synchronization tsconfig paths with Jest (module name mapper)
https://github.com/sebastianmusial/jest-module-name-mapper
aliases jest jest-plugin module-name-mapper path-alias tsconfig tsconfig-paths
Last synced: 19 days ago
JSON representation
:shoe: Synchronization tsconfig paths with Jest (module name mapper)
- Host: GitHub
- URL: https://github.com/sebastianmusial/jest-module-name-mapper
- Owner: sebastianmusial
- License: mit
- Created: 2019-01-08T10:28:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-14T18:48:50.000Z (almost 5 years ago)
- Last Synced: 2025-03-28T08:41:33.332Z (about 1 month ago)
- Topics: aliases, jest, jest-plugin, module-name-mapper, path-alias, tsconfig, tsconfig-paths
- Language: TypeScript
- Homepage:
- Size: 547 KB
- Stars: 19
- Watchers: 0
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: License
Awesome Lists containing this project
README
# Jest Module Name Mapper
[](https://raw.githubusercontent.com/sebastianmusial/jest-module-name-mapper/master/License)
[](https://www.npmjs.com/package/jest-module-name-mapper)
[](https://travis-ci.com/sebastianmusial/jest-module-name-mapper)
[](https://codecov.io/gh/sebastianmusial/jest-module-name-mapper)Use this to avoid the declaration of the same module path aliases in `tsconfig.json` and `jest.config.js`.
The package allows synchronizing Jest path aliases (`moduleNameMapper`) with your `tsconfig.json` configuration.## Installation
`npm i jest-module-name-mapper -D`
## Usage
Set configuration in `jest.config.js`:
```
module.exports = {
...
moduleNameMapper: require('jest-module-name-mapper')(),
};
```If your `tsconfig.json` file is located in other directory then root, then you can set your own path to the file.
```
module.exports = {
...
moduleNameMapper: require('jest-module-name-mapper')('/src/tsconfig.json'),
};
```## Author
Sebastian Musiał