# no-exclusive-tests

Rule `sonarjs/no-exclusive-tests`. Exclusive tests should not be committed to version control

- Source: sonarjs
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 6.2M weekly downloads of presets that enable it
- Trend: +62.1% last quarter
- Rank: #1267 by reach, #568 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/no-exclusive-tests` | yes | suggestion | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-6426/) |

## Code examples

### Incorrect: the rule reports this

```js
describe("MyClass", function () {
    it.only("should run correctly", function () {
        /*...*/
    });
});
```

### Correct: the rule accepts this

```js
describe("MyClass", function () {
    it("should run correctly", function () {
        /*...*/
    });
});
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "sonarjs/no-exclusive-tests": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [SonarJS recommended](https://lintradar.dev/presets/sonarjs-recommended.md) | ESLint | `eslint-plugin-sonarjs` | 230 | 6.2M | +62.1% |

## Related rules

- [sonarjs/no-equals-in-for-termination](https://lintradar.dev/rules/sonarjs/no-equals-in-for-termination.md): Equality operators should not be used in "for" loop termination conditions
- [sonarjs/no-extra-arguments](https://lintradar.dev/rules/sonarjs/no-extra-arguments.md): Function calls should not pass extra arguments
- [sonarjs/no-empty-test-title](https://lintradar.dev/rules/sonarjs/no-empty-test-title.md): Test and suite titles should not be empty or whitespace-only
- [sonarjs/no-fallthrough](https://lintradar.dev/rules/sonarjs/no-fallthrough.md): Switch cases should end with an unconditional "break" statement
- [sonarjs/no-empty-parameterized-test-dataset](https://lintradar.dev/rules/sonarjs/no-empty-parameterized-test-dataset.md): Parameterized tests should not have empty datasets
- [sonarjs/no-fixed-wait-in-tests](https://lintradar.dev/rules/sonarjs/no-fixed-wait-in-tests.md): Fixed waits should not be used in tests

---

Web page: https://lintradar.dev/rules/sonarjs/no-exclusive-tests. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
