Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#42739·Playwright

[Feature]: Export type for Reporter from packages/playwright/src/reporters/list.ts

Author: bpceeeCreated Sep 16, 2026Updated Sep 16, 2026

Please export TypeScript types for the built-in list reporter so it can be extended in a custom reporter.

Usage example

Add the worker slot like [workerId=0] to completed test lines while reusing the built-in list formatting.
The import below illustrates the extended Reporter Class.

import type { TestCase, TestResult, TestStep } from '@playwright/test/reporter';
import ListReporter from 'playwright/lib/reporters/list';

export default class WorkerListReporter extends ListReporter {
  private parallelIndex: number | undefined;

  onTestEnd(test: TestCase, result: TestResult): void {
    this.parallelIndex = result.parallelIndex;
    try {
      super.onTestEnd(test, result);
    } finally {
      this.parallelIndex = undefined;
    }
  }

  formatTestTitle(test: TestCase, step?: TestStep): string {
    const title = super.formatTestTitle(test, step);
    return this.parallelIndex === undefined
      ? title
      : `[workerId=${this.parallelIndex}] ${title}`;
  }
}

Example output:

✓ 12 [workerId=0] [chromium] › example.spec.ts:3:1 › example (1.2s)

Source: microsoft/playwright

View original on GitHubView discussion on GitHub