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

@cuioss/playwright-test-artifacts

v0.1.1

Published

Playwright test artifact infrastructure - captures browser logs, network errors, and screenshots per test

Readme

@cuioss/playwright-test-artifacts

Status

Node.js CI License npm

Quality Gate Status Lines of Code

What is it?

A standalone npm package providing Playwright test artifact infrastructure. It captures browser console logs, JavaScript errors, network failures, and full-page screenshots for every test — automatically. All artifacts are persisted to Playwright's per-test testInfo.outputDir, making them immediately available in CI reports and local debugging.

Installation

npm install @cuioss/playwright-test-artifacts

Quick Start

// tests/fixtures.js
import { test as base } from "@playwright/test";
import { createArtifactFixture } from "@cuioss/playwright-test-artifacts";

export const test = base.extend(createArtifactFixture());
export { expect } from "@playwright/test";
// tests/example.spec.js
import { test, expect } from "./fixtures.js";

test("homepage loads", async ({ page }) => {
    await page.goto("https://example.com");
    await expect(page).toHaveTitle(/Example/);
});
// -> Artifacts automatically saved: start-test.png (if using takeStartScreenshot),
//    browser.log, test-run.log, end-tests.png

API

| Export | Type | Description | |--------|------|-------------| | TestLogger | Class | Unified logger capturing browser and Node-side logs per test. | | testLogger | Instance | Singleton TestLogger instance for convenient reuse. | | takeStartScreenshot | async function(page, testInfo) | Takes a full-page screenshot named start-test.png at the start of a test. | | createArtifactFixture | function(options?) | Factory returning a Playwright fixture definition for test.extend(). |

Per-Test Artifact Contract

Each test using the artifact fixture produces these files in testInfo.outputDir:

| File | Description | |------|-------------| | start-test.png | Full-page screenshot taken at test start (requires explicit takeStartScreenshot call or beforeUse hook). | | browser.log | Browser console messages, JavaScript exceptions, and HTTP errors (status >= 400). | | test-run.log | Node-side log entries from custom logger.info() / logger.warn() / logger.error() calls. | | end-tests.png | Full-page screenshot taken automatically during teardown. |

Output Directory

Playwright automatically creates a separate subdirectory per test inside outputDir, so each test's artifacts are isolated. The subdirectory name is derived from the test file and test title.

test-results/
├── homepage-loads-chromium/
│   ├── browser.log
│   ├── test-run.log
│   └── end-tests.png
└── login-works-chromium/
    ├── browser.log
    ├── test-run.log
    └── end-tests.png

The base outputDir is configured in your playwright.config.js. Playwright's default is test-results/ at your project root.

// playwright.config.js — default (npm projects)
import { defineConfig } from "@playwright/test";

export default defineConfig({
    outputDir: "test-results",
});

For Maven-style projects that follow the target/ convention:

// playwright.config.js — Maven-style project
import { defineConfig } from "@playwright/test";

export default defineConfig({
    outputDir: "target/test-results",
});

Advanced Usage

Custom logger instance

import { test as base } from "@playwright/test";
import { TestLogger, createArtifactFixture } from "@cuioss/playwright-test-artifacts";

const myLogger = new TestLogger();
export const test = base.extend(createArtifactFixture({ logger: myLogger }));

beforeUse / afterUse hooks

import { test as base } from "@playwright/test";
import {
    createArtifactFixture,
    takeStartScreenshot,
} from "@cuioss/playwright-test-artifacts";

export const test = base.extend(
    createArtifactFixture({
        async beforeUse(page, testInfo) {
            // Runs after logger setup, before test body
            await takeStartScreenshot(page, testInfo);
        },
        async afterUse(page, testInfo) {
            // Runs after logs are written — e.g. custom cleanup
            console.log(`Artifacts saved to ${testInfo.outputDir}`);
        },
    }),
);

Manual TestLogger usage

import { testLogger } from "@cuioss/playwright-test-artifacts";

// Inside a Playwright test or helper
testLogger.info("MyHelper", "Navigating to login page");
testLogger.warn("MyHelper", "Unexpected redirect detected");
testLogger.error("MyHelper", "Login failed with status 401");

License

Apache License 2.0