You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be awesome to be able to specify custom Assertion error messages for the .to.be.ok and to.be.defined/.to.be.undefined etc checks that don't currently allow this (AFAIK ATM, please correct me if I'm wrong!)
It would allow me to write more readable tests instead of having to do things like:
expect(!!someObj.someProp).to.equal(true,'someProp should be defined/truthy/etc');
just to get the custom Assertion message.
The text was updated successfully, but these errors were encountered:
We tried to do something this a while ago - but having functions and getters did not work sadly.
If you want the history you can see #41, #297, #302, #306, #321, #326 and probably some others I've missed.
The problem is that this is a tough one to solve without huge breaking changes, or a whole new interface. Take a look at the roadmap (#457) which is a bit of a long path towards eventually solving this kind of problem.
I'll close this for now, because it's something that is inherent in the design requirements for newer versions of chai. If you want to follow the progress, then I suggest you subscribe to #457 😄
Thanks @keithamus, I wasn't exactly sure of how to phrase my search to find those issues. I do realize of course that this isn't trivial and I figured I'd ask to get the story.
Perhaps ES2015 Proxy can help? I'll take a look at #457, thanks again.
We've had a look at ES2015 proxies, and I think they can help in some ways, but I dont think this will be one of the ways. If you want to see the proxy discussion, have a look at #407.
It would be awesome to be able to specify custom Assertion error messages for the
.to.be.ok
andto.be.defined
/.to.be.undefined
etc checks that don't currently allow this (AFAIK ATM, please correct me if I'm wrong!)It would allow me to write more readable tests instead of having to do things like:
just to get the custom Assertion message.
The text was updated successfully, but these errors were encountered: