Skip to content

[Feature]: Failures-only terminal reporter (suppress passing test output) #42702

Description

@rynz

🚀 Feature Request

Add a built-in way to suppress passing tests from terminal output entirely, so only failures (plus the final summary) are printed.

Today the closest options are:

None of them get to "print nothing unless something failed."

Could equally be a quiet/failuresOnly option on the existing list reporter rather than a new reporter name.

Example

npx playwright test --reporter=only-failures
  1) [chromium] › tests/checkout.spec.ts:42:3 › applies discount code

    Error: expect(received).toBe(expected)
    Expected: 1
    Received: 0

      44 |   await page.getByRole('button', { name: 'Apply' }).click();
    > 45 |   expect(await rows.count()).toBe(1);

  1 failed, 217 passed (1.2m)

Compared to today's line reporter on the same run, which prints 217 lines before the one that matters.

Motivation

On a large suite most runs are green, and the per-test lines are pure noise. They push the thing you actually care about off the top of the scrollback, and in CI they inflate log size for no benefit. Scanning hundreds of lines to find the one is a worse experience than being shown only the failure.

This has become sharper with coding agents. A tool call that runs the test suite returns its entire stdout into the model's context window, so a green run of 500 tests spends thousands of tokens saying "everything is fine." That context is finite and shared with the actual source files the agent needs to hold onto. Piping through grep is lossy and fragile, since it drops the stack trace and code frame that make a failure diagnosable. An official failures-only mode means the run costs near-zero context when it passes and full detail when it doesn't, which is exactly the shape you want.

Prior art: Bun added --only-failures for exactly this, alongside its dots reporter. Jest has jest-quiet-reporter in userland for the same reason.

Bun also ships an isAIAgent() check that reads AGENT=1 along with tool-specific variables, and Laravel Pint switches to --format agent when it detects CLAUDECODE, so tools adapting their output to agent context is an established pattern (see agentsmd/agents.md#136 for the push to standardize AGENT=1 as the agent equivalent of CI=true). Playwright could eventually default to failures-only under that signal, though an explicit flag is the useful first step and is valuable on its own.

A custom reporter works, but this seems common enough to be worth having out of the box.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions