This package exports a Playwright custom reporter for integration with Trunk Flaky Tests.
Install the package using your preferred package manager:
npm install @trunkio/trunk-playwright-reporter
Set the reporter using either option below.
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
});
Use the reporter directly from the command line:
npx playwright test --reporter="@trunkio/trunk-playwright-reporter"
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
See the test/target/ directory for a complete example project that demonstrates how to use the Trunk Reporter in an existing Playwright testsuite.
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