eslint-plugin-jest-mock-config

1.0.0-beta.6 • Public • Published

eslint-plugin-jest-mock-config

NPM Version Package License GitHub Actions Workflow Status

ESLint rules for mocking in jest using jest.mock(...).

Rules

This Plugin currently contains the following ESLint rules:

Name Description Documentation
jest-mock-without-import Reports jest.mock(<path>), when no import of <path> exitsts Link
jest-mocked-without-mock Reports jest.mocked(<function>), when the import of <function> is not mocked via jest.mock Link
jest-mock-multiple-with-same-path Reports, if jest.mock(<path>) is used multiple times with the same path in one file Link

Installation

# npm
npm install --safe-dev eslint-plugin-jest-mock-config

#yarn
yarn add --dev eslint-plugin-jest-mock-config

Development

Tests

npm test

Usage

When to use the plugin

If you are using jest with JavaScript or TypeScipt for your tests and want to detect wrong configurations of your jest mocks.

When to not use the plugin

If you are not using jest in your project

ESLint7 / 8 / 9 compatibility

Rules included in this ESLint plugin are tested with Version 7 / 8 and 9 of ESLint. See the github actions testing all rules for eslint7, 8 and 9 and the related (stub-) projects localed in examples.

Please report bugs here, if you still encounter some!

Readme

Keywords

Package Sidebar

Install

npm i eslint-plugin-jest-mock-config

Weekly Downloads

35

Version

1.0.0-beta.6

License

MIT

Unpacked Size

27.6 kB

Total Files

14

Last publish

Collaborators

  • buzz-t