enhanced-resolve-jest
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published


Enhanced Resolve for Jest
API Stability TypeScript Styled with prettier Build status Test Coverage NPM Version Downloads

A better resolver for Jest using webpack's enhanced resolve.

Installation

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.

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

Custom resolver

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

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

Configure your resolver.js file:

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. By participating in this project you agree to abide by its terms.

Package Sidebar

Install

npm i enhanced-resolve-jest

Weekly Downloads

1,439

Version

1.1.0

License

MIT

Unpacked Size

10.3 kB

Total Files

9

Last publish

Collaborators

  • dylanpiercey