mercredi 5 juin 2019

How can "Expected" and "Revieved" values be exported with jest?

In my test suite, I have a failing test under this form:

expect(received).toBe(expected)

Expected: 25
Received: 20

This is part of the error message.

My goal would be to end up with a .json or .csv file including the expected an received values for each failing test.

After trying some reporting tools, I always get a file under that form:

"failures": [
    {
      "title": "Test title",
      "fullTitle": "Full test title",
      "duration": 3277,
      "errorCount": 1,
      "error": "error message",
    }
  ]

I would appreciate having something like that:

"failures": [
    {
      "title": "Test title",
      "fullTitle": "Full test title",
      "duration": 3277,
      "errorCount": 1,
      "error": "error message",
      "expected": 25,
      "recieved": 20
    }
  ]

Is there a way of doing this?

Aucun commentaire:

Enregistrer un commentaire