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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
publish
✓ import { publish } from 'testbeats';
✗ const { publish } = require('testbeats');
Primary function for orchestrating test result publication. TestBeats is ESM-first and ships TypeScript types; CommonJS require() is often incorrect.
TestBeatsConfig
✓ import type { TestBeatsConfig } from 'testbeats';
✗ import { TestBeatsConfig } from 'testbeats';
Type import for the main configuration object. Use `import type` for type-only imports to prevent bundling issues and ensure correct tree-shaking.
SlackTargetConfig
✓ import type { SlackTargetConfig } from 'testbeats';
✗ import { SlackTargetConfig } from 'testbeats';
Example of importing a specific configuration type for a target. Various target-specific configuration types are available.
This quickstart demonstrates how to publish JUnit XML test results to Slack and Microsoft Teams, including CI and custom metadata, using TestBeats.
import { publish } from 'testbeats';
import * as fs from 'fs';
// Create a dummy JUnit XML report for demonstration
const dummyJunitReport = `<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Test Suite" tests="2" failures="1" errors="0" skipped="0">
<testsuite name="User Management" tests="2" failures="1" errors="0" skipped="0" timestamp="2026-04-19T10:00:00Z" hostname="localhost" time="10.5">
<testcase name="should create a new user" classname="UserManagement.Create" time="5.2"/>
<testcase name="should not allow duplicate usernames" classname="UserManagement.Create" time="5.3">
<failure message="Expected unique username but found duplicate" type="AssertionError">Error: Expected unique username but found duplicate</failure>
</testcase>
</testsuite>
</testsuites>`;
fs.writeFileSync('junit-report.xml', dummyJunitReport);
async function runReport() {
const config = {
targets: [
{
type: 'slack',
webhookUrl: process.env.SLACK_WEBHOOK_URL ?? 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX',
channel: '#test-results',
title: 'CI Test Results',
summary: 'Daily regression run',
fields: { environment: 'staging' }
},
{
type: 'teams',
webhookUrl: process.env.TEAMS_WEBHOOK_URL ?? 'https://outlook.office.com/webhook/XXXXX/IncomingWebhook/YYYYY/ZZZZZ',
title: 'CI Test Results Notification'
}
],
results: [
{
type: 'junit',
files: ['./junit-report.xml']
}
],
ci: {
provider: 'github-actions',
runId: process.env.GITHUB_RUN_ID ?? '123456789',
jobId: process.env.GITHUB_JOB ?? 'build-and-test',
commitSha: process.env.GITHUB_SHA ?? 'abcdef1234567890abcdef1234567890abcdef',
branch: process.env.GITHUB_REF_NAME ?? 'main',
repository: process.env.GITHUB_REPOSITORY ?? 'my-org/my-repo'
},
metadata: {
buildNumber: 'v2.7.0-rc.1',
deployEnvironment: 'test'
}
};
try {
console.log('Publishing test results...');
const reportSummary = await publish(config);
console.log('Test results published successfully:', JSON.stringify(reportSummary, null, 2));
fs.unlinkSync('junit-report.xml'); // Clean up dummy report
} catch (error) {
console.error('Failed to publish test results:', error);
fs.unlinkSync('junit-report.xml');
process.exit(1);
}
}
runReport();
testbeats --version
Debug
Known issues
breakingThe `test-results-reporter` npm package was officially renamed to `testbeats`. Users are strongly encouraged to migrate to the new package name, as the old package will be phased out.fixUpdate your `package.json` dependencies from `test-results-reporter` to `testbeats` and adjust `import`/`require` statements accordingly.
affects: All versions, as this is a package rename.
gotchaTestBeats requires Node.js version 14.0.0 or higher. Running with older Node.js versions will lead to runtime errors.fixEnsure your project's Node.js environment meets the `>=14.0.0` requirement. Consider using nvm or similar tools to manage Node.js versions.
affects: >=1.0.0
gotchaNew features like 'failure signatures and error clusters' (v2.7.0), 'metadata support' (v2.6.0), and 'CI information' (v2.4.0) enhance reporting but may require updates to custom parsers or integrations that directly consume internal result structures.fixReview changelogs for each minor version update if your workflow relies on processing raw `testbeats` output or internal data structures, especially regarding error handling or metadata fields.
affects: >=2.4.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ...testbeats.js not supported.
Attempting to use CommonJS `require()` syntax with TestBeats, which is primarily an ESM module.
fixMigrate your project to use ES module syntax (`import ... from 'testbeats';`) or ensure your build system correctly transpiles ESM to CJS if you must use `require()` in an older CJS environment.
Failed to publish test results: Missing or invalid webhook URL for target: slack
The configured webhook URL for a communication platform (e.g., Slack, Teams) is either missing, empty, or syntactically incorrect.
fixVerify that `process.env.SLACK_WEBHOOK_URL` (or equivalent for other targets) is correctly set in your environment variables and provides a valid URL. Ensure URLs are not hardcoded in sensitive areas.
ENOENT: no such file or directory, open './junit-report.xml'
TestBeats cannot find the specified test report file(s) (e.g., JUnit XML, Mocha JSON) at the given path.
fixDouble-check the `files` array within your `results` configuration to ensure paths are correct and accessible from where TestBeats is executed. Use absolute paths or paths relative to the current working directory.
Audit
Dependencies
No dependency data recorded yet.