Assertions
Mocha allows you to use any assertion library you wish.
In many of this site’s examples, we’re using Node.js’ built-in assert module — but generally, if it throws an Error
, it will work!
This means you can use libraries such as:
- better-assert - C-style self-documenting
assert()
- chai -
expect()
,assert()
andshould
-style assertions - expect.js -
expect()
style assertions - should.js - BDD style shown throughout these docs
- unexpected - “the extensible BDD assertion toolkit”