chaijs.github.io icon indicating copy to clipboard operation
chaijs.github.io copied to clipboard

expect.fail() and assert.fail() could be better documented

Open ashleyci opened this issue 7 years ago • 2 comments

The documentation for expect.fail() and assert.fail() doesn't have an example of usage, took me a minute or two to work out that you can't do expect().to.fail() - also the BDD version (http://chaijs.com/api/bdd/#method_fail) is duplicated in the docs. :)

screen shot 2017-06-12 at 10 33 07

ashleyci avatar Jun 12 '17 09:06 ashleyci

Thanks for this @ashleyci.

The docs for the .fail method live in the code here for expect and here for should. I think that is where the duplicate entry is coming from, so we could always set one of those docstrings to ignore (by changing /** to /*!). As for adding examples, you're right we should totally do that! How do you feel about making a PR into chai, to that effect @ashleyci?

keithamus avatar Jun 12 '17 18:06 keithamus

What do each of the arguments do? When using Mocha, the message argument comes up (i.e. AssertionError: Test fails) but none of the others do.

Peter-Lavigne avatar May 01 '20 14:05 Peter-Lavigne