Skip to content

mlrawlings/enhanced-resolve-jest

Repository files navigation


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.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published