An open API service indexing awesome lists of open source software.

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)

Awesome Lists containing this project

README

        

# Jest Module Name Mapper

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/sebastianmusial/jest-module-name-mapper/master/License)
[![npm version](https://img.shields.io/npm/v/jest-module-name-mapper.svg?style=flat)](https://www.npmjs.com/package/jest-module-name-mapper)
[![Build Status](https://travis-ci.com/sebastianmusial/jest-module-name-mapper.svg?branch=master)](https://travis-ci.com/sebastianmusial/jest-module-name-mapper)
[![codecov](https://codecov.io/gh/sebastianmusial/jest-module-name-mapper/branch/master/graph/badge.svg?token=Fsyuizk0Yl)](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ł


[email protected]


@sebamusial