vendredi 11 août 2017

How to have better error messages using Mocha and expect?

I'm writing my tests using Mocha and expect for assertions. But I'm quite disapointed by the error messages shown in assertions. Typically, when I write

myObject = {myProperty:undefined}
expect(myObject.myProperty).not.to.be(undefined)

I get something like

Error: expected undefined not to be undefined

Followed by a stack trace. In Java/Groovy, I use to have better assertions using tools such as assertj or native Groovy testing features.

How can I get the same level of detail using expect ?

Aucun commentaire:

Enregistrer un commentaire