@beyondessential/eslint-config-jest
Jest style guide as as shareable ESLint configuration
This package defines Beyond Essential System's style guide for Jest.
Installation
Install the package and its required peer dependencies:
yarn add -D @beyondessential/eslint-config-jest eslint prettier
Usage
You need to extend this package in your ESLint configuration:
{
"extends": "@beyondessential/jest"
}
Publishing
- Checkout the latest code:
git fetch && git checkout master
- Commit your changes in a new branch
-
⚠️ Don't forget to also update the package version:npm version # < patch || minor || major >
- Create a pull request against
master
After your PR is approved and merged:
git fetch && git checkout master && git pull
npm login
npm publish --access public
Style guide
We use the recommended rules from eslint-plugin-jest, with a few changes.
Changes
Rule | Airbnb | BES | Comment |
---|---|---|---|
jest/expect-expect | error | ['warn', { assertFunctionNames: ['expect', 'assert*'] }] | Our assert* functions conventionally use expect under the hood |
jest/valid-describe | error | off | The implementation of this rule does not allow imported functions as describe callbacks |
jest/valid-title | error | off | Title may be a variable |