Object diffs in mocha test reports

I recognise that this isn’t a CircleCI specific issue, but I figure there must be someone here who has tried to solve this before me.

We run our tests in mocha. Most of the tests are verifying that the JSON response of our API is correct, and so rely on chai-subset to highlight what part of the object is wrong.

I just set up our test reporting on CI, very excited to have our reports all nicely formatted, only to discover that such errors get reported as

AssertionError: expected { Object (data, pagination) } to contain subset { Object (data) }

And there seems to be no way to get access to the object diff.
Inspecting the test-report.xml created I can see that there’s no diff information saved to the report.

Is there a way I can get this information into the report?

What I’m referring to is, for example, the spec reporter would give me:

  AssertionError: expected { Object (data, pagination) } to contain subset { Object (data) }
  + expected - actual

   {
  -  "data": []
  -  "pagination": {
  -  }
  +  "data": [
  +    {
  +      "goal": 37024
  +    }
  +  ]
   }

Are you using version 2? If you are, you can rebuild with SSH support, ssh into the build machine, and inspect it yourself. I have done it with Node, works quite well.

When you are familiar enough, you can set up artifact for the CI (see docs). I have my test upload istanbul reports.