{"id":20137079,"url":"https://github.com/ctrf-io/jest-ctrf-json-reporter","last_synced_at":"2025-04-09T17:50:20.729Z","repository":{"id":223901074,"uuid":"733229512","full_name":"ctrf-io/jest-ctrf-json-reporter","owner":"ctrf-io","description":"A Jest JSON test results reporter that follows the CTRF schema","archived":false,"fork":false,"pushed_at":"2025-02-16T19:40:16.000Z","size":182,"stargazers_count":18,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T19:51:21.588Z","etag":null,"topics":["jest","jest-reporter","test-automation","test-reporting"],"latest_commit_sha":null,"homepage":"https://ctrf.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ctrf-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-18T21:21:54.000Z","updated_at":"2025-02-27T21:27:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7aa3c4f-e53f-434f-835e-c328854b678e","html_url":"https://github.com/ctrf-io/jest-ctrf-json-reporter","commit_stats":null,"previous_names":["ctrf-io/jest-ctrf-json-reporter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrf-io%2Fjest-ctrf-json-reporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrf-io%2Fjest-ctrf-json-reporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrf-io%2Fjest-ctrf-json-reporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrf-io%2Fjest-ctrf-json-reporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctrf-io","download_url":"https://codeload.github.com/ctrf-io/jest-ctrf-json-reporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248082786,"owners_count":21044976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jest","jest-reporter","test-automation","test-reporting"],"created_at":"2024-11-13T21:25:05.809Z","updated_at":"2025-04-09T17:50:20.717Z","avatar_url":"https://github.com/ctrf-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jest JSON Test Results Report\n\n\u003e Save Jest test results as a JSON file\n\n![Static Badge](https://img.shields.io/badge/official-red?label=ctrf\u0026labelColor=green)\n[![build](https://github.com/ctrf-io/jest-ctrf-json-reporter/actions/workflows/main.yaml/badge.svg)](https://github.com/ctrf-io/jest-ctrf-json-reporter/actions/workflows/main.yaml)\n![NPM Downloads](https://img.shields.io/npm/d18m/jest-ctrf-json-reporter?logo=npm)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/jest-ctrf-json-reporter?label=Size)\n![GitHub Repo stars](https://img.shields.io/github/stars/ctrf-io/jest-ctrf-json-reporter)\n\nA Jest test reporter to create test reports that follow the CTRF standard.\n\n[Common Test Report Format](https://ctrf.io) ensures the generation of uniform JSON test reports, independent of programming languages or test framework in use.\n\n\u003cdiv align=\"center\"\u003e\n\u003cdiv style=\"padding: 1.5rem; border-radius: 8px; margin: 1rem 0; border: 1px solid #30363d;\"\u003e\n\u003cspan style=\"font-size: 23px;\"\u003e💚\u003c/span\u003e\n\u003ch3 style=\"margin: 1rem 0;\"\u003eCTRF tooling is open source and free to use\u003c/h3\u003e\n\u003cp style=\"font-size: 16px;\"\u003eSupport the project by giving it a follow and a star ⭐\u003c/p\u003e\n\n\u003cdiv style=\"margin-top: 1.5rem;\"\u003e\n\u003ca href=\"https://github.com/ctrf-io/jest-ctrf-json-reporter\"\u003e\n\u003cimg src=\"https://img.shields.io/github/stars/ctrf-io/jest-ctrf-json-reporter?style=for-the-badge\u0026color=2ea043\" alt=\"GitHub stars\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/ctrf-io\"\u003e\n\u003cimg src=\"https://img.shields.io/github/followers/ctrf-io?style=for-the-badge\u0026color=2ea043\" alt=\"GitHub followers\"\u003e\n\u003c/a\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cp style=\"font-size: 14px; margin: 1rem 0;\"\u003e\nMaintained by \u003ca href=\"https://github.com/ma11hewthomas\"\u003eMatthew Thomas\u003c/a\u003e\u003cbr/\u003e\nContributions are very welcome! \u003cbr/\u003e\nExplore more \u003ca href=\"https://www.ctrf.io/integrations\"\u003eintegrations\u003c/a\u003e\n\u003c/p\u003e\n\u003c/div\u003e\n\n## Features\n\n- Generate JSON test reports that are [CTRF](https://ctrf.io) compliant\n- Straightforward integration with Jest\n\n```json\n{\n  \"results\": {\n    \"tool\": {\n      \"name\": \"jest\"\n    },\n    \"summary\": {\n      \"tests\": 1,\n      \"passed\": 1,\n      \"failed\": 0,\n      \"pending\": 0,\n      \"skipped\": 0,\n      \"other\": 0,\n      \"start\": 1706828654274,\n      \"stop\": 1706828655782\n    },\n    \"tests\": [\n      {\n        \"name\": \"ctrf should generate the same report with any tool\",\n        \"status\": \"passed\",\n        \"duration\": 100\n      }\n    ],\n    \"environment\": {\n      \"appName\": \"MyApp\",\n      \"buildName\": \"MyBuild\",\n      \"buildNumber\": \"1\"\n    }\n  }\n}\n```\n\n## What is CTRF?\n\nCTRF is a universal JSON test report schema that addresses the lack of a standardized format for JSON test reports.\n\n**Consistency Across Tools:** Different testing tools and frameworks often produce reports in varied formats. CTRF ensures a uniform structure, making it easier to understand and compare reports, regardless of the testing tool used.\n\n**Language and Framework Agnostic:** It provides a universal reporting schema that works seamlessly with any programming language and testing framework.\n\n**Facilitates Better Analysis:** With a standardized format, programatically analyzing test outcomes across multiple platforms becomes more straightforward.\n\n## Installation\n\n```bash\nnpm install --save-dev jest-ctrf-json-reporter\n```\n\nAdd the reporter to your jest.config.js file:\n\n```javascript\nreporters: [\n  'default',\n  ['jest-ctrf-json-reporter', {}],\n],\n```\n\nRun your tests:\n\n```bash\nnpx jest\n```\n\nYou'll find a JSON file named `ctrf-report.json` in the `ctrf` directory.\n\n## Reporter Options\n\nThe reporter supports several configuration options:\n\n```javascript\nreporter: [\n  ['jest-ctrf-json-reporter', {\n    outputFile: 'custom-name.json', // Optional: Output file name. Defaults to 'ctrf-report.json'.\n    outputDir: 'custom-directory',  // Optional: Output directory path. Defaults to 'ctrf'.\n    minimal: true,                  // Optional: Generate a minimal report. Defaults to 'false'. Overrides screenshot and testType when set to true\n    testType: 'unit',                // Optional: Specify the test type (e.g., 'unit', 'component'). Defaults to 'unit'.\n    appName: 'MyApp',               // Optional: Specify the name of the application under test.\n    appVersion: '1.0.0',            // Optional: Specify the version of the application under test.\n    osPlatform: 'linux',            // Optional: Specify the OS platform.\n    osRelease: '18.04',             // Optional: Specify the OS release version.\n    osVersion: '5.4.0',             // Optional: Specify the OS version.\n    buildName: 'MyApp Build',       // Optional: Specify the build name.\n    buildNumber: '100',             // Optional: Specify the build number.\n    buildUrl: \"https://ctrf.io\",    // Optional: Specify the build url.\n    repositoryName: \"ctrf-json\",    // Optional: Specify the repository name.\n    repositoryUrl: \"https://gh.io\", // Optional: Specify the repository url.\n    branchName: \"main\",             // Optional: Specify the branch name.\n    testEnvironment: \"staging\"      // Optional: Specify the test environment (e.g. staging, production).\n  }]\n],\n```\n\n## Test Object Properties\n\nThe test object in the report includes the following [CTRF properties](https://ctrf.io/docs/schema/test):\n\n| Name        | Type    | Required | Details                                                                             |\n| ----------- | ------- | -------- | ----------------------------------------------------------------------------------- |\n| `name`      | String  | Required | The name of the test.                                                               |\n| `status`    | String  | Required | The outcome of the test. One of: `passed`, `failed`, `skipped`, `pending`, `other`. |\n| `duration`  | Number  | Required | The time taken for the test execution, in milliseconds.                             |\n| `message`   | String  | Optional | The failure message if the test failed.                                             |\n| `trace`     | String  | Optional | The stack trace captured if the test failed.                                        |\n| `suite`     | String  | Optional | The suite or group to which the test belongs.                                       |\n| `message`   | String  | Optional | The failure message if the test failed.                                             |\n| `trace`     | String  | Optional | The stack trace captured if the test failed.                                        |\n| `rawStatus` | String  | Optional | The original jest status of the test before mapping to CTRF status.                 |\n| `type`      | String  | Optional | The type of test (e.g., `unit`, `component`).                                       |\n| `filepath`  | String  | Optional | The file path where the test is located in the project.                             |\n| `retries`   | Number  | Optional | The number of retries attempted for the test.                                       |\n| `flaky`     | Boolean | Optional | Indicates whether the test result is flaky.                                         |\n\n## Support Us\n\nIf you find this project useful, consider giving it a GitHub star ⭐ It means a lot to us.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrf-io%2Fjest-ctrf-json-reporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctrf-io%2Fjest-ctrf-json-reporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrf-io%2Fjest-ctrf-json-reporter/lists"}