eslint-plugin-no-only-tests
ESLint rule for .only blocks in mocha tests
Last updated 7 months ago by levibuzolic .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install eslint-plugin-no-only-tests 
SYNC missed versions from official npm registry.

eslint-plugin-no-only-tests

Version Downloads CircleCI

ESLint rule for .only tests in mocha and other JS testing libraries.

Currently matches the following test blocks by default: describe, it, context, tape, test, fixture, serial.

Designed to prevent you from committing .only tests to CI, disabling tests for your whole team.

As of v2.3 you can now override the test blocks and focus functions.

Installation

First you'll need to install ESLint and the plugin:

npm install --save-dev eslint eslint-plugin-no-only-tests
# OR
yarn add --dev eslint eslint-plugin-no-only-tests

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-no-only-tests globally.

Usage

Add no-only-tests to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": [
    "no-only-tests"
  ]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "no-only-tests/no-only-tests": "error"
  }
}

If you use a testing framework that uses an unsupported block name, or a different way of focusing test (something other than .only) you can specify an array of blocks and focus methods to match in the options.

{
  "rules": {
    "no-only-tests/no-only-tests": ["error", {"block": ["test", "it", "assert"], "focus": ["only", "focus"]}]
  }
}

The above example will catch any uses of test.only, test.focus, it.only, it.focus, assert.only and assert.focus.

Current Tags

  • 2.4.0                                ...           latest (7 months ago)

11 Versions

  • 2.4.0                                ...           7 months ago
  • 2.3.1                                ...           a year ago
  • 2.3.0                                ...           a year ago
  • 2.2.0                                ...           a year ago
  • 2.1.0                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago

Copyright 2014 - 2016 © taobao.org |