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

@codspeed/playwright-plugin

v5.7.1

Published

Playwright benchmarking integration for CodSpeed

Readme

Playwright integration for CodSpeed, to drive an app through Playwright and report measured user flows.

CI npm (scoped) Discord CodSpeed Badge

[!NOTE] The @codspeed/playwright-plugin integration currently supports only the walltime instrument. CPU Simulation is not available.

@codspeed/playwright-plugin is the CodSpeed integration for Playwright. It runs a user-defined flow against a target application, measures the time spent inside that flow, and reports it to CodSpeed. The flow itself is plain Playwright code, so anything Playwright can drive can be benchmarked.

[!IMPORTANT] Today the plugin supports Electron apps as a target. Browser-based targets (existing dev servers, static builds, hosted URLs) are on the roadmap and will be added under the same bench API.

Documentation

Check out the documentation for complete integration instructions.

Installation

Install the plugin alongside playwright:

npm install --save-dev @codspeed/playwright-plugin playwright

or with yarn:

yarn add --dev @codspeed/playwright-plugin playwright

or with pnpm:

pnpm add --save-dev @codspeed/playwright-plugin playwright

Example usage with Electron

Build your Electron app first so the main entrypoint exists (e.g., out/main/index.js), then declare a benchmark with target.kind set to "electron":

import { bench } from "@codspeed/playwright-plugin";
import path from "node:path";

bench(
  "inbox-search",
  async ({ page }) => {
    await page.fill("#search", "quarterly report");
    await page.waitForSelector("#results");
  },
  {
    target: {
      kind: "electron",
      appPath: path.resolve("out/main/index.js"),
    },
    beforeRound: async ({ page }) => {
      await page.waitForSelector("#main:not(.loading)");
    },
    rounds: 5,
  },
);

For each round, the plugin launches Electron with the provided main entrypoint, waits for the first window, runs beforeRound, measures fn, runs afterRound, then closes the app.

API

The plugin exposes a single bench function. Its shape is target-agnostic:

import { bench } from "@codspeed/playwright-plugin";

bench(name, fn, options);

| Argument | Type | Required | Description | | --------- | ------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | name | string | yes | Identifier of the benchmark, used by CodSpeed to track it across runs. | | fn | ({ page }) => void \| Promise<void> | yes | The function whose execution time is measured. Receives a Playwright Page bound to the target. Everything inside fn counts toward the reported timing. | | options | BenchOptions | yes | Target configuration and benchmark settings, detailed below. |

Options

| Option | Type | Default | Description | | ------------- | ------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | target | Target | (required) | Discriminated union describing what to drive. The kind field selects the target; the remaining fields are specific to that kind. Current variants: { kind: "electron", ... }. | | rounds | number | 1 | Number of measurement rounds. Can be overridden at runtime via the CODSPEED_PLAYWRIGHT_ROUNDS environment variable. | | beforeRound | ({ page }) => void \| Promise<void> | — | Runs before each round, after the target is ready. Use it to bring the app to a ready state. Not measured. | | afterRound | ({ page }) => void \| Promise<void> | — | Runs after each round, before the target is torn down. Not measured. |

Electron target options

| Option | Type | Default | Description | | ------------------------------- | ------------ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | target.kind | "electron" | (required) | Selects the Electron target. | | target.appPath | string | (required) | Absolute path to the Electron main entrypoint, e.g., out/main/index.js. | | target.electronArgs | string[] | [] | Extra CLI flags forwarded to the Electron process. | | target.cwd | string | process.cwd() | Working directory for the Electron process. Also the directory electron is resolved from when target.electronExecutablePath is not set. | | target.electronExecutablePath | string | resolved electron | Absolute path to the Electron binary. Only set this to override the default resolution. |

Running the benchmarks locally

With node 24+, you can run typescript files directly:

$ node bench/inbox.bench.ts
[CodSpeed] [round 1/5] 42.13 ms
[CodSpeed] [round 2/5] 41.78 ms
[CodSpeed] [round 3/5] 42.05 ms
[CodSpeed] [round 4/5] 41.92 ms
[CodSpeed] [round 5/5] 42.21 ms

Locally, bench runs the app and prints per-round timings to the terminal. Results are uploaded to CodSpeed only when running in the CI environment or when using the CodSpeed CLI.