Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/funbox/eslint-plugin-no-only-tests
Disallow the use of describe.only() and it.only()
https://github.com/funbox/eslint-plugin-no-only-tests
eslint eslint-plugin mocha
Last synced: 2 months ago
JSON representation
Disallow the use of describe.only() and it.only()
- Host: GitHub
- URL: https://github.com/funbox/eslint-plugin-no-only-tests
- Owner: funbox
- License: mit
- Created: 2020-06-23T15:16:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T05:11:33.000Z (6 months ago)
- Last Synced: 2024-10-29T20:52:47.334Z (3 months ago)
- Topics: eslint, eslint-plugin, mocha
- Language: JavaScript
- Homepage:
- Size: 371 KB
- Stars: 10
- Watchers: 12
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @funboxteam/eslint-plugin-no-only-tests
[![npm](https://img.shields.io/npm/v/@funboxteam/eslint-plugin-no-only-tests.svg)](https://www.npmjs.com/package/@funboxteam/eslint-plugin-no-only-tests)
Disallow the use of `describe.only()` and `it.only()`.
[По-русски](./README.ru.md)
## Rationale
When developers fix tests they may make the process easier by filtering tests using method `only` on `it` & `describe`.
However, such filters should not be in the repo when the project is running on CI.
So, we add this rule to our [ESLint config](https://github.com/funbox/eslint-config) to check the existence of `only`
in the tests files. And we run linter using precommit-hook, which make it possible to prevent committing
when `only` does exist in the code.## Installation
You'll first need to install [ESLint](http://eslint.org):
```
$ npm i eslint --save-dev
```Next, install the plugin:
```
$ npm install @funboxteam/eslint-plugin-no-only-tests --save-dev
```## Usage
Add `@funboxteam/eslint-plugin-no-only-tests` to the `plugins` section of your `.eslintrc` configuration file.
You can omit the `eslint-plugin-` prefix:```json
{
"plugins": [
"@funboxteam/no-only-tests"
]
}
```Then configure the rule under the `rules` section.
```json
{
"rules": {
"@funboxteam/no-only-tests/no-only": 2
}
}
```[![Sponsored by FunBox](https://funbox.ru/badges/sponsored_by_funbox_centered.svg)](https://funbox.ru)