jest-extended adds many additional matchers to Jest's default assertions but knowing when to use these matchers isn't always obvious.
eslint-plugin-jest-extended
aims to tell you when you should use a specific matcher available in jest-extended
.
With npm:
npm install --save-dev eslint-plugin-jest-extended
With yarn:
yarn add -D eslint-plugin-jest-extended
Add jest-extended to the plugins section of your .eslintrc
configuration file.
{
"plugins": ["jest-extended"]
}
See ESLint plugin documentation for more information about using plugins.
Add jest-extended to the extends section of your .eslintrc
configuration file to use the recommended setup.
{
"extends": ["plugin:jest-extended/recommended"]
}
See ESLint configuration documentation for more information about extending configuration files.
Add rules to your .eslintrc
configuration file to either use a rule or override the default configuration if you are
using the recommended setup.
See ESLint rules documentation for more information about adjusting rule settings.
{
"rules": {
"jest-extended/prefer-to-be-true": "warn",
"jest-extended/prefer-to-be-false": "error"
}
}
Matt Phillips 💻 💡 🚇 |
---|