{"library":"mocha-ctrf-json-reporter","title":"Mocha Common Test Report Format (CTRF) JSON Reporter","description":"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.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install mocha-ctrf-json-reporter"],"cli":null},"imports":["import CTRFReporter from 'mocha-ctrf-json-reporter';","import type { ReporterOptions } from 'mocha-ctrf-json-reporter';","import type { CTRFReport } from 'mocha-ctrf-json-reporter';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"npm install --save-dev mocha mocha-ctrf-json-reporter\n\n// .mocharc.js\nmodule.exports = {\n  reporter: 'mocha-ctrf-json-reporter',\n  reporterOptions: {\n    outputFile: 'my-custom-ctrf-report.json',\n    outputDir: './test-reports',\n    appName: 'MyAwesomeApp',\n    appVersion: '1.0.0',\n    buildName: 'CI Build',\n    buildNumber: process.env.CI_BUILD_NUMBER ?? 'local-run',\n    testEnvironment: process.env.NODE_ENV ?? 'development'\n  }\n};\n\n// test/example.test.js\nconst assert = require('assert');\n\ndescribe('Application Feature', function() {\n  it('should handle basic arithmetic correctly', function() {\n    assert.strictEqual(2 + 2, 4);\n  });\n\n  it('should skip this test as an example', function() {\n    this.skip();\n    assert.fail('This test should not be executed');\n  });\n\n  it('should correctly identify string length', function() {\n    assert.strictEqual('hello'.length, 5);\n  });\n});\n\n// To run the tests, add to package.json scripts:\n// \"scripts\": {\n//   \"test\": \"mocha\"\n// }\n// Then run: npm test\n// The report will be found at ./test-reports/my-custom-ctrf-report.json","lang":"typescript","description":"Demonstrates installation, configuration via `.mocharc.js` with custom options including environment variables, and running example Mocha tests to generate a CTRF-compliant JSON report.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}