<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/playwright-custom-reporters-build-your-own-bhnehoaur" -->

---
title: Playwright Custom Reporters: Build Your Own | daily.dev
description: A deep technical walkthrough of building custom Playwright reporters covers the full Reporter interface (10 lifecycle hooks plus printsToStdio), the...
canonical: https://daily.dev/posts/playwright-custom-reporters-build-your-own-bhnehoaur
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Playwright Custom Reporters: Build Your Own | daily.dev
og:description: A deep technical walkthrough of building custom Playwright reporters covers the full Reporter interface (10 lifecycle hooks plus printsToStdio), the...
og:url: https://daily.dev/posts/playwright-custom-reporters-build-your-own-bhnehoaur
og:image: https://api.daily.dev/og/posts/bHnEhoaur.png
og:image:alt: Playwright Custom Reporters: Build Your Own
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Playwright Custom Reporters: Build Your Own

**[Currents](https://daily.dev/sources/currents)** · 42 min read · 0 upvotes · 0 comments

## Summary

A deep technical walkthrough of building custom Playwright reporters covers the full Reporter interface (10 lifecycle hooks plus printsToStdio), the Suite/TestCase/TestResult object model, and the architectural decisions needed to keep a reporter reliable in production CI. Topics include sync vs async hook behavior, Playwright's silent error swallowing, state accumulation across parallel workers, event ordering guarantees, sharding and shard-aware file naming, the blob reporter plus merge-reports workflow, attachment lifecycle and preserveOutput pitfalls, testing strategies (unit, integration fixture suites, sharding tests, silent-failure tests), and the ongoing maintenance burden of version compatibility, feature creep, monitoring, and bus factor. Closes with a framework for deciding whether to build a custom reporter or adopt a platform like Currents.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://currents.dev/posts/playwright-custom-reporters-build-your-own>

## Questions this post answers

### How do I avoid false failure alerts from Playwright retries in a custom reporter?

Use test.outcome() inside onEnd instead of checking result.status inside onTestEnd. With retries configured, onTestEnd fires once per attempt, so a test that fails then passes on retry will trigger a false alert if you react to result.status directly. test.outcome() collapses retries and returns 'flaky' for a test that eventually passed and 'unexpected' only for a test that failed every attempt, so only 'unexpected' should trigger a notification.

_Anyone building failure alerts on Playwright can compare notes on reporter patterns via daily.dev._

### Why does my async onTestEnd hook in a Playwright reporter lose data or throw unhandled errors?

Playwright does not await Promises returned from onTestEnd, onTestBegin, or the step hooks, only onEnd and onExit are awaited. An async onTestEnd that awaits an HTTP call returns a pending Promise that gets dropped, so errors surface as unhandled rejections and ordering guarantees are lost. The fix is to do synchronous work in onTestEnd, storing data in instance state, and defer real I/O to onEnd or onExit.

_Developers debugging flaky CI reporters can track patterns like this on daily.dev while shipping Playwright integrations._

### How do I make a custom Playwright reporter work correctly with sharded test runs?

Detect sharding in onBegin via config.shard, which is null when unsharded or an object with a one-based current index and a total count, e.g. shard 1 of 4 is {total:4, current:1}. Each shard runs its own Playwright process and reporter instance with no cross-shard aggregation, so file-based reporters must include the shard number in output filenames and webhook-based reporters must include shard context in every payload or rely on Playwright's built-in blob reporter plus merge-reports since v1.37 to unify events across shards.

_Teams scaling Playwright test suites across shards can follow reporting and CI patterns like this on daily.dev._

## Similar posts on daily.dev

- [Best Test Reporting Tools for Playwright in CI, Compared](https://daily.dev/posts/best-test-reporting-tools-for-playwright-in-ci-compared-pmsifgk90) · Currents · 0 upvotes · 0 comments
- [Playwright 1.65 in CI: Breaking Changes, Bun and Reports](https://daily.dev/posts/playwright-1-65-in-ci-breaking-changes-bun-and-reports-zkvcymks7) · Currents · 1 upvotes · 1 comments
- [Build a Playwright Framework with Isolated Browser State](https://daily.dev/posts/build-a-playwright-framework-with-isolated-browser-state-kl2th5rwl) · Medium · 7 upvotes · 0 comments
- [The Playwright debugging tool Rails devs aren't using](https://daily.dev/posts/the-playwright-debugging-tool-rails-devs-aren-t-using-9t2usr3w7) · thoughbot · 0 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#typescript](https://daily.dev/tags/typescript), [#cicd](https://daily.dev/tags/cicd)

[View this post on daily.dev](https://daily.dev/posts/playwright-custom-reporters-build-your-own-bhnehoaur)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Playwright Custom Reporters: Build Your Own","url":"https://daily.dev/posts/playwright-custom-reporters-build-your-own-bhnehoaur","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/playwright-custom-reporters-build-your-own-bhnehoaur"},"datePublished":"2026-09-06T08:56:37.741Z","dateModified":"2026-09-06T12:15:16.387Z","description":"A deep technical walkthrough of building custom Playwright reporters covers the full Reporter interface (10 lifecycle hooks plus printsToStdio), the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/dc383e20621508b3435182fba9a50acf?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/dc383e20621508b3435182fba9a50acf?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Currents","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Currents","logo":"https://media.daily.dev/image/upload/s--RxsiMZ1S--/f_auto,q_auto/v1788684994/logos/currents?_a=BAMAMicg0","url":"https://daily.dev/sources/currents"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/playwright-custom-reporters-build-your-own-bhnehoaur","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"testing,typescript,cicd","timeRequired":"PT42M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Currents","item":"https://daily.dev/sources/currents"},{"@type":"ListItem","position":3,"name":"Playwright Custom Reporters: Build Your Own"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/playwright-custom-reporters-build-your-own-bhnehoaur#faq","mainEntity":[{"@type":"Question","name":"How do I avoid false failure alerts from Playwright retries in a custom reporter?","acceptedAnswer":{"@type":"Answer","text":"Use test.outcome() inside onEnd instead of checking result.status inside onTestEnd. With retries configured, onTestEnd fires once per attempt, so a test that fails then passes on retry will trigger a false alert if you react to result.status directly. test.outcome() collapses retries and returns 'flaky' for a test that eventually passed and 'unexpected' only for a test that failed every attempt, so only 'unexpected' should trigger a notification. Anyone building failure alerts on Playwright can compare notes on reporter patterns via daily.dev."}},{"@type":"Question","name":"Why does my async onTestEnd hook in a Playwright reporter lose data or throw unhandled errors?","acceptedAnswer":{"@type":"Answer","text":"Playwright does not await Promises returned from onTestEnd, onTestBegin, or the step hooks, only onEnd and onExit are awaited. An async onTestEnd that awaits an HTTP call returns a pending Promise that gets dropped, so errors surface as unhandled rejections and ordering guarantees are lost. The fix is to do synchronous work in onTestEnd, storing data in instance state, and defer real I/O to onEnd or onExit. Developers debugging flaky CI reporters can track patterns like this on daily.dev while shipping Playwright integrations."}},{"@type":"Question","name":"How do I make a custom Playwright reporter work correctly with sharded test runs?","acceptedAnswer":{"@type":"Answer","text":"Detect sharding in onBegin via config.shard, which is null when unsharded or an object with a one-based current index and a total count, e.g. shard 1 of 4 is {total:4, current:1}. Each shard runs its own Playwright process and reporter instance with no cross-shard aggregation, so file-based reporters must include the shard number in output filenames and webhook-based reporters must include shard context in every payload or rely on Playwright's built-in blob reporter plus merge-reports since v1.37 to unify events across shards. Teams scaling Playwright test suites across shards can follow reporting and CI patterns like this on daily.dev."}}]}
```

