## TL;DR
Run your CI test command with the `--forbid-only` flag; any committed `test.only` (or `describe.only`) fails the run immediately. Add it to the CI script once and it guards every future PR. Pair it with a lint rule so editors catch it before commit.

## Problem
A `test.only` slipped into a merged PR, so CI ran one test, reported green, and the rest of the suite never executed.

## Steps
1. Add `--forbid-only` to the CI test command: `npx playwright test --forbid-only`. Expected: the command exits non-zero if any focused test exists.
2. Push a branch containing a `test.only` and watch CI fail fast. Expected: CI fails with a forbid-only error before running any tests.
3. Add the `no-focused-test` rule from `eslint-plugin-playwright` to your lint config so it is caught locally too. Expected: the linter flags `test.only` lines on the next run.
4. Remove the committed `.only` and merge. Expected: the full suite runs green in CI.

## When to use
- Setting up a CI pipeline for a Playwright suite.
- A focused test was committed before and you want it to never happen again.
- You want a fast, zero-maintenance guard rather than code review vigilance.

## When not to use
- Debugging why only one test runs on your machine (just delete the `.only`).
- Choosing which tests to run per PR (use projects, tags, or grep for that).
- You use a different runner where `--forbid-only` does not exist.

## Tool compatibility
- Playwright 1.40 through 1.5x (`--forbid-only` is a long-standing CLI flag).
- `eslint-plugin-playwright` 1.x and 2.x for the `no-focused-test` rule.

## Variant phrasings
### how to block test.only in playwright CI pipeline
Same answer: `--forbid-only` on the CI command.
### detect focused tests before merge playwright
Same guard; the lint rule adds a pre-commit layer on top.

## Why it happens
`test.only` is meant for local debugging, but nothing stops it from being committed. Without a guard, CI happily runs the single focused test, reports green, and nobody notices the other 500 tests never ran.

## Edge cases
- `--forbid-only` in the shared npm script also affects local runs; keep it in the CI yaml command or gate it behind an env check.
- A `test.only` inside a skipped file still trips the flag; remove all of them.
- Monorepo with several configs: the flag must be on every `playwright test` invocation.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_VHlpjJaKP7eyHRvd5MbsmQ
