Registry / testing / pw-test-logs-reporter

pw-test-logs-reporter

JSON →
library1.0.1jsnpmunverified

pw-test-logs-reporter is a specialized Playwright test reporter designed to automatically send details of failed test cases to a configurable external API endpoint. Currently at version 1.0.1, this package offers a simple, purpose-built solution for integrating Playwright's test results into external logging or incident management systems, with a specific focus on capturing and reporting only test failures. It integrates directly into Playwright's configuration via a string reference in the `reporter` array, and requires the `FAILED_TEST_RESULTS_ENDPOINT` environment variable to be set for operation. Its release cadence is likely stable and infrequent, given its targeted functionality. It differentiates itself by its singular focus on failed tests and straightforward API reporting, providing a lean alternative to more comprehensive, all-encompassing reporting solutions.

npm install pw-test-logs-reporter
INSTALL
IMPORT
SIG · PW-TEST-LOGS-REPOR
P
pw-test-logs-reporter
testingjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PwTestLogsReporter
import PwTestLogsReporter from 'pw-test-logs-reporter';
import { PwTestLogsReporter } from 'pw-test-logs-reporter';
The reporter class is exported as a default export for programmatic use or extension. Its primary usage, however, is via a string reference in the Playwright configuration.
PwTestLogsReporter (type)
import type { PwTestLogsReporter } from 'pw-test-logs-reporter';
Type-only import for the reporter class, useful for TypeScript projects when not instantiating the class directly.
PwTestLogsReporter (CommonJS)
const PwTestLogsReporter = require('pw-test-logs-reporter').default;
const PwTestLogsReporter = require('pw-test-logs-reporter');
For CommonJS environments, the class is accessed via the `.default` property due to the default export.

This configuration shows how to add `pw-test-logs-reporter` to your Playwright test setup, alongside the standard 'list' reporter. It sets up a basic Playwright project and emphasizes the critical `FAILED_TEST_RESULTS_ENDPOINT` environment variable.

import { defineConfig } from '@playwright/test'; const FAILED_ENDPOINT = process.env.FAILED_TEST_RESULTS_ENDPOINT ?? 'http://localhost:8080/api/failed-tests'; // playwright.config.ts const config = defineConfig({ testDir: './tests', // Specify your test directory reporter: [ ["list"], // Standard list reporter ["pw-test-logs-reporter"] ], use: { // Base URL to use in actions like `await page.goto('/')`. baseURL: 'http://127.0.0.1:3000', trace: 'on-first-retry', }, projects: [ { name: 'chromium', use: { browserName: 'chromium', }, } ] }); export default config;
Debug
Known issues
gotchaThe `FAILED_TEST_RESULTS_ENDPOINT` environment variable is mandatory for the reporter to function correctly. If this variable is not set, the reporter will likely fail to send any test results, and may throw an error or warning during the test run.
fix
Ensure `FAILED_TEST_RESULTS_ENDPOINT` is set in your environment before running tests. Example: `export FAILED_TEST_RESULTS_ENDPOINT='https://your-api.com/failed-tests'` or in a `.env` file.
affects: >=1.0.0
Errors
Common errors & fixes
Reporter "pw-test-logs-reporter" cannot be found.
The package `pw-test-logs-reporter` is either not installed or Playwright cannot resolve its path.
fix
Run `npm install pw-test-logs-reporter` or `yarn add pw-test-logs-reporter` to install the package. Verify that it's listed in your `node_modules` and accessible to Playwright.
Error: FAILED_TEST_RESULTS_ENDPOINT environment variable is not set.
The reporter class relies on the `FAILED_TEST_RESULTS_ENDPOINT` environment variable to determine where to send the failed test logs.
fix
Set the `FAILED_TEST_RESULTS_ENDPOINT` environment variable in your shell or CI/CD pipeline. For example, `export FAILED_TEST_RESULTS_ENDPOINT='http://your.api.com/logs'` before running your Playwright tests.
TypeError: Cannot read properties of undefined (reading 'default')
This typically occurs in a CommonJS environment when trying to `require()` a package that uses a default export without specifying `.default`.
fix
If using `require()`, ensure you access the default export correctly: `const PwTestLogsReporter = require('pw-test-logs-reporter').default;`.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Amazon
1
OpenAI (training)
1
Resources
pw-test-logs-reporter — npm install pw-test-logs-reporter · libregistry