eslint-plugin-tape
ESLint rules for tape
This ESLint plugin is a copy of the great eslint-plugin-ava adapting the rules to work for tape tests and removing AVA specific rules.
Install
$ npm install --save-dev eslint eslint-plugin-tape
Usage
Configure it in your package.json
or eslintrc.*
file as described in ESLint user guide.
Rules
The rules will only activate in test files.
- assertion-message - Enforce or disallow assertion messages.
- max-asserts - Limit the number of assertions in a test.
- no-identical-title - Ensure no tests have the same title.
- no-ignored-test-files - Ensure no tests are written in ignored files.
- no-only-test - Ensure no
test.only()
are present. - no-skip-assert - Ensure no assertions are skipped.
- no-skip-test - Ensure no tests are skipped.
- no-statement-after-end - Ensure
t.end()
is the last statement executed. - no-unknown-modifiers - Prevent the use of unknown test modifiers.
- test-ended - Ensure callback tests are explicitly ended.
- test-title - Ensure tests have a title.
- use-t-well - Prevent the incorrect use of
t
. - use-t - Ensure test functions use
t
as their parameter. - use-test - Ensure that tape is imported with
test
as the variable name.
Recommended config
This plugin exports a recommended
config that enforces good practices.
Enable it in your package.json
with the extends
option:
See the ESLint docs for more information about extending config files.
Note: This config will also enable the correct parser options and environment.
Credit
- Sindre Sorhus & AVA team for the fantastic work with eslint-plugin-ava