eslint-plugin-no-skip-tests
raw JSON → 1.1.0 verified Sat Apr 25 auth: no javascript
An ESLint plugin that enforces a rule against using describe.skip or it.skip in Mocha test suites. Version 1.1.0 is the current stable release, with no frequent updates. It differentiates itself by focusing solely on preventing skipped tests, complementing the sister plugin eslint-plugin-no-only-tests. Designed for teams that want to ensure no tests are accidentally skipped in CI.
Common errors
error ESLint configuration in .eslintrc.json is invalid: 'no-skip-tests/no-skip-tests' is not found. ↓
cause Plugin not loaded in 'plugins' section.
fix
Add 'no-skip-tests' to the plugins array.
error Definition for rule 'no-skip-tests/no-skip-tests' was not found. ↓
cause eslint-plugin-no-skip-tests is not installed.
fix
Run npm install --save-dev eslint-plugin-no-skip-tests.
Warnings
gotcha The plugin does not support xdescribe or xit (alternate Mocha APIs), only describe.skip and it.skip. ↓
fix Use separate rule or plugin for xdescribe/xit, or add custom rule.
gotcha The default severity is 2 (error). To use as warning, set to 1. ↓
fix Set rule to 1 in config.
Install
npm install eslint-plugin-no-skip-tests yarn add eslint-plugin-no-skip-tests pnpm add eslint-plugin-no-skip-tests Imports
- Plugin wrong
plugins: ['eslint-plugin-no-skip-tests']correctplugins: ['no-skip-tests'] - Rule: no-skip-tests wrong
rules: { 'no-skip-tests': 'error' }correctrules: { 'no-skip-tests/no-skip-tests': 'error' } - Plugin name (legacy) wrong
plugins: ['no-only-tests']correctplugins: ['no-skip-tests']
Quickstart
// .eslintrc.json
{
"plugins": ["no-skip-tests"],
"rules": {
"no-skip-tests/no-skip-tests": "error"
}
}
// test.js
// eslint will error on the following:
describe.skip('skipped suite', () => { it('test', () => {}); });
it.skip('skipped test', () => {});
// but will allow:
describe('suite', () => { it('test', () => {}); });