mocha-json-deserialize
☕️ A Mocha.js JSON deserializer ☕️
Pairs well with mocha-json-serialize-reporter!
What is this for?
This can be used to revive the JSON output from mocha-json-serialize-reporter back into a Mocha Suite.
-
This package is used by 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.
-
The deserialized Mocha Suite could also be added to an existing mocha test suite.
Example
See Examples
// Run this with mocha:// mocha examples/mocha.js const mochaJsonDeserialize = ; // stringify is optional, can take a JSON string or an Objectconst json = JSON; const rootSuite = ;rootSuitetitle = 'A deserialized suite'; ;
mocha examples/mocha.js
Output:
A describe block A deserialized suite ✓ passing test 1) failing test - pending test ✓ a slow test (5ms) A real suite ✓ should have a passing test 3 passing (7ms) 1 pending 1 failing 1) A describe block A deserialized suite failing test: FAIL