JS: Automated testing
Theory: power-assert
Conventional asserts have a powerful alternative: power-assert. This library adds a little magic to a familiar tool.
Here's an example of a check using the standard assert module:
The output shows the statement itself and the result of the test. But it isn't clear what the user object is and what structure it has. To get this information, you'll have to get involved in debugging. But you can instead use the power-assert library:
And look at the output:
Try to stop and examine this conclusion carefully. What is shown here? power-assert makes debugging as easy as physically possible. It shows the value of each object and the result of each operation included in the expression passed to the assert function. In addition, at the end it compares the lines and says exactly what the difference was between them.
Here's another interesting example from the documentation:
Impressed? Most modern frameworks don't produce an output as convenient as what power-assert does. It can be integrated with anything, but you will need additional tools to get this mapping, such as Babel / Webpack or other libraries listed in the documentation.
An example of using power-assert with Babel:

