{"id":14122,"library":"testbeats","title":"TestBeats: Test Results Publisher","description":"TestBeats is an actively maintained tool designed to centralize and publish test results from various automation testing frameworks to popular communication platforms like Slack, Microsoft Teams, Google Chat, and analytics tools like InfluxDB. It aims to unify test reporting workflows to provide comprehensive quality insights and enable faster decision-making. The current stable version is 2.7.0, with frequent releases adding new features and bug fixes (several minor releases observed in recent months). Key differentiators include its support for multiple output targets, ability to process results from major testing frameworks, and recent additions for CI information and metadata, which are crucial for detailed reporting and integration into modern CI/CD pipelines. It was renamed from `test-results-reporter` to `testbeats` to reflect its evolved capabilities and brand.","status":"active","version":"2.7.0","language":"javascript","source_language":"en","source_url":"https://github.com/test-results-reporter/testbeats","tags":["javascript","test","results","publish","report","microsoft teams","teams","slack","influx","typescript"],"install":[{"cmd":"npm install testbeats","lang":"bash","label":"npm"},{"cmd":"yarn add testbeats","lang":"bash","label":"yarn"},{"cmd":"pnpm add testbeats","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Primary function for orchestrating test result publication. TestBeats is ESM-first and ships TypeScript types; CommonJS require() is often incorrect.","wrong":"const { publish } = require('testbeats');","symbol":"publish","correct":"import { publish } from 'testbeats';"},{"note":"Type import for the main configuration object. Use `import type` for type-only imports to prevent bundling issues and ensure correct tree-shaking.","wrong":"import { TestBeatsConfig } from 'testbeats';","symbol":"TestBeatsConfig","correct":"import type { TestBeatsConfig } from 'testbeats';"},{"note":"Example of importing a specific configuration type for a target. Various target-specific configuration types are available.","wrong":"import { SlackTargetConfig } from 'testbeats';","symbol":"SlackTargetConfig","correct":"import type { SlackTargetConfig } from 'testbeats';"}],"quickstart":{"code":"import { publish } from 'testbeats';\nimport * as fs from 'fs';\n\n// Create a dummy JUnit XML report for demonstration\nconst dummyJunitReport = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuites name=\"Test Suite\" tests=\"2\" failures=\"1\" errors=\"0\" skipped=\"0\">\n  <testsuite name=\"User Management\" tests=\"2\" failures=\"1\" errors=\"0\" skipped=\"0\" timestamp=\"2026-04-19T10:00:00Z\" hostname=\"localhost\" time=\"10.5\">\n    <testcase name=\"should create a new user\" classname=\"UserManagement.Create\" time=\"5.2\"/>\n    <testcase name=\"should not allow duplicate usernames\" classname=\"UserManagement.Create\" time=\"5.3\">\n      <failure message=\"Expected unique username but found duplicate\" type=\"AssertionError\">Error: Expected unique username but found duplicate</failure>\n    </testcase>\n  </testsuite>\n</testsuites>`;\nfs.writeFileSync('junit-report.xml', dummyJunitReport);\n\nasync function runReport() {\n  const config = {\n    targets: [\n      {\n        type: 'slack',\n        webhookUrl: process.env.SLACK_WEBHOOK_URL ?? 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX',\n        channel: '#test-results',\n        title: 'CI Test Results',\n        summary: 'Daily regression run',\n        fields: { environment: 'staging' }\n      },\n      {\n        type: 'teams',\n        webhookUrl: process.env.TEAMS_WEBHOOK_URL ?? 'https://outlook.office.com/webhook/XXXXX/IncomingWebhook/YYYYY/ZZZZZ',\n        title: 'CI Test Results Notification'\n      }\n    ],\n    results: [\n      {\n        type: 'junit',\n        files: ['./junit-report.xml']\n      }\n    ],\n    ci: {\n        provider: 'github-actions',\n        runId: process.env.GITHUB_RUN_ID ?? '123456789',\n        jobId: process.env.GITHUB_JOB ?? 'build-and-test',\n        commitSha: process.env.GITHUB_SHA ?? 'abcdef1234567890abcdef1234567890abcdef',\n        branch: process.env.GITHUB_REF_NAME ?? 'main',\n        repository: process.env.GITHUB_REPOSITORY ?? 'my-org/my-repo'\n    },\n    metadata: {\n        buildNumber: 'v2.7.0-rc.1',\n        deployEnvironment: 'test'\n    }\n  };\n\n  try {\n    console.log('Publishing test results...');\n    const reportSummary = await publish(config);\n    console.log('Test results published successfully:', JSON.stringify(reportSummary, null, 2));\n    fs.unlinkSync('junit-report.xml'); // Clean up dummy report\n  } catch (error) {\n    console.error('Failed to publish test results:', error);\n    fs.unlinkSync('junit-report.xml');\n    process.exit(1);\n  }\n}\n\nrunReport();","lang":"typescript","description":"This quickstart demonstrates how to publish JUnit XML test results to Slack and Microsoft Teams, including CI and custom metadata, using TestBeats."},"warnings":[{"fix":"Update your `package.json` dependencies from `test-results-reporter` to `testbeats` and adjust `import`/`require` statements accordingly.","message":"The `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.","severity":"breaking","affected_versions":"All versions, as this is a package rename."},{"fix":"Ensure your project's Node.js environment meets the `>=14.0.0` requirement. Consider using nvm or similar tools to manage Node.js versions.","message":"TestBeats requires Node.js version 14.0.0 or higher. Running with older Node.js versions will lead to runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Review 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.","message":"New 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.","severity":"gotcha","affected_versions":">=2.4.0"}],"env_vars":null,"search_vec":"'2.7.0':61 'abil':87 'activ':8 'ad':65 'addit':97 'aim':39 'analyt':34 'autom':20 'brand':131 'bug':69 'capabl':129 'central':13 'chat':32 'ci':99 'ci/cd':113 'communic':25 'comprehens':47 'crucial':105 'current':57 'decis':54 'decision-mak':53 'design':11 'detail':107 'differenti':79 'enabl':51 'evolv':128 'faster':52 'featur':67 'fix':70 'framework':22,94 'frequent':63 'googl':31 'includ':80 'influx':141 'influxdb':37 'inform':100 'insight':49 'integr':110 'javascript':132 'key':78 'like':27,36 'maintain':9 'major':92 'make':55 'metadata':102 'microsoft':29,137 'minor':72 'modern':112 'month':77 'multipl':84 'new':66 'observ':74 'output':85 'pipelin':114 'platform':26 'popular':24 'process':89 'provid':46 'publish':4,15,135 'qualiti':48 'recent':76,96 'reflect':126 'releas':64,73 'renam':117 'report':43,108,122,136 'result':3,17,90,121,134 'sever':71 'slack':28,140 'stabl':58 'support':82 'target':86 'team':30,138,139 'test':2,16,21,42,93,120,133 'test-results-report':119 'testbeat':1,5,124 'tool':10,35 'typescript':142 'unifi':41 'various':19 'version':59 'workflow':44","created_at":"2026-04-20T01:58:03.113675+00:00","updated_at":"2026-04-20T01:58:03.113675+00:00","problems":[{"fix":"Migrate 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.","cause":"Attempting to use CommonJS `require()` syntax with TestBeats, which is primarily an ESM module.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ...testbeats.js not supported."},{"fix":"Verify 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.","cause":"The configured webhook URL for a communication platform (e.g., Slack, Teams) is either missing, empty, or syntactically incorrect.","error":"Failed to publish test results: Missing or invalid webhook URL for target: slack"},{"fix":"Double-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.","cause":"TestBeats cannot find the specified test report file(s) (e.g., JUnit XML, Mocha JSON) at the given path.","error":"ENOENT: no such file or directory, open './junit-report.xml'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"testbeats","cli_version":null,"type":"library","homepage":"https://testbeats.com","github":"https://github.com/test-results-reporter/testbeats","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/testbeats","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","communication","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}