{
  "slug": "playwright-reporters-can-filter-tests-with-reporter-preprocess-def815566117",
  "title": "Playwright reporters can filter tests with reporter.preprocess()",
  "tools": [
    "playwright"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-07-24T21:55:03.000Z",
  "announced_at": "2026-07-24T21:55:03.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When selected tests must be skipped before the run begins, implement `Reporter.preprocess()` and call `testRun.skip(test)` for each matching test in `suite.allTests()`.",
    "examples": [
      "class MyReporter {\n  async preprocess({ config, suite, testRun }) {\n    for (const test of suite.allTests()) {\n      if (shouldSkip(test)) // Replace with your selection condition.\n        testRun.skip(test);\n    }\n  }\n}"
    ],
    "gotchas": [
      "Version: v1.62.0",
      "config (required): Resolved configuration passed to `preprocess`.",
      "suite (required): Root suite; `suite.allTests()` returns tests in it and its descendants. It reflects project, grep, and `.only` filtering; setup and dependency projects are read-only.",
      "testRun (required): Controls which tests run and their expected status.",
      "test (required): `TestCase` or `Suite` to skip; test bodies are not executed and tests are reported as skipped.",
      "reason: Optional explanation surfaced as the annotation description by `testRun.skip(test, reason)`.",
      "Prerequisite: Playwright v1.62 or later; `reporter.preprocess()` and `testRun.skip()` were added in v1.62.",
      "The hook runs after configuration is resolved and before `reporter.onBegin()`.",
      "The release says the hook lets reporters mark tests skipped, excluded, fixed, or failing through a `TestRun` object."
    ]
  },
  "why_it_matters": "Skip selected tests in a reporter after configuration resolution and before the run begins.",
  "sources": [
    "https://github.com/microsoft/playwright/releases/tag/v1.62.0",
    "https://playwright.dev/docs/api/class-reporter",
    "https://playwright.dev/docs/api/class-testrun"
  ],
  "rank": 0.98046,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v1+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "backfill-20261007",
    "verdict_id": "backfill-20261007:backfill-20261007-48c92cac04e84aed-3:gate",
    "evidence_hash": "b17276139b84e8e6a01d64416d3a7c27f07ddffc91b7a327300bf595585d287e"
  },
  "review": {
    "draft_hash": "b38fa1197a919d7e09a162e17c46ceaec6472ffd54d0418247a41bbd0028dfd8",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "backfill-20261007:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.98 >= 0.9; 2 needed) and Jev gave 0.64 (>= 0.6 needed)."
  }
}
