More expressive assertions with Chai

We have already installed chai as a dependency of our project, but we have not yet used it. Specifically, I am using version 1.9.1, but any 1.x version should be OK.

Until now, we have been using the standard assert package to create our assertions. The assert package is not bad, but it is limited to a few assertions. It is not extensible, and some people found it a bit difficult to read. I personally always find myself wondering, "Is the first parameter the actual value or the expected one?" Actually, the first parameter is the actual value, and the second one is the expected value. This is important because the report message depends on distinguishing the actual value from the expected one. Let's change the ...

Get Learning Behavior-driven Development with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.