Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

eslint-plugin-jest

jest-community54.4mMIT28.11.0TypeScript support: included

ESLint rules for Jest

eslint, eslintplugin, eslint-plugin

readme

eslint-plugin-jest

ESLint plugin for Jest

Actions Status

Installation

yarn add --dev eslint eslint-plugin-jest

Note: If you installed ESLint globally then you must also install eslint-plugin-jest globally.

Usage

If you're using flat configuration:

With flat configuration, just import the plugin and away you go:

const pluginJest = require('eslint-plugin-jest');

module.exports = [
  {
    // update this to match your test files
    files: ['**/*.spec.js', '**/*.test.js'],
    plugins: { jest: pluginJest },
    languageOptions: {
      globals: pluginJest.environments.globals.globals,
    },
    rules: {
      'jest/no-disabled-tests': 'warn',
      'jest/no-focused-tests': 'error',
      'jest/no-identical-title': 'error',
      'jest/prefer-to-have-length': 'warn',
      'jest/valid-expect': 'error',
    },
  },
];

With legacy configuration, add jest to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["jest"],
  "env": {
    "jest/globals": true
  },
  "rules": {
    "jest/no-disabled-tests": "warn",
    "jest/no-focused-tests": "error",
    "jest/no-identical-title": "error",
    "jest/prefer-to-have-length": "warn",
    "jest/valid-expect": "error"
  }
}

[!NOTE]

You only need to explicitly include our globals if you're not using one of our shared configs

Aliased Jest globals

You can tell this plugin about any global Jests you have aliased using the globalAliases setting:

{
  "settings": {
    "jest": {
      "globalAliases": {
        "describe": ["context"],
        "fdescribe": ["fcontext"],
        "xdescribe": ["xcontext"]
      }
    }
  }
}

Aliased @jest/globals

You can tell this plugin to treat a different package as the source of Jest globals using the globalPackage setting:

{
  "settings": {
    "jest": {
      "globalPackage": "bun:test"
    }
  }
}

[!WARNING]

While this can be used to apply rules when using alternative testing libraries and frameworks like bun, vitest and node, there's no guarantee the semantics this plugin assumes will hold outside of Jest

The rules provided by this plugin assume that the files they are checking are test-related. This means it's generally not suitable to include them in your top-level configuration as that applies to all files being linted which can include source files.

For .eslintrc configs you can use overrides to have ESLint apply additional rules to specific files:

{
  "extends": ["eslint:recommended"],
  "overrides": [
    {
      "files": ["test/**"],
      "plugins": ["jest"],
      "extends": ["plugin:jest/recommended"],
      "rules": { "jest/prefer-expect-assertions": "off" }
    }
  ],
  "rules": {
    "indent": ["error", 2]
  }
}

For eslint.config.js you can use files and ignores:

const jest = require('eslint-plugin-jest');

module.exports = [
  ...require('@eslint/js').configs.recommended,
  {
    files: ['test/**'],
    ...jest.configs['flat/recommended'],
    rules: {
      ...jest.configs['flat/recommended'].rules,
      'jest/prefer-expect-assertions': 'off',
    },
  },
  // you can also configure jest rules in other objects, so long as some of the `files` match
  {
    files: ['test/**'],
    rules: { 'jest/prefer-expect-assertions': 'off' },
  },
];

Jest version setting

The behaviour of some rules (specifically no-deprecated-functions) change depending on the version of Jest being used.

By default, this plugin will attempt to determine to locate Jest using require.resolve, meaning it will start looking in the closest node_modules folder to the file being linted and work its way up.

Since we cache the automatically determined version, if you're linting sub-folders that have different versions of Jest, you may find that the wrong version of Jest is considered when linting. You can work around this by providing the Jest version explicitly in nested ESLint configs:

{
  "settings": {
    "jest": {
      "version": 27
    }
  }
}

To avoid hard-coding a number, you can also fetch it from the installed version of Jest if you use a JavaScript config file such as .eslintrc.js:

module.exports = {
  settings: {
    jest: {
      version: require('jest/package.json').version,
    },
  },
};

Shareable configurations

[!NOTE]

eslint.config.js compatible versions of configs are available prefixed with flat/ and may be subject to small breaking changes while ESLint v9 is being finalized.

This plugin exports a recommended configuration that enforces good testing practices.

To enable this configuration with .eslintrc, use the extends property:

{
  "extends": ["plugin:jest/recommended"]
}

To enable this configuration with eslint.config.js, use jest.configs['flat/recommended']:

const jest = require('eslint-plugin-jest');

module.exports = [
  {
    files: [
      /* glob matching your test files */
    ],
    ...jest.configs['flat/recommended'],
  },
];

Style

This plugin also exports a configuration named style, which adds some stylistic rules, such as prefer-to-be-null, which enforces usage of toBeNull over toBe(null).

To enable this configuration use the extends property in your .eslintrc config file:

{
  "extends": ["plugin:jest/style"]
}

To enable this configuration with eslint.config.js, use jest.configs['flat/style']:

const jest = require('eslint-plugin-jest');

module.exports = [
  {
    files: [
      /* glob matching your test files */
    ],
    ...jest.configs['flat/style'],
  },
];

All

If you want to enable all rules instead of only some you can do so by adding the all configuration to your .eslintrc config file:

{
  "extends": ["plugin:jest/all"]
}

