All Projects → levibuzolic → eslint-plugin-no-only-tests

levibuzolic / eslint-plugin-no-only-tests

Licence: MIT license
ESLint rule for catching focused/only test blocks

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to eslint-plugin-no-only-tests

Feathers Vue
A boiler plate template using Feathers with Email Verification, Vue 2 with Server Side Rendering, stylus, scss, jade, babel, webpack, ES 6-8, login form, user authorization, and SEO
Stars: ✭ 195 (+191.04%)
Mutual labels:  jasmine, mocha
generator-speedseed
Oriented to components, allow create/choice template, multiple configuration with easy maintenance
Stars: ✭ 13 (-80.6%)
Mutual labels:  jasmine, mocha
parse-server-test-runner
A tool for programmatically starting Parse Server
Stars: ✭ 18 (-73.13%)
Mutual labels:  jasmine, mocha
Eslint Plugin Mocha
ESLint rules for mocha
Stars: ✭ 249 (+271.64%)
Mutual labels:  mocha, eslint-plugin
Public
Repository for wallaby.js questions and issues
Stars: ✭ 662 (+888.06%)
Mutual labels:  jasmine, mocha
ts-snippet
A TypeScript snippet compiler for any test framework
Stars: ✭ 29 (-56.72%)
Mutual labels:  jasmine, mocha
Approvals.NodeJS
Approval Tests implementation in NodeJS
Stars: ✭ 79 (+17.91%)
Mutual labels:  jasmine, mocha
eslint-config-get-off-my-lawn
A highly opinionated, sharable config of ESLint rules to produce beautiful, readable JavaScript.
Stars: ✭ 44 (-34.33%)
Mutual labels:  eslint-plugin, eslint-rules
Sazerac
Data-driven unit testing for Jasmine, Mocha, and Jest
Stars: ✭ 322 (+380.6%)
Mutual labels:  jasmine, mocha
Rxjs Marbles
An RxJS marble testing library for any test framework
Stars: ✭ 267 (+298.51%)
Mutual labels:  jasmine, mocha
Babel Plugin Tester
Utilities for testing babel plugins
Stars: ✭ 228 (+240.3%)
Mutual labels:  jasmine, mocha
Teaspoon
Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
Stars: ✭ 1,443 (+2053.73%)
Mutual labels:  jasmine, mocha
Eslint Plugin Unicorn
Various awesome ESLint rules
Stars: ✭ 2,157 (+3119.4%)
Mutual labels:  eslint-plugin, eslint-rules
Testdeck
Object oriented testing
Stars: ✭ 206 (+207.46%)
Mutual labels:  jasmine, mocha
Xo
❤️ JavaScript/TypeScript linter (ESLint wrapper) with great defaults
Stars: ✭ 6,277 (+9268.66%)
Mutual labels:  eslint-plugin, eslint-rules
mutest
A BDD testing framework for C, inspired by Mocha
Stars: ✭ 22 (-67.16%)
Mutual labels:  jasmine, mocha
eslint-plugin-no-secrets
An eslint plugin to find strings that might be secrets/credentials
Stars: ✭ 93 (+38.81%)
Mutual labels:  eslint-plugin, eslint-rules
eslint-plugin-strict-vue
Vue eslint plugin with rules to make you code stricter: enforce jsdoc, restrict rootGetters, rootState and more.
Stars: ✭ 28 (-58.21%)
Mutual labels:  eslint-plugin, eslint-rules
eslint-config-adjunct
A reasonable collection of plugins to use alongside your main esLint configuration
Stars: ✭ 39 (-41.79%)
Mutual labels:  jasmine, mocha
Webdriverio
Next-gen browser and mobile automation test framework for Node.js
Stars: ✭ 7,214 (+10667.16%)
Mutual labels:  jasmine, mocha

eslint-plugin-no-only-tests

Version Downloads GitHub Tests

ESLint rule for .only tests in Mocha, Jest, Jasmine, Mocha Cakes 2 and other JS testing libraries.

The following test blocks are matched by default: describe, it, context, tape, test, fixture, serial, Feature, Scenario, Given, And, When and Then.

Designed to prevent you from committing focused (.only) tests to CI, which may prevent your entire test suite from running.

If the testing framework you use doesn't use .only to focus tests, you can override the matchers with options.

Installation

Install ESLint if you haven't done so already, then install eslint-plugin-no-only-tests:

npm install --save-dev eslint-plugin-no-only-tests
# or
yarn add --dev 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 add the rule to the rules section of your .eslintrc:

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

If you use a testing framework that uses a test block name that isn't present in the defaults, 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.

This rule supports opt-in autofixing when the fix option is set to true to avoid changing runtime code unintentionally when configured in an editor.

"rules": {
  "no-only-tests/no-only-tests": ["error", {"fix": true}]
}

Options

Option Type Description
block string[] Specify the block names that your testing framework uses. Add a * to the end of any string to enable prefix matching (ie. test* will match testExample.only)
Defaults to ["describe", "it", "context", "test", "tape", "fixture", "serial", "Feature", "Scenario", "Given", "And", "When", "Then"]
focus string[] Specify the focus scope that your testing framework uses.
Defaults to ["only"]
fix boolean Enable this rule to auto-fix violations, useful for a pre-commit hook, not recommended for users with auto-fixing enabled in their editor.
Defaults to false
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].