expect.fail() and should.fail() have been added in version 2.1.0. Although they both have a docstring (docstring for expect and docstring for should), they cannot be found in the documentation. Their assert counterpart, however, can be found here.
That would be very useful for plugin developers :-)
Thanks @astorije. The docs are available in the code, they just haven't been run through the website yet :cry:
Just like #488 I'll close this. Please head on over to chaijs/chai-docs#74 and chaijs/chai-docs#34 to help out if you can.
This still isn't documented as far as I can tell :cry:
I think it may be because the docs for expect/should are generated based on the assertions.js file instead of the interface files.
Maybe adding .fail to the same namespace as the other assertions would be enough, but I'm not sure about it, I'd need to take a further look at dox docs (lol) to make sure.
EDIT:
Taking a look at these might be helpful:
https://github.com/chaijs/chai-docs/blob/gh-pages/_data/chai.json#L687
https://github.com/chaijs/chai-docs/blob/gh-pages/_layouts/api.html
Looks like this is a small bug with the docs I suppose.
The way the docs work right now, is that the BDD (expect/should) pages set yaml front matter of api_namespace to BDD (https://github.com/chaijs/chai-docs/blob/gh-pages/api/bdd.md). As @lucasfcosta points out - the api page then iterates through all of the data generated from dox
(found here https://github.com/chaijs/chai-docs/blob/gh-pages/_data/chai.json) and if the namespace matches (in this case, BDD) then that doc gets rendered. So for example .a(type) (docs in code are here: https://github.com/chaijs/chai/blob/master/lib/chai/core/assertions.js#L131-L160) gets rendered here: http://chaijs.com/api/bdd/#atype.
The problem is that should.fail has a @namespace of Should (https://github.com/chaijs/chai/blob/master/lib/chai/interface/should.js#L44-L56), and expect.fail has Expect as the @namespace.
The easiest way to fix: just change the @namespace in the .fail methods to BDD.
Seems good, I'm gonna do it this afternoon then, this seems to be very important for our users.
Hi :wave:
I went looking for expect.fail() again today but I still can't find it in the documentation.
Am I blind?
Hey @alexbooker we have yet to release the update docs. It'll happen in the next few weeks, rest assured.
@keithamus Thanks for the update.
Please keep up the top-notch work :smile:
FYI, I just checked but couldn鈥檛 find it either. Glad it exists 馃槃
First two arguments are still not documented as optional:
http://chaijs.com/api/bdd/#method_fail