# enhanced-resolve-jest

> Resolver for Jest which uses the enhanced-resolve module

Latest version **1.1.0** (published 2020-08-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install enhanced-resolve-jest
pnpm add enhanced-resolve-jest
yarn add enhanced-resolve-jest
bun add enhanced-resolve-jest
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-08-03 |
| First published | 2019-06-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dylan Piercey |
| Maintainers | dylanpiercey |
| Keywords | jest, resolver, resolve, webpack, enhanced, module, browser |

## Links

- npm: https://www.npmjs.com/package/enhanced-resolve-jest
- Repository: https://github.com/mlrawlings/enhanced-resolve-jest
- Issues: https://github.com/mlrawlings/enhanced-resolve-jest/issues
- npm.io page: https://npm.io/package/enhanced-resolve-jest

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^1.10.0
- [enhanced-resolve](https://npm.io/package/enhanced-resolve.md) ^4.1.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2020-08-03
- 1.0.2 — 2019-07-13
- 1.0.1 — 2019-06-24
- 1.0.0 — 2019-06-18

## README

<h1 align="center">
  <!-- Logo -->
  <br/>
  Enhanced Resolve for Jest
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg" alt="API Stability"/>
  </a>
  <!-- Language -->
  <a href="http://typescriptlang.org">
    <img src="https://img.shields.io/badge/%3C%2F%3E-typescript-blue.svg" alt="TypeScript"/>
  </a>
  <!-- Format -->
  <a href="https://github.com/prettier/prettier">
    <img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="Styled with prettier"/>
  </a>
  <!-- CI -->
  <a href="https://travis-ci.org/mlrawlings/enhanced-resolve-jest">
  <img src="https://img.shields.io/travis/mlrawlings/enhanced-resolve-jest.svg" alt="Build status"/>
  </a>
  <!-- Coverage -->
  <a href="https://coveralls.io/github/mlrawlings/enhanced-resolve-jest">
    <img src="https://img.shields.io/coveralls/mlrawlings/enhanced-resolve-jest.svg" alt="Test Coverage"/>
  </a>
  <!-- NPM Version -->
  <a href="https://npmjs.org/package/enhanced-resolve-jest">
    <img src="https://img.shields.io/npm/v/enhanced-resolve-jest.svg" alt="NPM Version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/enhanced-resolve-jest">
    <img src="https://img.shields.io/npm/dm/enhanced-resolve-jest.svg" alt="Downloads"/>
  </a>
</h1>

A better `resolver` for Jest using [webpack's enhanced resolve](https://github.com/webpack/enhanced-resolve).

# Installation

```console
npm install enhanced-resolve-jest
```

# Example

### Default configuration

This module exposes a resolver that will map your jest config to a compatible enhanced resolver, forwarding options like the extensions, browser target, etc.

```json
{
  "resolver": "enhanced-resolve-jest"
}
```

### Custom resolver

You can also extend this resolver to provide additional options to the enhanced-resolve module.

```json
{
  "resolver": "./resolver.js"
}
```

Configure your `resolver.js` file:

```js
const { create, getDefaultConfig } = require("enhanced-resolve-jest");

module.exports = create(jestConfig => {
  // Expected to return all options for
  // https://github.com/webpack/enhanced-resolve#resolver-options

  // You can get a config with the same options as the default resolver like so.
  const baseConfig = getDefaultConfig(jestConfig);

  // And modify it to make it your own.
  baseConfig.aliasFields = ["custom-alias"];

  return baseConfig;
});
```

## Code of Conduct

This project adheres to the [eBay Code of Conduct](./.github/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.

---
_Source: https://npm.io/package/enhanced-resolve-jest · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