To enable this configuration with eslint.config.js, use jest.configs['flat/all']:

const jest = require('eslint-plugin-jest');

module.exports = [
  {
    files: [
      /* glob matching your test files */
    ],
    ...jest.configs['flat/all'],
  },
];

While the recommended and style configurations only change in major versions the all configuration may change in any release and is thus unsuited for installations requiring long-term consistency.

Rules

💼 Configurations enabled in.\ ⚠️ Configurations set to warn in.\ ✅ Set in the recommended configuration.\ 🎨 Set in the style configuration.\ 🔧 Automatically fixable by the --fix CLI option.\ 💡 Manually fixable by editor suggestions.

Name Description 💼 ⚠️ 🔧 💡
consistent-test-it Enforce test and it usage conventions | 🔧
expect-expect Enforce assertion to be made in a test body | ✅ |
max-expects Enforces a maximum number assertion calls in a test body | |
max-nested-describe Enforces a maximum depth to nested describe calls | |
no-alias-methods Disallow alias methods 🎨 🔧
no-commented-out-tests Disallow commented out tests | ✅ |
no-conditional-expect Disallow calling expect conditionally |
no-conditional-in-test Disallow conditional logic in tests | |
no-confusing-set-timeout Disallow confusing usages of jest.setTimeout | |
no-deprecated-functions Disallow use of deprecated functions | 🔧
no-disabled-tests Disallow disabled tests | ✅ |
no-done-callback Disallow using a callback in asynchronous tests and hooks | 💡
no-duplicate-hooks Disallow duplicate setup and teardown hooks | |
no-export Disallow using exports in files containing tests |
no-focused-tests Disallow focused tests | 💡
no-hooks Disallow setup and teardown hooks | |
no-identical-title Disallow identical titles |
no-interpolation-in-snapshots Disallow string interpolation inside snapshots |
no-jasmine-globals Disallow Jasmine globals | 🔧
no-large-snapshots Disallow large snapshots | |
no-mocks-import Disallow manually importing from __mocks__ |
no-restricted-jest-methods Disallow specific jest. methods | |
no-restricted-matchers Disallow specific matchers & modifiers | |
no-standalone-expect Disallow using expect outside of it or test blocks |
no-test-prefixes Require using .only and .skip over f and x | 🔧
no-test-return-statement Disallow explicitly returning from tests | |
no-untyped-mock-factory Disallow using jest.mock() factories without an explicit type parameter | 🔧
padding-around-after-all-blocks Enforce padding around afterAll blocks | 🔧
padding-around-after-each-blocks Enforce padding around afterEach blocks | 🔧
padding-around-all Enforce padding around Jest functions | 🔧
padding-around-before-all-blocks Enforce padding around beforeAll blocks | 🔧
padding-around-before-each-blocks Enforce padding around beforeEach blocks | 🔧
padding-around-describe-blocks Enforce padding around describe blocks | 🔧
padding-around-expect-groups Enforce padding around expect groups | 🔧
padding-around-test-blocks Enforce padding around test and it blocks | 🔧
prefer-called-with Suggest using toBeCalledWith() or toHaveBeenCalledWith() | |
prefer-comparison-matcher Suggest using the built-in comparison matchers | 🔧
prefer-each Prefer using .each rather than manual loops | |
prefer-equality-matcher Suggest using the built-in equality matchers | | 💡
prefer-expect-assertions Suggest using expect.assertions() OR expect.hasAssertions() | | 💡
prefer-expect-resolves Prefer await expect(...).resolves over expect(await ...) syntax | 🔧
prefer-hooks-in-order Prefer having hooks in a consistent order | |
prefer-hooks-on-top Suggest having hooks before any test cases | |
prefer-importing-jest-globals Prefer importing Jest globals | 🔧
prefer-jest-mocked Prefer jest.mocked() over fn as jest.Mock | 🔧
prefer-lowercase-title Enforce lowercase test names | 🔧
prefer-mock-promise-shorthand Prefer mock resolved/rejected shorthands for promises | 🔧
prefer-snapshot-hint Prefer including a hint with external snapshots | |
prefer-spy-on Suggest using jest.spyOn() | 🔧
prefer-strict-equal Suggest using toStrictEqual() | | 💡
prefer-to-be Suggest using toBe() for primitive literals 🎨 | 🔧
prefer-to-contain Suggest using toContain() 🎨 | 🔧
prefer-to-have-length Suggest using toHaveLength() 🎨 | 🔧
prefer-todo Suggest using test.todo | 🔧
require-hook Require setup and teardown code to be within a hook | |
require-to-throw-message Require a message for toThrow() | |
require-top-level-describe Require test cases and hooks to be inside a describe block | |
valid-describe-callback Enforce valid describe() callback |
valid-expect Enforce valid expect() usage | 🔧
valid-expect-in-promise Require promises that have expectations in their chain to be valid |
valid-title Enforce valid titles | 🔧

Requires Type Checking

Name Description 💼 ⚠️ 🔧 💡
unbound-method Enforce unbound methods are called with their expected scope |

In order to use the rules powered by TypeScript type-checking, you must be using @typescript-eslint/parser & adjust your eslint config as outlined here.

Note that unlike the type-checking rules in @typescript-eslint/eslint-plugin, the rules here will fallback to doing nothing if type information is not available, meaning it's safe to include them in shared configs that could be used on JavaScript and TypeScript projects.

