Open jakubgs opened 7 years ago
Going to slide in here with some questions unrelated to the issue here;
I consider adding messages at the end of the assert much more readable than in the expect() function
How do you consider adding custom messages more readable? What do you provide to the message parameter that the default messaging doesn't give you? (Asking because we'd like to improve messaging in chai, but would like feedback from users).
I'll chip in and say that a custom message argument allows you to describe why you're making an assertion. e.g.,
expect(yourElement)
.to.contain.text('hello', 'because it would be impolite not to say hello')
@jrnail23 thanks for that, and that is indeed a fine use case. FWIW we wont be removing the message feature - and we very much encourage people to use it for use cases like the above, I was questioning because I want to ensure that without the message, Chai gives users the best clue as to what is going wrong (even if that doesnt tell them why); and so if there is anything we can do to improve the default messaging, we would like to.
Regular function assertions in Chai have an optional
msg
argument, for example:http://chaijs.com/api/bdd/#method_include
But the
chai-enzyme
functions do not have it. I consider adding messages at the end of the assert much more readable than in theexpect()
function, so most of my tests use that form. Withchai-enzyme
I have to mix two styles now since I cannot supply amsg
to something liketo.contain.text()
.