Skip to content

Chai plugins

Talysson de Oliveira Cassiano edited this page Mar 28, 2017 · 1 revision

Chai is a highly pluggable expectiation library, and there are some plugins that comes by default on this boilerplate, it is important to read it because one of them make some of the expectiations work differently of how they're described on the Chai documentation.

  • dirty-chai: Chai has some expectations that don't need to be called as methods, like expect(something).to.be.ok. It can be error prone, because it's possible that you make a typo like expect(something).to.be.okay and don't notice it, your test will pass but the expectation won't be run. dirty-chai modifies Chai internals so all of those expecations can now be called as methods, like this: expect(something).to.be.ok(). Now if you make a type it'll throw an error warning you that the okay() function doesn't exist;
  • chai-change: Enables you to create expectation about a change after something is called, like expecting that the amount of users in the database increases by 1 after some operation in run.
Clone this wiki locally