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

@orieken/saturday-cucumber-otel-formatter

v0.1.3

Published

OpenTelemetry formatter for CucumberJS in the Saturday Framework

Readme

@orieken/saturday-cucumber-otel-formatter

A custom CucumberJS formatter that integrates with the Saturday Framework to enhance observability. It sends test execution traces and metrics directly to OpenTelemetry (OTLP) endpoints.

Features

  • OpenTelemetry Tracing: Captures detailed traces for Test Runs, Scenarios, and Steps.
  • Hierarchical Context: Steps are child spans of Scenarios, which are child spans of the Test Run.
  • Status Reporting: Accurately reports Pass/Fail/Error statuses on spans.
  • Duration Tracking: Precise timing info for all execution units.

Installation

pnpm add @orieken/saturday-cucumber-otel-formatter

Configuration

The formatter uses standard OpenTelemetry environment variables for configuration:

| Variable | Description | Default | |----------|-------------|---------| | OTEL_SERVICE_NAME | Name of the service | cucumber-tests | | OTEL_EXPORTER_OTLP_ENDPOINT | OTLP HTTP Endpoint | (required) | | OTEL_SERVICE_VERSION | Service version | - | | OTEL_SERVICE_NAMESPACE | Service namespace | - | | OTEL_DEFAULT_ENVIRONMENT | Deployment environment | - | | OTEL_CUSTOM_CONFIG | Path to a custom configuration file. If not specified, looks for cucumber-otel.config.mjs or cucumber-otel.config.js in the project root. | - | | OTEL_DEBUG_LOGGING | Set to true to enable verbose logging of active handles and initialization steps for debugging hangs. | false |

Robustness Features

This formatter implements several reliability features to ensure data integrity:

  • Asynchronous Initialization: Configuration is loaded asynchronously to support remote or complex setups.
  • Graceful Shutdown: The formatter explicitly awaits the flushing of all OpenTelemetry spans before exiting, preventing data loss at the end of test runs.
  • Queueing: Events are queued during initialization so no trace data is lost during startup.

Usage

Register the formatter when running Cucumber-JS:

# Example running with environment variables
export OTEL_SERVICE_NAME="saturday-e2e-tests"
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318/v1/traces"

npx cucumber-js \
  --format @orieken/saturday-cucumber-otel-formatter \
  --require features/**/*.ts

Custom Configuration

You can define a cucumber-otel.config.mjs file in your project root to customize resource and scenario attributes:

export default {
  resourceAttributes: {
    'service.version': '1.0.0',
    'service.runner': 'cucumber'
  },
  // Custom logic for adding attributes to scenarios
  scenarioAttributes: (pickle, gherkinDocument) => {
    return {
      'custom.scenario.tags': pickle.tags.map(t => t.name).join(',')
    };
  },
  // Custom logic for adding attributes to steps
  stepAttributes: (pickleStep, gherkinStep) => {
    return {
      'custom.step.keyword': gherkinStep.keyword
    };
  }
};

Metrics

In addition to traces, this formatter automatically collects the following metrics:

  • cucumber.test.cases (Counter): Counts the number of executed test cases.
    • Labels: test.status ('passed' | 'error'), test.file

Sample Queries (PromQL)

Here are some example queries you can use in Grafana (Prometheus datasource) to visualize your test data:

Total Pass/Fail Count per Feature:

sum by (test_status, test_file) (cucumber_test_cases_total)

Success Rate (%):

sum(cucumber_test_cases_total{test_status="passed"}) / sum(cucumber_test_cases_total) * 100

Debugging & Diagnostics

| Variable | Description | Default | |----------|-------------|---------| | OTEL_SAVE_PAYLOADS | If true, saves the exact JSON payload sent to the OTel collector to ./reports/otel-cucumber-spans-<TIMESTAMP>.json | false | | OTEL_DEBUG_LOGGING | Set to true to enable verbose logging to console and otel-debug-init.log | false |

Trace Structure

  • test-run (Root Span)
    • scenario: <Scenario Name> (Child Span)
      • step: <Keyword> <Step Text> (Child Span)