Skip to content

trunk-io/trunk-playwright-reporter

Repository files navigation

Trunk.io docs vscode slack openssf

Trunk.io Playwright Reporter

This package exports a Playwright custom reporter for integration with Trunk Flaky Tests.

Installation

Install the package using your preferred package manager:

npm install @trunkio/trunk-playwright-reporter

Configuration

Set the reporter using either option below.

Option 1: Configuration File

Update your playwright.config.ts to include the reporter:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  reporter: [
    ['list'], // You can keep your preferred console reporter
    [
        '@trunkio/trunk-playwright-reporter',
        { outputFile: '/custom/path/your_file_name.xml'}
    ]
  ],
  // ... other config options
});

Option 2: Command Line

Use the reporter directly from the command line:

npx playwright test --reporter="@trunkio/trunk-playwright-reporter"

File Output

By default, the reporter outputs a file named junit.xml at the root of your project. You can specify a different filename in your Playwright config or via an environment variable.

PLAYWRIGHT_JUNIT_OUTPUT_FILE=/custom/path/your_file_name.xml

Examples

See the test/target/ directory for a complete example project that demonstrates how to use the Trunk Reporter in an existing Playwright testsuite.

Why Trunk Reporter?

While Playwright includes a built-in JUnit reporter, the Trunk Reporter offers:

  • Better Trunk.io Integration - Trunk-optimized JUnit output
  • Simplified Configuration - Easier setup and maintenance
  • Focused Functionality - Purpose-built for Trunk Flaky Tests
  • Accurate testsuite/classname - Uses suite/title semantics instead of file-name fallbacks for cleaner grouping
  • Full file path - Emits source location so downstream tools can deep-link to code.

Note

Who is this for?
Anyone producing JUnit XML from Playwright. It’s optimized for Trunk Flaky Tests, but the output benefits any JUnit consumer (CI parsers, dashboards, or artifact analysis).


Made with ❤️ by the Trunk.io team

Releases

No releases published