Is there a way I can append to the error object from within an it block?
Eventually, I'd like to see extra data about the error printed out in the JSON reporter.
Thank you!
I've tried passing data into the error message of an assert statement. It's not quite what I'm looking for. I'd like to eventually output this as part of the error object.
Mocha it block example:
it('should send info about the request if it fails', async function(){
const postData = await request.post('https://some.endpoint.com/user')
.set({ Authorization: `Bearer 55555555555` })
.send({
someData: 'stuff'
})
.retry(2);
expect(postData.status).to.equal(204);
// If this 'it' block fails I'd like to see the post data in the
// error response object for reporting.
// It should including the path, params, request body, and
// the http response status.
})
Actual: 1) Fail Expected 200 to equal 204.
Desired: 1) Fail. Expected 200 to equal 204. {Response date from within postData...}
Aucun commentaire:
Enregistrer un commentaire