@testream/mocha-reporter
v1.2.7
Published
Publish Mocha test results, failures, source snippets, and CI metadata to Testream and Jira.
Maintainers
Readme
@testream/mocha-reporter: Mocha test reporting for Jira
@testream/mocha-reporter publishes Node.js Mocha test results from CI/CD to Testream, where failures and run context become durable evidence visible from Jira. Mocha remains the code-first execution source, with no requirement to recreate every automated test as a manual Jira case.
What the reporter sends to Testream and Jira
- Passed, failed, skipped, and pending Mocha results
- Failure messages, stack traces, and runtime source snippets
- Branch, commit, build, environment, and CI metadata, including merge-base data for pull-request comparisons
- Suite changes and trends for Jira work and release reviews
For pull requests, the reporter uses an explicit TESTREAM_MERGE_BASE_SHA or provider-supplied merge-base metadata; otherwise it resolves git merge-base from the existing checkout without fetching. Keep history available (fetch-depth: 0 on GitHub Actions); if no merge base can be resolved, Testream falls back to execution-time comparison.
This connects Node.js testing feedback to the product and delivery context teams already manage in Jira. It is designed for existing Mocha projects rather than a replacement test runner.
Install and configure
npm install --save-dev @testream/mocha-reporter// .mocharc.js
module.exports = {
reporter: '@testream/mocha-reporter',
'reporter-option': [
`apiKey=${process.env.TESTREAM_API_KEY}`,
'uploadEnabled=true',
],
};The reporter captures the Mocha test body’s source text at runtime, so generated CTRF reports include a bounded snippet even when explicit line metadata is unavailable.
Mocha evidence in CI/CD
Keep running Mocha with the configuration above and store TESTREAM_API_KEY as a protected secret. The reporter publishes completed results from GitHub Actions, GitLab CI/CD, Azure Pipelines, Jenkins, or another command-based CI provider, preserving failure and build context for later inspection.
Frequently asked questions
Do we need to recreate automated tests as manual Jira cases?
No. Your Mocha suite remains the execution source. Testream publishes its evidence for Jira users without asking the team to maintain duplicate manual cases.
Are source snippets available without line metadata?
Yes. The reporter captures bounded runtime source text from the Mocha test body, providing useful evidence when exact source-line metadata is unavailable.
