eslint-config-jest-enzyme

raw JSON →
7.1.2 verified Sat Apr 25 auth: no javascript maintenance

ESLint shareable config for jest-environment-enzyme globals. Current version 7.1.2, released August 2020. This package is part of the enzyme-matchers monorepo from Formidable Labs. It defines Jest and Enzyme global variables (e.g., mount, shallow, render) to prevent ESLint warnings when using jest-environment-enzyme. Only useful in combination with that environment. Low maintenance cadence; no major changes after v7.0.0.

error Error: Cannot find module 'eslint-config-jest-enzyme'
cause Missing dependency.
fix
Run npm install eslint-config-jest-enzyme --save-dev
error Definition for rule 'jest-enzyme' was not found
cause Extending 'jest-enzyme' without also installing the jest-enzyme plugin.
fix
Install eslint-plugin-jest-enzyme or ensure the correct extends value.
breaking v7.0.0: toHaveTagName renamed to toHaveDisplayName
fix Replace all uses of toHaveTagName with toHaveDisplayName.
deprecated Package is in maintenance mode with no active development
fix Consider migrating to @testing-library/jest-dom or custom ESLint rules.
gotcha ESLint config only applies to test files ending in *.test.js
fix Ensure test files match the pattern or override overrides in config.
npm install eslint-config-jest-enzyme
yarn add eslint-config-jest-enzyme
pnpm add eslint-config-jest-enzyme

Configures ESLint to acknowledge jest-environment-enzyme globals like mount, shallow, render.

// .eslintrc.js
module.exports = {
  extends: ['jest-enzyme'],
  env: {
    'jest-enzyme/globals': true,
  },
  rules: {},
};