Gathering detailed insights and metrics for js-tests-results-collector
Gathering detailed insights and metrics for js-tests-results-collector
Gathering detailed insights and metrics for js-tests-results-collector
Gathering detailed insights and metrics for js-tests-results-collector
npm install js-tests-results-collector
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Universal test results collector for Jest, Jasmine, Mocha, Cypress, Playwright, and Vitest that sends results to Buddy Works API in real-time.
1npm install js-tests-results-collector --save-dev
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:
Buddy Works has different API endpoints depending on your region and installation type:
https://api.buddy.works
https://api.eu.buddy.works
https://your-domain.buddy.works
Set the appropriate endpoint using the BUDDY_API_BASE_URL
environment variable.
Set the following environment variables:
1# Required 2BUDDY_WORKSPACE_DOMAIN=your-domain 3BUDDY_PROJECT_NAME=your-project 4BUDDY_FOLDER_ID=123 # must be an integer 5BUDDY_ACCESS_TOKEN=your-oauth-access-token 6 7# API Endpoint (choose based on your region/installation) 8BUDDY_API_BASE_URL=https://api.buddy.works # US region (default) 9# BUDDY_API_BASE_URL=https://api.eu.buddy.works # EU region 10# BUDDY_API_BASE_URL=https://your-domain.buddy.works # On-premise installation 11 12# Optional 13BUDDY_RUN_BRANCH=main # defaults to current git branch 14BUDDY_REF_TYPE=BRANCH # defaults to BRANCH 15BUDDY_RUN_COMMIT=abc123 # defaults to current git commit 16BUDDY_RUN_PRE_COMMIT=def456 # defaults to current git commit 17BUDDY_RUN_HASH=build-123 # optional build identifier 18BUDDY_RUN_URL=https://example.com/builds/123 # optional build URL 19BUDDY_SOURCE=API # defaults to API 20BUDDY_DEBUG=true # enable debug logging
Add the reporter to your Jest configuration:
jest.config.js:
1module.exports = { 2 reporters: [ 3 'default', 4 'js-tests-results-collector/jest' 5 ] 6};
Or in package.json:
1{ 2 "jest": { 3 "reporters": [ 4 "default", 5 "js-tests-results-collector/jest" 6 ] 7 } 8}
Use the reporter with the --reporter
flag:
1mocha --reporter js-tests-results-collector/mocha test/**/*.js
Or in package.json:
1{ 2 "scripts": { 3 "test": "mocha --reporter js-tests-results-collector/mocha test/**/*.js" 4 } 5}
Add the reporter to your Jasmine configuration:
spec/support/jasmine.json:
1{ 2 "spec_dir": "spec", 3 "spec_files": ["**/*[sS]pec.js"], 4 "helpers": [ 5 "helpers/**/*.js", 6 "js-tests-results-collector/jasmine" 7 ] 8}
Add the reporter to your Cypress configuration:
cypress.config.js:
1const { defineConfig } = require('cypress'); 2 3module.exports = defineConfig({ 4 e2e: { 5 reporter: 'js-tests-results-collector/cypress', 6 // ... other config 7 }, 8});
Add the reporter to your Playwright configuration:
playwright.config.js:
1module.exports = { 2 reporter: [ 3 ['list'], 4 ['js-tests-results-collector/playwright'] 5 ], 6 // ... other config 7};
Add the reporter to your Vitest configuration:
vitest.config.js:
1export default { 2 test: { 3 reporters: [ 4 'default', 5 'js-tests-results-collector/vitest' 6 ] 7 } 8};
Or in package.json:
1{ 2 "scripts": { 3 "test": "vitest run --reporter=default --reporter=js-tests-results-collector/vitest" 4 } 5}
The collector integrates with Buddy Works Unit Tests API:
1POST /workspaces/{domain}/projects/{projectName}/unit-tests/folders/{folderId}/sessions
1PUT /workspaces/{domain}/projects/{projectName}/unit-tests/folders/{folderId}/sessions/{sessionId}/cases
Test results are mapped to the following format:
1{ 2 "name": "Test case name", 3 "suite_name": "Test suite name", 4 "suite_id": "unique-suite-id", 5 "classname": "test.file.path", 6 "status": "PASSED|FAILED|SKIPPED|ERROR", 7 "time": 1.234, 8 "data": "Error message or additional data" 9}
Enable debug logging to troubleshoot issues:
1BUDDY_DEBUG=true npm test
This will output detailed logs about:
Check the examples/
directory for complete configuration examples:
examples/jest-example/
- Jest configurationexamples/mocha-example/
- Mocha configurationexamples/jasmine-example/
- Jasmine configurationexamples/cypress-example/
- Cypress configurationexamples/playwright-example/
- Playwright configurationexamples/vitest-example/
- Vitest configurationMIT License - see LICENSE file for details.
For issues and questions:
BUDDY_DEBUG=true
examples/
directoryNo vulnerabilities found.
No security vulnerabilities found.