ESLint rule for
.only tests in mocha and other JS testing libraries.
Currently matches the following test blocks by default:
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.
First you'll need to install ESLint and the plugin:
npm install --save-dev eslint eslint-plugin-no-only-tests# ORyarn add --dev eslint eslint-plugin-no-only-tests
Note: If you installed ESLint globally (using the
-g flag) then you must also install
no-only-tests to the plugins section of your
.eslintrc configuration file. You can omit the
Then configure the rules you want to use under the rules section.
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.
The above example will catch any uses of