Only a proof of concept yet.
This commit is contained in:
Henning Dieterichs 2021-09-13 18:44:06 +02:00
parent c77dbe9565
commit 98c1725c7d
No known key found for this signature in database
GPG key ID: 771381EFFDB9EC06
2 changed files with 6 additions and 0 deletions

View file

@ -79,11 +79,15 @@ function deserializeRunnable(runnable) {
function deserializeError(err) {
const inspect = err.inspect;
err.inspect = () => inspect;
// Unfortunately, mocha rewrites and formats err.actual/err.expected.
// This formatting is hard to reverse, so err.*JSON includes the unformatted value.
if (err.actual) {
err.actual = JSON.parse(err.actual).value;
err.actualJSON = err.actual;
}
if (err.expected) {
err.expected = JSON.parse(err.expected).value;
err.expectedJSON = err.expected;
}
return err;
}

View file

@ -35,6 +35,8 @@ module.exports = class FullJsonStreamReporter extends BaseRunner {
test = clean(test);
test.actual = err.actual;
test.expected = err.expected;
test.actualJSON = err.actualJSON;
test.expectedJSON = err.expectedJSON;
test.err = err.message;
test.stack = err.stack || null;
writeEvent(['fail', test]);