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

js-tests-results-collector

v1.0.24

Published

Universal test results collector for Jest, Jasmine, Mocha, Cypress, and Playwright that sends results to Buddy Works API

Readme

JS Tests Results Collector

Universal test results collector for Jest, Jasmine, Mocha, Cypress, Playwright, and Vitest that sends results to Buddy Works API in real-time.

Features

  • 🚀 Real-time reporting - Test results are sent immediately after each test completion
  • 🔧 Multi-framework support - Works with Jest, Jasmine, Mocha, Cypress, Playwright, and Vitest
  • 📊 Buddy Works integration - Direct integration with Buddy Works Unit Tests API
  • Non-blocking - Won't slow down your test execution
  • 🛡️ Error resilience - API failures won't break your test runs
  • 🔍 Debug support - Built-in logging for troubleshooting

Installation

npm install js-tests-results-collector --save-dev

Configuration

Authentication

The Buddy Works API uses OAuth2 authentication with Bearer tokens. You need to generate an access token in your Buddy Works workspace settings.

To get an access token:

  1. Go to your Buddy Works workspace
  2. Navigate to Workspace SettingsDeveloper API
  3. Enable the API if not already enabled
  4. Generate or use an existing Personal Access Token

API Endpoints

Buddy Works has different API endpoints depending on your region and installation type:

  • US Region (default): https://api.buddy.works
  • EU Region: https://api.eu.buddy.works
  • On-premise: https://your-domain.buddy.works

Set the appropriate endpoint using the BUDDY_API_BASE_URL environment variable.

Environment Variables

Set the following environment variables:

# Required
BUDDY_WORKSPACE_DOMAIN=your-domain
BUDDY_PROJECT_NAME=your-project
BUDDY_FOLDER_ID=123                                    # must be an integer
BUDDY_ACCESS_TOKEN=your-oauth-access-token

# API Endpoint (choose based on your region/installation)
BUDDY_API_BASE_URL=https://api.buddy.works            # US region (default)
# BUDDY_API_BASE_URL=https://api.eu.buddy.works       # EU region
# BUDDY_API_BASE_URL=https://your-domain.buddy.works  # On-premise installation

# Optional
BUDDY_RUN_BRANCH=main                                  # defaults to current git branch
BUDDY_REF_TYPE=BRANCH                                  # defaults to BRANCH  
BUDDY_RUN_COMMIT=abc123                                # defaults to current git commit
BUDDY_RUN_PRE_COMMIT=def456                            # defaults to current git commit
BUDDY_RUN_HASH=build-123                               # optional build identifier
BUDDY_RUN_URL=https://example.com/builds/123           # optional build URL
BUDDY_SOURCE=API                                       # defaults to API
BUDDY_DEBUG=true                                       # enable debug logging

Usage

Jest

Add the reporter to your Jest configuration:

jest.config.js:

module.exports = {
  reporters: [
    'default',
    'js-tests-results-collector/jest'
  ]
};

Or in package.json:

{
  "jest": {
    "reporters": [
      "default",
      "js-tests-results-collector/jest"
    ]
  }
}

Mocha

Use the reporter with the --reporter flag:

mocha --reporter js-tests-results-collector/mocha test/**/*.js

Or in package.json:

{
  "scripts": {
    "test": "mocha --reporter js-tests-results-collector/mocha test/**/*.js"
  }
}

Jasmine

Add the reporter to your Jasmine configuration:

spec/support/jasmine.json:

{
  "spec_dir": "spec",
  "spec_files": ["**/*[sS]pec.js"],
  "helpers": [
    "helpers/**/*.js",
    "js-tests-results-collector/jasmine"
  ]
}

Cypress

Add the reporter to your Cypress configuration:

cypress.config.js:

const { defineConfig } = require('cypress');

module.exports = defineConfig({
  e2e: {
    reporter: 'js-tests-results-collector/cypress',
    // ... other config
  },
});

Playwright

Add the reporter to your Playwright configuration:

playwright.config.js:

module.exports = {
  reporter: [
    ['list'],
    ['js-tests-results-collector/playwright']
  ],
  // ... other config
};

Vitest

Add the reporter to your Vitest configuration:

vitest.config.js:

export default {
  test: {
    reporters: [
      'default',
      'js-tests-results-collector/vitest'
    ]
  }
};

Or in package.json:

{
  "scripts": {
    "test": "vitest run --reporter=default --reporter=js-tests-results-collector/vitest"
  }
}

How It Works

  1. Session Creation: When tests start, a session is created via Buddy Works API
  2. Real-time Reporting: Each test result is sent immediately after completion
  3. Result Mapping: Framework-specific results are mapped to Buddy's format
  4. Error Handling: API failures are logged but don't interrupt test execution

API Integration

The collector integrates with Buddy Works Unit Tests API:

Session Creation

POST /workspaces/{domain}/projects/{projectName}/unit-tests/folders/{folderId}/sessions

Test Case Submission

PUT /workspaces/{domain}/projects/{projectName}/unit-tests/folders/{folderId}/sessions/{sessionId}/cases

Test Result Format

Test results are mapped to the following format:

{
  "name": "Test case name",
  "suite_name": "Test suite name",
  "suite_id": "unique-suite-id",
  "classname": "test.file.path",
  "status": "PASSED|FAILED|SKIPPED|ERROR",
  "time": 1.234,
  "data": "Error message or additional data"
}

Debugging

Enable debug logging to troubleshoot issues:

BUDDY_DEBUG=true npm test

This will output detailed logs about:

  • Session creation
  • Test result submissions
  • API responses
  • Error details

Examples

Check the examples/ directory for complete configuration examples:

  • examples/jest-example/ - Jest configuration
  • examples/mocha-example/ - Mocha configuration
  • examples/jasmine-example/ - Jasmine configuration
  • examples/cypress-example/ - Cypress configuration
  • examples/playwright-example/ - Playwright configuration
  • examples/vitest-example/ - Vitest configuration

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

For issues and questions:

  • Check the debug logs with BUDDY_DEBUG=true
  • Review the examples in the examples/ directory
  • Open an issue on GitHub

Changelog

1.0.0

  • Initial release
  • Support for Jest, Jasmine, Mocha, Cypress, Playwright, and Vitest
  • Real-time test result reporting
  • Buddy Works API integration