Registry / testing / eslint-plugin-jest

eslint-plugin-jest

JSON →
library29.15.2jsnpmunverified

ESLint plugin providing a comprehensive set of rules for Jest testing framework. Current stable version is 29.15.2 (April 2026). Active development with frequent releases (multiple per month). Key differentiators: official Jest community plugin, supports both flat and legacy ESLint configs, includes TypeScript support via optional peer dependency, offers aliased Jest globals and custom global package settings for use with other testing libraries (e.g., vitest, bun). Ships TypeScript type definitions.

npm install eslint-plugin-jest
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-JEST
E
eslint-plugin-jest
testingjavascriptv29.15.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
const pluginJest = require('eslint-plugin-jest')
import pluginJest from 'eslint-plugin-jest' (CJS default in flat config works, but ESM users need dynamic import)
CommonJS is the primary import style due to ESLint's CJS core. ESM users should use dynamic import or await import('eslint-plugin-jest').
flat/recommended
const jestPlugin = require('eslint-plugin-jest'); module.exports = [...jestPlugin.configs['flat/recommended']]
module.exports = ['plugin:jest/recommended'] (this is for legacy .eslintrc configs)
For flat config (eslint.config.js), use string key 'flat/recommended'. For legacy .eslintrc, use 'plugin:jest/recommended'.
environments
const { environments } = require('eslint-plugin-jest'); globals: environments.globals.globals
environments.globals (missing .globals access)
The environment object has a 'globals' property containing the globals map, and that map has a 'globals' key with the actual globals object.

Sets up eslint-plugin-jest with flat config, enabling three common rules on test files.

const jestPlugin = require('eslint-plugin-jest'); module.exports = [ { files: ['**/*.test.js', '**/*.spec.js'], plugins: { jest: jestPlugin }, languageOptions: { globals: jestPlugin.environments.globals.globals, }, rules: { 'jest/no-disabled-tests': 'warn', 'jest/no-focused-tests': 'error', 'jest/no-identical-title': 'error', }, }, ];
Debug
Known issues
breakingESLint v9+ requires flat config; legacy .eslintrc config is deprecated.
fix
Migrate to eslint.config.js using flat config format. See README for examples.
affects: >=29.0.0
gotchaTypeScript peer dependency is optional but required for TypeScript-specific rules (e.g., valid-describe-callback).
fix
Install typescript as a devDependency if using TypeScript rules: npm install --save-dev typescript.
affects: >=29.12.2
deprecatedThe 'globalAliases' setting in legacy config is deprecated in favor of 'settings.jest.globalAliases'.
fix
Use settings.jest.globalAliases instead of top-level globalAliases.
affects: >=28.0.0
gotchaRules only apply to test files; including them in top-level config will lint source files.
fix
Always scope the plugin's rules to test file patterns using 'files' in flat config or 'overrides' in legacy config.
affects: all
breakingPlugin no longer auto-enables globals; must explicitly set languageOptions.globals in flat config.
fix
Add globals: jestPlugin.environments.globals.globals to your flat config's languageOptions.
affects: >=29.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'jest': Cannot find module 'eslint-plugin-jest'
Missing or incorrect installation of the plugin.
fix
Run 'npm install eslint-plugin-jest --save-dev' to install it.
Configuration for rule 'jest/no-disabled-tests' is invalid: Value "warn" is invalid.
Using 'warn' in flat config; flat config requires severity numbers or 'error'/'warn' as strings but only in certain contexts.
fix
Use 'warn' (string) is actually allowed, but ensure you're not using a number like 1. If using shared configs, they may map to numbers. Use 'warn' or 'error' as strings.
ESLint couldn't find the config 'plugin:jest/recommended'.
Trying to use 'plugin:jest/recommended' in flat config (eslint.config.js).
fix
In flat config, use jestPlugin.configs['flat/recommended'] instead of the string 'plugin:jest/recommended'.
Parsing error: The keyword 'const' is reserved
Using ES6 syntax in a file that ESLint's parser doesn't recognize as modern JavaScript (e.g., .eslintrc.json doesn't support it).
fix
Use CommonJS require syntax or ensure your config file is .js and uses module.exports.
TypeError: jestPlugin.environments.globals is not a function
Assuming environments.globals() is a function when it's an object.
fix
Access as jestPlugin.environments.globals.globals (property access).
Upgrade
Version history
29.15.2latest on npm
Audit
Dependencies
@typescript-eslint/eslint-pluginoptionalRequired for TypeScript-aware rules
eslintrequiredCore peer dependency for ESLint integration
jestoptionalExpected testing framework - plugin provides rules for Jest syntax
typescriptoptionalOptional peer dependency for TypeScript support (>=4.8.4 <7.0.0)
Agent activity
5 hits · last 30 days
node
4
Resources
eslint-plugin-jest — npm install eslint-plugin-jest · libregistry