npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@playwright-labs/reporter-core

v1.2.0

Published

Base reporter class and shared types (TestCases, Template, StatusCounts) for @playwright-labs reporter packages

Readme

@playwright-labs/reporter-core

Base reporter class and shared types for the @playwright-labs/reporter-* packages — one unified API instead of every reporter re-implementing test-case accumulation and static-or-template option resolution.

You usually don't need this package directly. It is a dependency of the reporter packages — install the reporter you want (reporter-otel, reporter-slack, reporter-email, …) and it comes along. Use it directly when writing your own reporter.

Install

npm i -D @playwright-labs/reporter-core

What it provides

| Export | Purpose | |---|---| | BaseReporter | Abstract Reporter implementation: accumulates TestCases in onTestEnd, keeps per-status counts, stores config, resolves Template options, printsToStdio() === false | | TestCases | [test: TestCase, result: TestResult][] — every finished test with its result, in execution order | | Template<T> | T \| ((result: FullResult, testCases: TestCases) => T \| Promise<T>) — static value or dynamic template | | StatusCounts | { passed, failed, timedOut, skipped, interrupted } | | isExpectPollStep | Detects expect.poll / toPass steps (by title or by expect-category child attempt steps) | | getExpectPollInfo | Returns { attempts, outcome: "pass" \| "timeout" } for a poll step, null otherwise — used by reporters to export expect_poll_* metrics |

Writing your own reporter

import { BaseReporter, type Template } from "@playwright-labs/reporter-core";
import type { FullConfig, FullResult, Suite, TestCase, TestResult } from "@playwright/test/reporter";

type Options = {
  webhookUrl: string;
  /** static text or a dynamic template */
  text?: Template;
};

export default class MyReporter extends BaseReporter {
  constructor(private readonly options: Options) {
    super();
  }

  // Always call the super hooks when overriding — accumulation depends on them.
  override onBegin(config: FullConfig, suite: Suite): void {
    super.onBegin(config, suite);
    // your setup (SDKs, connections, …)
  }

  override onTestEnd(test: TestCase, result: TestResult): void {
    super.onTestEnd(test, result);
    // your per-test logic (metrics, spans, …)
  }

  async onEnd(result: FullResult): Promise<void> {
    const text = await this.resolveTemplate(this.options.text, result);
    await fetch(this.options.webhookUrl, {
      method: "POST",
      body: JSON.stringify({
        text: text ?? `${this.counts.passed} passed, ${this.counts.failed} failed`,
      }),
    });
  }
}

resolveTemplate(value, result) calls value(result, this.testCases) when the option is a function (awaiting promises) and returns it unchanged otherwise — the same (result, testCases) contract that reporter-email and reporter-slack use for their html/text/blocks templates.

License

MIT