Also note that unbound-method depends on @typescript-eslint/eslint-plugin, as it extends the original unbound-method rule from that plugin.

Credit

eslint-plugin-jest-extended

This is a sister plugin to eslint-plugin-jest that provides support for the matchers provided by jest-extended.

https://github.com/jest-community/eslint-plugin-jest-extended

eslint-plugin-jest-formatting

This project aims to provide formatting rules (auto-fixable where possible) to ensure consistency and readability in jest test suites.

https://github.com/dangreenisrael/eslint-plugin-jest-formatting

eslint-plugin-istanbul

A set of rules to enforce good practices for Istanbul, one of the code coverage tools used by Jest.

https://github.com/istanbuljs/eslint-plugin-istanbul

changelog

28.11.0 (2025-01-15)

Features

  • valid-expect: allow calling expect with no arguments (#1688) (ff0349e)

28.10.1 (2025-01-15)

Bug Fixes

  • padding-around-test-blocks: update description (#1691) (9cb4ecc)

28.10.0 (2024-12-19)

Features

  • unbound-method: ignore functions passed to jest.mocked (#1681) (d868636)

28.9.0 (2024-11-05)

Features

28.8.3 (2024-09-04)

Bug Fixes

  • prefer-importing-jest-globals: don't add imports in the middle of statements (#1645) (9c4197c)

28.8.2 (2024-09-02)

Performance Improvements

  • prefer-importing-jest-globals: stop collecting import specifiers for no reason (#1646) (0660242)

28.8.1 (2024-08-29)

Bug Fixes

  • prefer-importing-jest-globals: support typescript-eslint parser (#1639) (307f6a7)

28.8.0 (2024-08-07)

Features

  • import formatting rules from eslint-plugin-jest-formatting (#1563) (74078ee)

28.7.0 (2024-08-03)

Features

  • allow [@typescript-eslint](https://github.com/typescript-eslint) v8 (#1636) (fb43171)

28.6.0 (2024-06-06)

Features

  • prefer-jest-mocked: add new rule (#1599) (4b6a4f2)
  • valid-expect: supporting automatically fixing adding async in some cases (#1579) (5b9b47e)

28.5.0 (2024-05-03)

Features

  • allow @typescript-eslint/utils v7 as a direct dependency (#1567) (1476f10)

28.4.0 (2024-05-03)

Features

  • valid-expect: supporting automatically fixing missing await in some cases (#1574) (a407098)

28.3.0 (2024-04-27)

Features

  • prefer importing jest globals for specific types (#1568) (c464ae3)

28.2.0 (2024-04-06)

Features

  • support providing aliases for @jest/globals package (#1543) (744d4f6)

28.1.1 (2024-04-06)

Bug Fixes

  • max-expects: properly reset counter when exiting a test case (#1550) (b4b7cbc)

28.1.0 (2024-04-06)

Features

28.0.0 (2024-04-06)

Bug Fixes

  • allow ESLint 9 as peer dependency (#1547) (3c5e167)
  • drop support for Node 19 (#1548) (c87e388)
  • no-large-snapshots: avoid instanceof RegExp check for ESLint v9 compatibility (#1542) (af4a9c9)

Features

BREAKING CHANGES

  • Node v19 is no longer supported
  • removed unneeded snapshot processor and flat/snapshot config
  • dropped support for @typescript-eslint/eslint-plugin v5
  • dropped support for Node v14
  • removed no-if in favor of no-conditional-in-test

28.0.0-next.7 (2024-04-06)

Bug Fixes

BREAKING CHANGES

  • Node v19 is no longer supported

28.0.0-next.6 (2024-03-29)

Bug Fixes

  • no-large-snapshots: avoid instanceof RegExp check for ESLint v9 compatibility (#1542) (af4a9c9)

28.0.0-next.5 (2024-03-27)

Features

  • remove snapshot processor and flat/snapshot config (#1532) (98087f9)

BREAKING CHANGES

  • removed unneeded snapshot processor and flat/snapshot config

28.0.0-next.4 (2024-03-23)

Features

  • drop support for @typescript-eslint/eslint-plugin v5 (#1530) (150e355)

BREAKING CHANGES

  • dropped support for @typescript-eslint/eslint-plugin v5

28.0.0-next.3 (2024-03-22)

Features

28.0.0-next.2 (2024-03-21)

Features

BREAKING CHANGES

  • dropped support for Node v14

28.0.0-next.1 (2024-03-21)

Features

BREAKING CHANGES

  • removed no-if in favor of no-conditional-in-test

27.9.0 (2024-02-16)

Features

  • add should-be-fine support for flat configs (#1505) (4cc2a1b)

27.8.0 (2024-02-13)

Features

27.7.0 (2024-02-13)

Features

  • allow [@typescript-eslint](https://github.com/typescript-eslint) v7 (#1500) (6be2928)

27.6.3 (2024-01-12)

Bug Fixes

27.6.2 (2024-01-10)

Reverts

  • Revert "chore: use relative path to parent tsconfig.json (#1476)" (5e6199d), closes #1476

27.6.1 (2024-01-01)

Bug Fixes

  • include plugin meta information with snapshot processor for ESLint v9 (#1484) (067e246)

27.6.0 (2023-10-26)

Features

  • include plugin meta information for ESLint v9 (#1454) (4d57146)

27.5.0 (2023-10-26)

Features

  • valid-title: allow ignoring tests with non-string titles (#1460) (ea89da9)

27.4.3 (2023-10-20)

Bug Fixes

27.4.2 (2023-09-29)

Bug Fixes

  • make rule message punctuation consistent (#1444) (84121ee)

27.4.1 (2023-09-29)

Bug Fixes

  • no-focused-tests: make reporting location consistent (#1443) (a871775)

27.4.0 (2023-09-15)

Features

  • valid-title: support ignoring leading and trailing whitespace (#1433) (bc96473)

27.3.0 (2023-09-15)

Features

27.2.3 (2023-07-13)

Bug Fixes

  • allow @typescript-eslint/eslint-plugin v6 as peer dep (#1400) (04b2bf2), closes #1398

27.2.2 (2023-06-19)

Bug Fixes

  • add missing (optional) peer dependency on Jest (#1384) (34c3d32)

27.2.1 (2023-01-06)

Bug Fixes

  • valid-expect-in-promise: handle sparse arrays (#1325) (21e72c9)

27.2.0 (2022-12-31)

Features

27.1.7 (2022-12-15)

Bug Fixes

27.1.6 (2022-11-24)

Bug Fixes

  • ensure rule fixes produce valid code when function params and args have trailing commas (#1282) (8eca0b7)

27.1.5 (2022-11-10)

Performance Improvements

  • use Set instead of iterating, and deduplicate a function (#1278) (0e048f1)

27.1.4 (2022-11-04)

Performance Improvements

  • don't collect more info than needed when resolving jest functions (#1275) (e4a5674)

27.1.3 (2022-10-18)

Bug Fixes

  • no-restricted-jest-methods: don't crash on jest() (#1269) (4450daa)

27.1.2 (2022-10-14)

Bug Fixes

  • valid-expect-in-promise: adjust grammar in rule message (#1264) (4494ed2)

27.1.1 (2022-10-05)

Bug Fixes

27.1.0 (2022-10-03)

Features

27.0.4 (2022-09-10)

Bug Fixes

  • consistent rule doc notices and sections (#1226) (2580563)

27.0.3 (2022-09-09)

Bug Fixes

  • ensure jest globals are enabled in styles config (#1241) (a165e98)

27.0.2 (2022-09-08)

Bug Fixes

  • no-restricted-matchers: improve check to not be solely based on the start of the matcher chain (#1236) (5fe4568), closes #1235

27.0.1 (2022-08-28)

Bug Fixes

  • prefer-expect-assertions: report on concise arrow functions with expect call (#1225) (64ec9c1)

27.0.0 (2022-08-28)

Bug Fixes

  • unbound-method: don't suppress errors from base rule (#1219) (7c1389e)

Features

  • drop support for eslint@6 (#1212) (21fc2fe)
  • drop support for Node versions 12 and 17 (#1211) (4c987f5)
  • make no-alias-methods recommended (#1221) (914b24a)
  • no-jest-import: remove rule (#1220) (918873b)
  • no-restricted-matchers: match based on start of chain, requiring each permutation to be set (#1218) (f4dd97a)

BREAKING CHANGES

  • no-alias-methods is now recommended as the methods themselves will be removed in the next major version of Jest
  • no-jest-import: removed no-jest-import rule
  • unbound-method: errors thrown by the unbound-method base rule are no longer suppressed - really this means that if you don't specify project when this rule is enabled and @typescript-eslint/eslint-plugin is present, that error will no longer be suppressed instead of silently doing nothing; it will still not throw if this rule is enabled without the base rule being present
  • no-restricted-matchers: no-restricted-matchers now checks against the start of the expect chain, meaning you have to explicitly list each possible matcher & modifier permutations that you want to restrict
  • Support for ESLint version 6 is removed
  • Node versions 12 and 17 are no longer supported

27.0.0-next.2 (2022-08-28)

Bug Fixes

  • unbound-method: don't suppress errors from base rule (#1219) (7c1389e)

Features

  • make no-alias-methods recommended (#1221) (914b24a)
  • no-jest-import: remove rule (#1220) (918873b)
  • no-restricted-matchers: match based on start of chain, requiring each permutation to be set (#1218) (f4dd97a)

BREAKING CHANGES

  • no-alias-methods is now recommended as the methods themselves will be removed in the next major version of Jest
  • no-jest-import: removed no-jest-import rule
  • unbound-method: errors thrown by the unbound-method base rule are no longer suppressed - really this means that if you don't specify project when this rule is enabled and @typescript-eslint/eslint-plugin is present, that error will no longer be suppressed instead of silently doing nothing; it will still not throw if this rule is enabled without the base rule being present
  • no-restricted-matchers: no-restricted-matchers now checks against the start of the expect chain, meaning you have to explicitly list each possible matcher & modifier permutations that you want to restrict

27.0.0-next.1 (2022-08-23)

Features

BREAKING CHANGES

  • Support for ESLint version 6 is removed
  • Node versions 12 and 17 are no longer supported

26.9.0 (2022-08-28)

Features

26.8.7 (2022-08-21)

Bug Fixes

  • prefer-expect-assertions: report on concise arrow functions (#1207) (f928747)

26.8.6 (2022-08-21)

Bug Fixes

  • max-expect: reset expect counter when entering and exiting test function calls (#1206) (3908ab8)

26.8.5 (2022-08-20)

Bug Fixes

  • prefer-expect-assertions: use scoped based jest fn call parser for expect checks (#1201) (fd54ca1)

26.8.4 (2022-08-19)

Bug Fixes

  • prefer-mock-promise-shorthand: ignore mockImplementation functions that have parameters (#1199) (78ccbef)

26.8.3 (2022-08-15)

Performance Improvements

26.8.2 (2022-08-09)

Bug Fixes

  • max-expects: don't count expect.<member>() calls towards max (#1194) (75a0ff2)

26.8.1 (2022-08-08)

Bug Fixes

  • no-standalone-expect: only report on expect.hasAssertions & expect.assertions member calls (#1191) (4bf9eea)

26.8.0 (2022-08-07)

Features

26.7.0 (2022-07-29)

Features

  • create prefer-mock-promise-shorthand rule (#1167) (d965592)

26.6.0 (2022-07-14)

Features

26.5.3 (2022-06-06)

Bug Fixes

  • prefer-equality-matcher: handle resolves and rejects modifiers correctly (#1146) (0fad4df)

26.5.2 (2022-06-06)

Bug Fixes

  • prefer-comparison-matcher: handle resolves and rejects modifiers correctly (#1145) (b1795ff)

26.5.1 (2022-06-05)

Bug Fixes

  • prefer-called-with: handle resolves and rejects modifiers correctly (#1143) (dff1cb4)

26.5.0 (2022-06-04)

Features

  • support aliases for jest globals (e.g. context) (#1129) (02ec945)

26.4.7 (2022-06-04)

Bug Fixes

  • no-restricted-matchers: allow restricting negated resolves and rejects modifiers (#1142) (0950a96)

26.4.6 (2022-05-30)

Bug Fixes

  • no-disabled-tests: don't report on it.todo & test.todo (#1137) (b651443)

26.4.5 (2022-05-29)

Bug Fixes

  • expect-expect: include numbers when matching assert function names with wildcards (#1134) (2d0ef11)

26.4.4 (2022-05-29)

Bug Fixes

  • don't consider template tags in the middle of a possible jest function chain to be valid (#1133) (430de17)

26.4.3 (2022-05-29)

Bug Fixes

  • don't consider method calls on literals or new to be jest functions (#1132) (379ceb3)
  • produce valid code when when fixing properties accessed with square brackets (#1131) (6cd600d)

26.4.2 (2022-05-28)

Bug Fixes

  • don't consider concurrent.skip and concurrent.only valid test functions (#1124) (0aa5eb6)
  • no-disabled-tests: use jest function call parser for checking number of args (#1126) (b67e389)

26.4.1 (2022-05-28)

Bug Fixes

  • no-disabled-tests: switch to using jest function call parser (#1125) (32931c3)
  • support failing property on test functions (#1123) (6d75e8d)

26.4.0 (2022-05-28)

Features

  • improve how jest function calls are resolved to account for import aliases (#1122) (781f00e)

26.3.0 (2022-05-28)

Features

26.2.2 (2022-05-14)

Bug Fixes

  • use the last reference definition when checking jest fn scope (#1109) (1b2b9c1)

26.2.1 (2022-05-14)

Bug Fixes

  • use correct scope for checking references (#1107) (89ab1a0)

26.2.0 (2022-05-13)

Features

26.1.5 (2022-04-22)

Bug Fixes

  • prefer-expect-assertions: properly handle checking across multiple tests (#1089) (8b61b0c)

26.1.4 (2022-04-08)

Bug Fixes

  • prefer-snapshot-hint: don't report multi snapshots in different tests within the same describe (#1078) (98e5166)

26.1.3 (2022-03-24)

Bug Fixes

  • change node engine version to match dependencies (#1072) (ef2c093)

26.1.2 (2022-03-19)

Bug Fixes

  • prefer-snapshot-hint: support passing hint to toMatchSnapshot as first argument (#1070) (97b1f9d)

26.1.1 (2022-02-15)

Bug Fixes

26.1.0 (2022-02-06)

Features

26.1.0-next.2 (2022-02-06)

Features

  • deprecate no-if in favor of no-conditional-in-test (#1049) (b15f3af)

26.1.0-next.1 (2022-02-06)

Features

26.0.0 (2022-01-24)

Bug Fixes

  • migrate to non-experimental ts-eslint utils (#1035) (e894f51)

BREAKING CHANGES

  • Drop support for @typescript-eslint/eslint-plugin@4

25.7.0 (2022-01-15)

Features

  • create prefer-equality-matcher rule (#1016) (341353b)
  • valid-expect: support asyncMatchers option and default to jest-extended matchers (#1018) (c82205a)

25.6.0 (2022-01-15)

Features

25.5.0 (2022-01-15)

Features

  • prefer-expect-assertions: support requiring only if expect is used in a callback (#1028) (8d5fd33)

25.4.0 (2022-01-15)

Features

  • prefer-expect-assertions: support requiring only if expect is used in a loop (#1013) (e6f4f8a)

25.3.4 (2022-01-01)

Bug Fixes

  • prefer-lowercase-title: ignore it and test separately (#1011) (f1a7674)

25.3.3 (2021-12-30)

Bug Fixes

  • prefer-to-contain: support square bracket accessors (#1009) (73984a7)
  • prefer-to-have-length: support square bracket accessors (#1010) (9e70f55)

25.3.2 (2021-12-27)

Bug Fixes

  • no-large-snapshots: only count size of template string for inline snapshots (#1005) (5bea38f)
  • prefer-hooks-on-top: improve message & docs (#999) (f9e7ae2)

25.3.1 (2021-12-27)

Bug Fixes

25.3.0 (2021-11-23)

Features

  • require-hook: add allowedFunctionCalls setting (#983) (9d9336a)

25.2.4 (2021-11-08)

Bug Fixes

  • prefer-to-be: preserve resolves and rejects modifiers (#980) (a1296bd)

25.2.3 (2021-11-04)

Bug Fixes

  • no-deprecated-functions: mark jest as an optional peer dependency (#970) (f468752)

25.2.2 (2021-10-17)

Bug Fixes

  • require-hook: check variables are either const or declarations (#959) (ce8cd61)

25.2.1 (2021-10-15)

Bug Fixes

  • expect-expect: don't error on it.todo & test.todo calls (#954) (d3cc0db)

25.2.0 (2021-10-14)

Features

  • expect-expect: support additionalTestBlockFunctions option (#850) (3b94c62)

25.1.0 (2021-10-14)

Features

25.0.6 (2021-10-14)

Bug Fixes

  • valid-expect-in-promise: allow expect.resolve & expect.reject (#948) (71b7e17), closes #947
  • valid-expect-in-promise: support await in arrays (#949) (a62130c)

25.0.5 (2021-10-11)

Bug Fixes

  • support @typescript-eslint/eslint-plugin@5 (#942) (9b842a3)

25.0.4 (2021-10-11)

Bug Fixes

  • update @typescript-eslint/experimental-utils to v5 (#941) (afad49a)

25.0.3 (2021-10-11)

Bug Fixes

  • valid-expect-in-promise: support awaited promises in arguments (#936) (bd2c33c)

25.0.2 (2021-10-11)

Bug Fixes

  • valid-expect-in-promise: support out of order awaits (#939) (07d2137)

25.0.1 (2021-10-10)

Bug Fixes

  • specify peer dependency ranges correctly (cb87458)

25.0.0 (2021-10-10)

Bug Fixes

Features

  • add prefer-to-be to style ruleset (2a3376f)
  • lowercase-name: rename to prefer-lowercase-title (b860084)
  • prefer-to-be-null: remove rule (809bcda)
  • prefer-to-be-undefined: remove rule (3434d9b)
  • remove deprecated rules (#661) (e8f16ec)
  • valid-describe: rename to valid-describe-callback (f3e9e9a)

BREAKING CHANGES

  • valid-describe: renamed valid-describe to valid-describe-callback
  • lowercase-name: renamed lowercase-name to prefer-lowercase-title
  • prefer-to-be-undefined: removed prefer-to-be-undefined rule
  • prefer-to-be-null: removed prefer-to-be-null rule
  • recommend prefer-to-be rule
  • Removes rules no-expect-resolves, no-truthy-falsy, no-try-expect, and prefer-inline-snapshots
  • Drop support for ESLint 5
  • Drop support for Node 10 and 15

25.0.0-next.7 (2021-10-10)

Features

  • add prefer-to-be to style ruleset (2a3376f)
  • lowercase-name: rename to prefer-lowercase-title (b860084)
  • prefer-to-be-null: remove rule (809bcda)
  • prefer-to-be-undefined: remove rule (3434d9b)
  • valid-describe: rename to valid-describe-callback (f3e9e9a)

BREAKING CHANGES

  • valid-describe: renamed valid-describe to valid-describe-callback
  • lowercase-name: renamed lowercase-name to prefer-lowercase-title
  • prefer-to-be-undefined: removed prefer-to-be-undefined rule
  • prefer-to-be-null: removed prefer-to-be-null rule
  • recommend prefer-to-be rule

25.0.0-next.6 (2021-10-10)

Bug Fixes

  • lowercase-name: consider skip and only prefixes for ignores (#923) (8716c24)
  • prefer-to-be: don't consider RegExp literals as toBe-able (#922) (99b6d42)

Features

  • create require-hook rule (#929) (6204b31)
  • deprecate prefer-to-be-null rule (4db9161)
  • deprecate prefer-to-be-undefined rule (fa08f09)
  • valid-expect-in-promise: re-implement rule (#916) (7a49c58)

25.0.0-next.5 (2021-09-29)

Bug Fixes

  • no-deprecated-functions: remove process.cwd from resolve paths (#889) (6940488)
  • no-identical-title: always consider .each titles unique (#910) (a41a40e)
  • valid-expect-in-promise: support finally (#914) (9c89855)
  • valid-expect-in-promise: support additional test functions (#915) (4798005)

Features

  • create prefer-expect-resolves rule (#822) (2556020)
  • create prefer-to-be rule (#864) (3a64aea)
  • require-top-level-describe: support enforcing max num of describes (#912) (14a2d13)
  • valid-title: allow custom matcher messages (#913) (ffc9392)

25.0.0-next.4 (2021-09-20)

Bug Fixes

  • mark rules that suggest fixes with hasSuggestion for ESLint v8 (#898) (ec0a21b)
  • use correct property hasSuggestions rather than hasSuggestion (#899) (dfd2368)

25.0.0-next.3 (2021-09-17)

Features

BREAKING CHANGES

  • Removes rules no-expect-resolves, no-truthy-falsy, no-try-expect, and prefer-inline-snapshots

25.0.0-next.2 (2021-09-13)

Bug Fixes

BREAKING CHANGES

  • Drop support for ESLint 5

25.0.0-next.1 (2021-09-13)

Bug Fixes

BREAKING CHANGES

  • Drop support for Node 10 and 15

24.7.0 (2021-10-10)

Features

  • create require-hook rule (#929) (6204b31)
  • deprecate prefer-to-be-null rule (4db9161)
  • deprecate prefer-to-be-undefined rule (fa08f09)

24.6.0 (2021-10-09)

Features

  • valid-expect-in-promise: re-implement rule (#916) (7a49c58)

24.5.2 (2021-10-04)

Bug Fixes

  • lowercase-name: consider skip and only prefixes for ignores (#923) (8716c24)

24.5.1 (2021-10-04)

Bug Fixes

  • prefer-to-be: don't consider RegExp literals as toBe-able (#922) (99b6d42)

24.5.0 (2021-09-29)

Bug Fixes

  • no-deprecated-functions: remove process.cwd from resolve paths (#889) (6940488)
  • no-identical-title: always consider .each titles unique (#910) (a41a40e)

Features

  • create prefer-expect-resolves rule (#822) (2556020)
  • create prefer-to-be rule (#864) (3a64aea)
  • require-top-level-describe: support enforcing max num of describes (#912) (14a2d13)
  • valid-title: allow custom matcher messages (#913) (ffc9392)

24.4.3 (2021-09-28)

Bug Fixes

  • valid-expect-in-promise: support finally (#914) (9c89855)
  • valid-expect-in-promise: support additional test functions (#915) (4798005)

24.4.2 (2021-09-17)

Bug Fixes

  • use correct property hasSuggestions rather than hasSuggestion (#899) (dfd2368)

24.4.1 (2021-09-17)

Bug Fixes

  • mark rules that suggest fixes with hasSuggestion for ESLint v8 (#898) (ec0a21b)

24.4.0 (2021-07-21)

Features

24.3.7 (2021-07-21)

Bug Fixes

  • valid-describe: report on concise-body arrow functions (#863) (71c5299)

24.3.6 (2021-04-26)

Bug Fixes

  • no-conditional-expect: check for expects in catchs on promises (#819) (1fee973)
  • valid-expect: support async expect in ternary statements (#833) (7b7a396)
  • improve handling of .each calls and with tagged literals (#814) (040c605)

24.3.5 (2021-04-10)

Bug Fixes

  • valid-describe: support using each with modifiers (#820) (cbdbcef)

24.3.4 (2021-04-05)

Bug Fixes

  • support all variations of describe, it, & test (#792) (0968b55)

24.3.3 (2021-04-02)

Bug Fixes

24.3.2 (2021-03-16)

Bug Fixes

  • consistent-test-it: properly handle describe.each (#796) (035bd30), closes #795

24.3.1 (2021-03-13)

Bug Fixes

  • no-focused-tests: report on skip instead of concurrent (#791) (2b65b49)

24.3.0 (2021-03-13)

Features

24.2.1 (2021-03-10)

Bug Fixes

  • no-identical-titles: support nested describes (#790) (ce26621)

24.2.0 (2021-03-09)

Features

24.1.10 (2021-03-09)

Bug Fixes

  • no-identical-titles: ignore .each template cases (#788) (d27a6e6)

24.1.9 (2021-03-08)

Bug Fixes

  • valid-describe: false positive with template describe.each (#785) (aa946a6)

24.1.8 (2021-03-07)

Bug Fixes

  • consistent-test-it: support it.each in describe.each (#782) (0014da0)

24.1.7 (2021-03-06)

Bug Fixes

  • no-disabled-tests: adjust selector to match only test functions (#777) (c916902)
  • no-disabled-tests: support describe.skip.each & xdescribe.each (#778) (6a32e87)

24.1.6 (2021-03-06)

Bug Fixes

24.1.5 (2021-02-17)

Bug Fixes

  • require-top-level-describe: import function that actually exists (#763) (d10dc07)

24.1.4 (2021-02-16)

Bug Fixes

  • lowercase-name: support .each methods (#746) (3d847b2)
  • require-top-level-describe: handle describe.each properly (#745) (677be45)

24.1.3 (2020-11-12)

Bug Fixes

24.1.2 (2020-11-12)

Bug Fixes

  • no-done-callback: fix regression with it.each (#708) (2f032f8)

24.1.1 (2020-11-12)

Bug Fixes

  • improve support for it.each involving tagged template literals (#701) (2341814)

24.1.0 (2020-10-05)

Features

  • prefer-expect-assertions: add onlyFunctionsWithAsyncKeyword option (#677) (d0cea37)

24.0.2 (2020-09-20)

Bug Fixes

  • no-if: check both types of function expression (#672) (d462d50), closes #670

24.0.1 (2020-09-12)

Bug Fixes

  • don't include deprecated rules in all config (#664) (f636021), closes #663

24.0.0 (2020-09-04)

Bug Fixes

Code Refactoring

  • no-test-callback: rename rule to no-done-callback (#653) (e15a8d1)

Features

  • no-done-callback: support hooks (#656) (3e6cb44), closes #649 #651
  • add no-conditional-expect to the recommended ruleset (40cd89d)
  • add no-deprecated-functions to the recommended ruleset (5b2af00)
  • add no-interpolation-in-snapshots to the recommended ruleset (3705dff)
  • add valid-title to recommended ruleset (41f7873)
  • drop support for node 8 (#570) (6788e72)
  • set no-jasmine-globals to error in recommended ruleset (7080952)
  • no-large-snapshots: remove whitelistedSnapshots option (8c1c0c9)

BREAKING CHANGES

  • no-done-callback: no-done-callback will now report hooks using callbacks as well, not just tests
  • no-test-callback: rename no-test-callback to no-done-callback
  • recommend no-conditional-expect rule
  • recommend no-interpolation-in-snapshots rule
  • recommend no-deprecated-functions rule
  • recommend valid-title rule
  • recommend erroring for no-jasmine-globals rule
  • no-large-snapshots: no-large-snapshots runs on all files regardless of type
  • Jasmine globals are no marked as such
  • Node 10+ required

23.20.0 (2020-07-30)

Features

  • no-large-snapshots: deprecate whitelistedSnapshots for new name (#632) (706f5c2)

23.19.0 (2020-07-27)

Features

  • create no-interpolation-in-snapshots rule (#553) (8d2c17c)

23.18.2 (2020-07-26)

Bug Fixes

  • no-if: report conditionals in call expressions (4cfcf08), closes #557

23.18.1 (2020-07-26)

Bug Fixes

  • no-large-snapshots: actually compare allowed name strings to name (#625) (622a08c)

23.18.0 (2020-07-05)

Features

  • valid-title: support mustMatch & mustNotMatch options (#608) (4c7207e), closes #233

23.17.1 (2020-06-23)

Bug Fixes

  • lowercase-name: ignore all top level describes when option is true (#614) (624018a), closes #613

23.17.0 (2020-06-23)

Features

  • lowercase-name: support ignoreTopLevelDescribe option (#611) (36fdcc5), closes #247

23.16.0 (2020-06-21)

Features

  • create no-conditional-expect rule (aba53e4)
  • deprecate no-try-expect in favor of no-conditional-expect (6d07cad)

23.15.0 (2020-06-21)

Features

  • no-standalone-expect: support additionalTestBlockFunctions (#585) (ed220b2)

23.14.0 (2020-06-20)

Bug Fixes

  • no-test-callback: check argument is an identifier (f70612d)
  • no-test-callback: provide suggestion instead of autofix (782d8fa)
  • prefer-strict-equal: provide suggestion instead of autofix (2eaed2b)

Features

  • prefer-expect-assertions: provide suggestions (bad88a0)

23.13.2 (2020-05-26)

Bug Fixes

23.13.1 (2020-05-17)

Bug Fixes

  • no-if: use correct syntax for placeholder substitution in message (6d1eda8)

23.13.0 (2020-05-16)

Features

  • valid-expect: support minArgs & maxArgs options (#584) (9e0e2fa)

23.12.0 (2020-05-16)

Features

  • deprecate no-expect-resolves rule (b6a22e5)
  • deprecate no-truthy-falsy rule (a67d92d)
  • deprecate prefer-inline-snapshots rule (1360e9b)

23.11.0 (2020-05-12)

Features

23.10.0 (2020-05-09)

Features

  • no-deprecated-functions: support jest version setting (#564) (05f20b8)

23.9.0 (2020-05-04)

Features

23.8.2 (2020-03-06)

Bug Fixes

  • prefer-to-contain: check that expect argument is defined before use (#542) (56f909b)

23.8.1 (2020-02-29)

Bug Fixes

23.8.0 (2020-02-23)

Bug Fixes

  • valid-title: ensure argument node is defined before accessing props (#538) (7730f75)

Features

  • no-large-snapshots: add setting to define maxSize by snapshot type (#524) (0d77300)

23.7.0 (2020-02-07)

Bug Fixes

Features

  • valid-title: support disallowedWords option (#522) (38bbe93)

23.6.0 (2020-01-12)

Features

23.5.0 (2020-01-12)

Features

  • expect-expect: support glob patterns for assertFunctionNames (#509) (295ca9a)
  • valid-expect: refactor valid-expect linting messages (#501) (7338362)

23.4.0 (2020-01-10)

Features

  • expect-expect: support chained function names (#471) (#508) (beb1aec)
  • rules: add support for function declaration as test case (#504) (ac7fa48)

23.3.0 (2020-01-04)

Features

23.2.0 (2019-12-28)

Features

  • valid-expect: warn on await expect() with no assertions (#496) (19798dd)

23.1.1 (2019-11-30)

Bug Fixes

  • no-focused-tests: detect table format uage of .only.each (#489) (d03bcf4)

23.1.0 (2019-11-29)

Features

  • no-focused-tests: check each with table format (#430) (154c0b8)

23.0.5 (2019-11-27)

Bug Fixes

  • typo in the require-to-throw-message docs (#487) (3526213)

23.0.4 (2019-11-14)

Bug Fixes

  • get correct ruleName without specifying file extension (#473) (f09203e)

23.0.3 (2019-11-08)

Bug Fixes

  • no-test-callback: don't provide fix for async functions (#469) (09111e0), closes #466

23.0.2 (2019-10-28)

Bug Fixes

  • prefer-todo: ensure argument exists before trying to access it (#462) (a87c8c2)

23.0.1 (2019-10-28)

Bug Fixes

22.2.0 (2019-01-29)

Features