enhanced-resolve-jest
v1.1.0
Published
Resolver for Jest which uses the enhanced-resolve module
Downloads
8,579
Maintainers
Readme
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.