Back to Mocha

Assertions

docs-next/src/content/docs/features/assertions.mdx

11.7.6719 B
Original Source

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() and should-style assertions
  • expect.js - expect() style assertions
  • should.js - BDD style shown throughout these docs
  • unexpected - "the extensible BDD assertion toolkit"