{"id":15062116,"url":"https://github.com/plasticrake/mocha-json-serialize-reporter","last_synced_at":"2025-04-10T09:54:43.597Z","repository":{"id":39917620,"uuid":"229507700","full_name":"plasticrake/mocha-json-serialize-reporter","owner":"plasticrake","description":"A comprehensive JSON reporter for Mocha.js","archived":false,"fork":false,"pushed_at":"2024-12-10T05:03:45.000Z","size":810,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T08:48:18.972Z","etag":null,"topics":["json","mocha","mocha-reporter"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plasticrake.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2019-12-22T02:19:30.000Z","updated_at":"2025-02-01T11:26:49.000Z","dependencies_parsed_at":"2024-05-09T03:34:22.630Z","dependency_job_id":"1cb908bd-5a52-4892-a123-a9c6727fc722","html_url":"https://github.com/plasticrake/mocha-json-serialize-reporter","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasticrake%2Fmocha-json-serialize-reporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasticrake%2Fmocha-json-serialize-reporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasticrake%2Fmocha-json-serialize-reporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasticrake%2Fmocha-json-serialize-reporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plasticrake","download_url":"https://codeload.github.com/plasticrake/mocha-json-serialize-reporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248198841,"owners_count":21063626,"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":["json","mocha","mocha-reporter"],"created_at":"2024-09-24T23:30:34.162Z","updated_at":"2025-04-10T09:54:43.574Z","avatar_url":"https://github.com/plasticrake.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mocha.js JSON Serialize Reporter\n\n[![NPM Version](https://img.shields.io/npm/v/mocha-json-serialize-reporter.svg)](https://www.npmjs.com/package/mocha-json-serialize-reporter)\n[![Build Status](https://github.com/plasticrake/mocha-json-serialize-reporter/workflows/CI/badge.svg?branch=master)](https://github.com/plasticrake/mocha-json-serialize-reporter/actions?query=workflow%3ACI+branch%3Amaster)\n[![Coverage Status](https://coveralls.io/repos/github/plasticrake/mocha-json-serialize-reporter/badge.svg?branch=master)](https://coveralls.io/github/plasticrake/mocha-json-serialize-reporter?branch=master)\n![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)\n[![Total alerts](https://img.shields.io/lgtm/alerts/g/plasticrake/mocha-json-serialize-reporter.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/plasticrake/mocha-json-serialize-reporter/alerts/)\n[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/plasticrake/mocha-json-serialize-reporter.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/plasticrake/mocha-json-serialize-reporter/context:javascript)\n\n☕️ **A comprehensive JSON reporter for [Mocha.js](https://mochajs.org/)** ☕️\n\nOutput can be used with [mocha-json-runner](https://github.com/plasticrake/mocha-json-runner) to \"replay\" test results using another mocha reporter.\n\nDiffers from the built-in Mocha JSON reporter:\n\n- includes suite level details\n- includes nearly all internal details about tests and suites\n\n## Usage\n\n1. Add to your project: `npm install --save-dev mocha-json-serialize-reporter`\u003c/br\u003e\n   or globally: `npm install --global mocha-json-serialize-reporter`\n\n2. Tell mocha to use it: `mocha test_file.js --reporter mocha-json-serialize-reporter`\n\n3. If using mocha programmatically:\n\n```js\nvar mocha = new Mocha({\n  reporter: 'mocha-json-serialize-reporter',\n});\n```\n\n## Running in Browser\n\nSee [browser-test-console.html](https://github.com/plasticrake/mocha-json-serialize-reporter/blob/master/test/browser-test-console.html) and [browser-test-div.html](https://github.com/plasticrake/mocha-json-serialize-reporter/blob/master/test/browser-test-console.html) for examples.\n\n### Options\n\n- `stats` \\[boolean\\] \\[default: true\\] include stats in output.\n- `space` \\[number\\] \\[default: 2\\] `JSON.stringify` space parameter.\n- `replacer` \\[Function\\] \\[default: null\\] `JSON.stringify` replacer function. This is only usable programmatically, not via command line.\n- `callback` \\[Function\\] \\[default: null\\] Function called with JSON results after mocha completes. If specified results will not be output to stdout. This is only usable programmatically or in browser, not via command line.\n\nExample:\n\n```bash\nmocha testfile.js --reporter mocha-json-serialize-reporter -O stats=false -O space=0\n```\n\n## Output\n\n```json\n{\n  \"stats\": {\n    \"suites\": 1,\n    \"tests\": 4,\n    \"passes\": 2,\n    \"pending\": 1,\n    \"failures\": 1,\n    \"start\": \"2019-12-22T18:44:52.229Z\",\n    \"end\": \"2019-12-22T18:44:52.233Z\",\n    \"duration\": 4\n  },\n  \"suite\": {\n    \"title\": \"\",\n    \"pending\": false,\n    \"root\": true,\n    \"timeout\": 2000,\n    \"slow\": 75,\n    \"retries\": -1,\n    \"tests\": [\n      {\n        \"title\": \"passing test in the root suite\",\n        \"body\": \"function() {}\",\n        \"timedOut\": false,\n        \"pending\": false,\n        \"type\": \"test\",\n        \"file\": \"/fixtures/mocha-test-simple.fixture.js\",\n        \"duration\": 0,\n        \"state\": \"passed\",\n        \"speed\": \"fast\",\n        \"timeout\": 2000,\n        \"slow\": 75,\n        \"retries\": -1,\n        \"currentRetry\": 0\n      }\n    ],\n    \"suites\": [\n      {\n        \"title\": \"suite one\",\n        \"pending\": false,\n        \"root\": false,\n        \"file\": \"/fixtures/mocha-test-simple.fixture.js\",\n        \"timeout\": 2000,\n        \"slow\": 75,\n        \"retries\": -1,\n        \"tests\": [\n          {\n            \"title\": \"passing test\",\n            \"body\": \"function() {}\",\n            \"timedOut\": false,\n            \"pending\": false,\n            \"type\": \"test\",\n            \"file\": \"/fixtures/mocha-test-simple.fixture.js\",\n            \"duration\": 0,\n            \"state\": \"passed\",\n            \"speed\": \"fast\",\n            \"timeout\": 2000,\n            \"slow\": 75,\n            \"retries\": -1,\n            \"currentRetry\": 0\n          },\n          {\n            \"title\": \"failing test\",\n            \"body\": \"function() {\\n    throw new Error('FAIL');\\n  }\",\n            \"timedOut\": false,\n            \"pending\": false,\n            \"type\": \"test\",\n            \"file\": \"/fixtures/mocha-test-simple.fixture.js\",\n            \"duration\": 0,\n            \"state\": \"failed\",\n            \"timeout\": 2000,\n            \"slow\": 75,\n            \"retries\": -1,\n            \"currentRetry\": 0,\n            \"err\": {\n              \"stack\": \"Error: FAIL\\n    at Context.\u003canonymous\u003e (test/fixtures/mocha-test-simple.fixture.js:7:11)\\n    at processImmediate (internal/timers.js:439:21)\",\n              \"message\": \"FAIL\",\n              \"constructorName\": \"Error\"\n            }\n          },\n          {\n            \"title\": \"skipped test\",\n            \"body\": \"function() {\\n    this.skip();\\n  }\",\n            \"timedOut\": false,\n            \"pending\": true,\n            \"type\": \"test\",\n            \"file\": \"/fixtures/mocha-test-simple.fixture.js\",\n            \"duration\": 0,\n            \"timeout\": 2000,\n            \"slow\": 75,\n            \"retries\": -1,\n            \"currentRetry\": 0\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplasticrake%2Fmocha-json-serialize-reporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplasticrake%2Fmocha-json-serialize-reporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplasticrake%2Fmocha-json-serialize-reporter/lists"}