Skip to content

Really good ESLint rules for the tap test framework

License

Notifications You must be signed in to change notification settings

getoslash/eslint-plugin-tap

Repository files navigation

eslint-plugin-tap

npm version npm size install size code coverage Release Open in Visual Studio Code

🕵🏼 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.

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

  1. Sindre Sorhus & AVA team for building eslint-plugin-ava.
  2. Abel Toledano for adapting eslint-plugin-ava to build eslint-plugin-tape, on which this project is heavily based on.

License

The code in this project is released under the MIT License.

FOSSA Status