eslint-plugin-tap
v1.2.1
Published
ESLint rules for tap
Downloads
810
Maintainers
Readme
eslint-plugin-tap
🕵🏼 ESLint rules for tap
tests.
Install
npm install --save-dev eslint eslint-plugin-tap
# OR
yarn add --dev eslint eslint-plugin-tap
Usage
Configure it in your package.json
or eslintrc.*
file as described in the ESLint user guide –
{
"plugins": [
"tap"
],
"rules": {
"tap/assertion-message": ["error", "always"],
"tap/max-asserts": ["error", 8],
"tap/no-identical-title": "error",
"tap/no-ignored-test-files": "error",
"tap/no-only-test": "error",
"tap/no-skip-test": "error",
"tap/no-statement-after-end": "error",
"tap/no-unknown-modifiers": "error",
"tap/test-ended": "error",
"tap/test-title": ["error", "if-multiple"],
"tap/use-plan": ["error", "always"],
"tap/use-plan-well": "error",
"tap/use-t-well": "error",
"tap/use-t": "error",
"tap/use-tap": "error",
}
}
Rules
The rules will activate only in tap
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-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.
- use-plan - Ensure every test uses a
t.plan()
. - use-plan-well - Prevent the incorrect use of
t.plan()
. - use-t-well - Prevent the incorrect use of
t
. - use-t - Ensure test functions use
t
as their parameter. - use-tap - Ensure that tap is imported with
tap
as the variable name.
Recommended configuration
This plugin exports a recommended
configuration that enforces good practices.
Enable it in your package.json
or eslintrc.*
file with the extends
option –
{
"plugins": [
"tap"
],
"extends": "plugin:tap/recommended"
}
See the ESLint documentation for more information about extending configuration files.
Note: This config will also enable the correct parser options and environment.
Credits
- Sindre Sorhus & AVA team for building
eslint-plugin-ava
. - Abel Toledano for adapting
eslint-plugin-ava
to buildeslint-plugin-tape
, on which this project is heavily based on.
License
The code in this project is released under the MIT License.