Registry / testing / eslint-import-resolver-jest

eslint-import-resolver-jest

JSON →
library3.0.2jsnpmunverified

An ESLint resolver for eslint-plugin-import that resolves imports according to Jest's moduleNameMapper configuration. Version 3.0.2 is current stable (as of early 2025). Release cadence is irregular. It reads Jest config from package.json or a specified config file, enabling ESLint to understand aliased imports used in test files. Alternative to manual resolution override; integrates directly with eslint-plugin-import.

npm install eslint-import-resolver-jest
INSTALL
IMPORT
SIG · ESLINT-IMPORT-RESO
E
eslint-import-resolver-jest
testingjavascriptv3.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default resolver
// In .eslintrc{"settings":{"import/resolver":{"jest":true}}}
import resolver from 'eslint-import-resolver-jest'
Plugin is used as an ESLint resolver, not imported in code.
JestResolverOptions
import type { JestResolverOptions } from 'eslint-import-resolver-jest'
const JestResolverOptions = require('eslint-import-resolver-jest')
TypeScript type only; available since v3 for configuring options.
config via .eslintrc
{"settings":{"import/resolver":{"jest":{"jestConfigFile":"./jest.config.js"}}}}
{"settings":{"import/resolver":{"jest":{"config":"./jest.config.js"}}}}
Use 'jestConfigFile', not 'config'.

Configures ESLint to resolve imports using Jest's moduleNameMapper by pointing to a separate Jest config file.

// .eslintrc { "settings": { "import/resolver": { "jest": { "jestConfigFile": "./jest.config.js" } } } }
Debug
Known issues
gotchaResolved versions prior to 3.0.0 did not respect the Jest config file's '__esModule' option, leading to incorrect resolution.
fix
Upgrade to v3.0.0 or later.
affects: <3.0.0
gotchaIf no jestConfigFile is specified, the resolver looks for a 'jest' key in package.json. It does NOT support jest.config.js or jest.config.ts by default.
fix
Explicitly set 'jestConfigFile' to your Jest config file path.
affects: >=1.0.0
deprecatedThe resolver uses 'testRegex' and 'testMatch' from Jest config; if those are missing, it may resolve all files incorrectly.
fix
Ensure Jest config includes testRegex or testMatch.
affects: >=1.0.0
breakingVersion 2.x changed the default behavior to require explicit 'jestConfigFile' if not using package.json config.
fix
Update .eslintrc to include 'jestConfigFile' if you were relying on auto-detection from v1.
affects: >=2.0.0
Errors
Common errors & fixes
Unable to resolve path to module 'utils/helper'.
Jest moduleNameMapper maps 'utils/helper' to '<rootDir>/src/utils/helper', but ESLint doesn't know about that mapping without this resolver.
fix
Install eslint-import-resolver-jest and configure in .eslintrc settings as shown in quickstart.
Settings: Unknown resolver 'jest'.
The resolver package is not installed or not listed in dependencies.
fix
Run: npm install eslint-import-resolver-jest --save-dev
Upgrade
Version history
3.0.2latest on npm
Audit
Dependencies
eslint-plugin-importrequiredPeer dependency that supplies the import resolution hooks
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-import-resolver-jest — npm install eslint-import-resolver-jest · libregistry