This package provides a Mocha test reporter that generates test results in the Common Test Report Format (CTRF) as a JSON file. CTRF is an open, community-driven standard for normalizing test reports across different programming languages and test frameworks, enabling consistent validation, merging, comparison, and analysis of test results. The current stable version is `0.0.11`. Releases appear to be ad-hoc, primarily driven by dependency updates or feature additions, without a strict cadence. Its key differentiator is its adherence to the CTRF specification, providing a standardized output that integrates into a broader ecosystem of tools designed to consume CTRF data, abstracting away framework-specific report parsing. This allows for unified reporting in CI/CD pipelines.
npm install mocha-ctrf-json-reporterVerified import paths — ran on the pinned version, not inferred.
Demonstrates installation, configuration via `.mocharc.js` with custom options including environment variables, and running example Mocha tests to generate a CTRF-compliant JSON report.
Prefer using `.mocharc.js` or `.mocharc.json` for reporter configuration. For dynamic options, leverage environment variables within `.mocharc.js` and use nullish coalescing (e.g., `process.env.VAR ?? 'default'`) for robustness.
Always specify `outputDir` and `outputFile` in `reporterOptions` to control where reports are saved. Consider using dynamic filenames (e.g., with timestamps or build numbers) to prevent overwrites, potentially utilizing the `[hash]` token if supported by the underlying Mocha version and reporter configuration.
Monitor the CTRF specification repository (github.com/ctrf-io/ctrf) for updates and ensure your entire test reporting toolchain is updated accordingly. Review generated reports against the latest CTRF schema if inconsistencies are observed.
Run `npm install --save-dev mocha-ctrf-json-reporter` to install the package as a development dependency.
Verify that your Mocha tests are running and passing. Double-check the `reporterOptions` in your `.mocharc.js` or command-line arguments for correct `outputDir` and `outputFile` settings. Also, ensure the specified output directory exists or can be created by the reporter.
Examine Mocha's console output for specific test failures or critical errors. Address any failing tests or configuration issues. Ensure Mocha is configured to run at least one test; an empty test run might not produce a report.
No dependency data recorded yet.