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 🙏

© 2025 – Pkg Stats / Ryan Hefner

omni-mocha-reporter

v1.0.11

Published

Mocha reporter that publishes test results to Omni Dashboard

Downloads

946

Readme

Omni Mocha Reporter

A reporter that sends test results to Omni Dashboard via HTTP APIs. Supports both Mocha and WebdriverIO frameworks with automatic detection.

Features

  • Dual Framework Support: Works with both Mocha and WebdriverIO
  • Automatic Detection: Automatically selects the correct reporter based on context
  • TypeScript Support: Fully typed with TypeScript definitions
  • Zero Configuration: Works out of the box with environment variables

Installation

npm install omni-mocha-reporter

Peer Dependencies

For WebdriverIO projects, you also need:

npm install @wdio/reporter

Usage

For WebdriverIO Projects

The reporter automatically detects WebdriverIO context and uses the appropriate reporter. Simply add it to your wdio.conf.js:

exports.config = {
  // ... other config
  reporters: [
    'spec',
    ['omni-mocha-reporter', {
      // Optional: any WebdriverIO reporter options
    }]
  ],
  // ... other config
};

That's it! The package will automatically:

  • Detect that you're using WebdriverIO
  • Use the OmniWDIOReporter class
  • Handle all WebdriverIO events (onRunnerStart, onTestPass, onTestFail, etc.)

For Pure Mocha Projects

When running Mocha directly, the reporter automatically uses the Mocha implementation:

# Using environment variables
OMNI_DASHBOARD_PROJECT_ID=your_project_id \
OMNI_DASHBOARD_API_KEY=your_api_key \
OMNI_DASHBOARD_ENVIRONMENT=staging \
OMNI_DASHBOARD_BASE_URL=https://omni.testvagrant.ai/api/v1 \
npx mocha --reporter omni-mocha-reporter "test/**/*.spec.js"

Or in your mocha.opts or package.json:

{
  "scripts": {
    "test": "mocha --reporter omni-mocha-reporter"
  }
}

Explicit Usage (Advanced)

If you need to explicitly use a specific reporter:

const Reporter = require('omni-mocha-reporter');

// Use Mocha reporter explicitly
const mochaReporter = new Reporter.Mocha(runner, options);

// Use WebdriverIO reporter explicitly (if @wdio/reporter is available)
const wdioReporter = new Reporter.WebdriverIO(options);

Configuration

Environment Variables

The following environment variables are required:

  • OMNI_DASHBOARD_PROJECT_ID - Your Omni Dashboard project ID
  • OMNI_DASHBOARD_API_KEY - Your Omni Dashboard API key
  • OMNI_DASHBOARD_ENVIRONMENT - Environment (e.g., staging, production)
  • OMNI_DASHBOARD_BASE_URL - Base URL for Omni Dashboard API (defaults to https://omni.testvagrant.ai/api/v1)

How It Works

The package automatically detects which framework you're using:

  1. WebdriverIO Detection: If the first parameter passed to the reporter constructor has WebdriverIO-specific properties (outputDir, logFile, writeStream), it uses OmniWDIOReporter
  2. Mocha Detection: Otherwise, it uses OmniMochaReporter which works with Mocha's Runner object

Both reporters share the same base functionality (OmniReporterBase) for:

  • Creating builds
  • Uploading test cases
  • Completing builds
  • Queue management

Development

Building the Reporter

cd omni-mocha-reporter
npm run build

Adding New Tests

Add your test files to the omni-mocha-tests/demo/ directory with the .spec.ts extension.

API Integration

The reporter integrates with Omni Dashboard through the following API endpoints:

  1. Create Build - POST /projects/{projectId}/builds
  2. Upload Test Case - POST /projects/{projectId}/test-cases
  3. Complete Build - PATCH /projects/{projectId}/builds?build_id={buildId}

License

TBD