{"id":15062124,"url":"https://github.com/plasticrake/mocha-json-deserialize","last_synced_at":"2025-04-10T09:54:36.437Z","repository":{"id":39916468,"uuid":"231724016","full_name":"plasticrake/mocha-json-deserialize","owner":"plasticrake","description":"A Mocha.js JSON deserializer","archived":false,"fork":false,"pushed_at":"2024-08-10T23:56:31.000Z","size":352,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T08:48:16.978Z","etag":null,"topics":["json","mocha"],"latest_commit_sha":null,"homepage":"","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":"2020-01-04T07:09:47.000Z","updated_at":"2025-02-01T11:26:51.000Z","dependencies_parsed_at":"2024-09-29T07:41:06.619Z","dependency_job_id":"6a55cf64-9e60-417f-95f0-7ea50320c607","html_url":"https://github.com/plasticrake/mocha-json-deserialize","commit_stats":{"total_commits":42,"total_committers":1,"mean_commits":42.0,"dds":0.0,"last_synced_commit":"f05b6e8341cf336297ad35446903d5b086300f4c"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasticrake%2Fmocha-json-deserialize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasticrake%2Fmocha-json-deserialize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasticrake%2Fmocha-json-deserialize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasticrake%2Fmocha-json-deserialize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plasticrake","download_url":"https://codeload.github.com/plasticrake/mocha-json-deserialize/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"],"created_at":"2024-09-24T23:30:48.898Z","updated_at":"2025-04-10T09:54:36.409Z","avatar_url":"https://github.com/plasticrake.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mocha-json-deserialize\n\n[![NPM Version](https://img.shields.io/npm/v/mocha-json-deserialize.svg)](https://www.npmjs.com/package/mocha-json-deserialize)\n[![Build Status](https://github.com/plasticrake/mocha-json-deserialize/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/plasticrake/mocha-json-deserialize/actions/workflows/ci.yml?query=branch%3Amaster)\n[![Coverage Status](https://coveralls.io/repos/github/plasticrake/mocha-json-deserialize/badge.svg?branch=master)](https://coveralls.io/github/plasticrake/mocha-json-deserialize?branch=master)\n[![CodeQL](https://github.com/plasticrake/mocha-json-deserialize/actions/workflows/codeql.yml/badge.svg)](https://github.com/plasticrake/mocha-json-deserialize/actions/workflows/codeql.yml)\n\n☕️ **A Mocha.js JSON deserializer** ☕️\n\nPairs well with [mocha-json-serialize-reporter](https://github.com/plasticrake/mocha-json-serialize-reporter)!\n\n## What is this for?\n\nThis can be used to revive the JSON output from [mocha-json-serialize-reporter](https://github.com/plasticrake/mocha-json-serialize-reporter) back into a Mocha Suite.\n\n- This package is used by [mocha-json-runner](https://github.com/plasticrake/mocha-json-runner) to \"playback\" a previously run mocha test suite that has been serialized to JSON. You could then run the JSON through another Mocha reporter such as Spec.\n\n- The deserialized Mocha Suite could also be added to an existing mocha test suite.\n\n## Example\n\nSee [Examples](https://github.com/plasticrake/mocha-json-deserialize/tree/master/examples)\n\n```js\n// Run this with mocha:\n// mocha examples/mocha.js\n\nconst mochaJsonDeserialize = require('mocha-json-deserialize');\n\n// stringify is optional, can take a JSON string or an Object\nconst json = JSON.stringify({\n  suite: {\n    title: '',\n    tests: [\n      { title: 'passing test', state: 'passed' },\n      { title: 'failing test', state: 'failed', err: { message: 'FAIL' } },\n      { title: 'pending test', pending: true },\n      {\n        title: 'a slow test',\n        state: 'passed',\n        speed: 'slow',\n        duration: 5,\n        slow: 3,\n      },\n    ],\n  },\n});\n\nconst rootSuite = mochaJsonDeserialize(json);\nrootSuite.title = 'A deserialized suite';\n\ndescribe('A describe block', function() {\n  this.addSuite(rootSuite);\n\n  describe('A real suite', function() {\n    it('should have a passing test', function() {});\n  });\n});\n```\n\n```shell\nmocha examples/mocha.js\n```\n\n**Output:**\n\n```text\n  A describe block\n    A deserialized suite\n      ✓ passing test\n      1) failing test\n      - pending test\n      ✓ a slow test (5ms)\n    A real suite\n      ✓ should have a passing test\n\n\n  3 passing (7ms)\n  1 pending\n  1 failing\n\n  1) A describe block\n       A deserialized suite\n         failing test:\n     FAIL\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplasticrake%2Fmocha-json-deserialize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplasticrake%2Fmocha-json-deserialize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplasticrake%2Fmocha-json-deserialize/lists"}