# vitest/no-focused-tests

> Disallow `test.only` and `describe.only`

`.only` makes Vitest run that test and skip every other one in the file. It's useful while debugging. If you commit it by accident, it hides failures in the tests that no longer run.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"vitest/no-focused-tests" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 2} */}
```ts
import { describe, expect, test } from "vitest";

test.only("adds", () => {
  expect(1 + 1).toBe(2);
});

describe.only("subtraction", () => {
  test("subtracts", () => {
    expect(2 - 1).toBe(1);
  });
});
```

Not reported:

{/* good */}
```ts
import { describe, expect, test } from "vitest";

test("adds", () => {
  expect(1 + 1).toBe(2);
});

describe("subtraction", () => {
  test("subtracts", () => {
    expect(2 - 1).toBe(1);
  });
});
```
