Node's assert module is used for simple unit testing. In many cases, it suffices as a basic scaffolding for tests, or is used as the assertion library for testing frameworks (such as Mocha, as we'll see later). Usage is straightforward: we want to assert the truth of something, and throw an error if our assertion is not true. Consider this example:
> require('assert').equal(1,2,'Not equal!')AssertionError [ERR_ASSERTION]: Not equal!>
If the assertion were true (both values are equal), nothing would be returned:
> require('assert').equal(1,1,"Not equal!")undefined
Following the UNIX Rule of Silence (when a program has nothing surprising, interesting, or useful to say, it should say nothing), assertions only return a value ...