How it works...

Chai is a simple library that implements some functions and throws exceptions when some conditions are not satisfied. Mocha, on the other hand, runs certain bits of code, collects the exceptions, and tries to display them to the user in a nice way.

While it's largely a matter of taste as to what style to use, there are some subtle differences between the three styles.

  • Should has the added value of being more eloquent and readable. Unfortunately, it extends Object, adding the should function to everything. You shouldn't mind if you don't know how to react to the last phrase, but the correct way to behave is run and scream in pain; never extend Object.
  • Assert means writing a detailed description of every assertion, and this ...

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.