Node JS - Node js Assertion Testing - Node - Node JS tutorial - webnode
What is Assertion Testing in Node.js?
- The Node.js Assert is the most elementary way to write tests.It provides no feedback when running your test unless one fails.The assert module provides a simple set of assertion tests that can be used to test in variants.
- The module is intended for internal use by Node.js, but can be used in application code via require ('assert').
- However, assert is not a testing framework and cannot be used as general purpose assertion library.
Related nodejs article tags - node js - node js tutorial - node js examples
Node.js Assert Example:
Let's see a simple example of Node.js Assert.
Node JS Tutorial File: assert_example1.js
It will not provide any output because the case is true. If you want to see output, you need to make the test fail.
Learn Node js - node js Tutorial - file creation command in node.js assertion - node - Node js Examples
Node JS Tutorial File: assert_example2.js
Now you will see the Assertion Error .
Learn Node js - node js Tutorial - errors shown in node.js assertion - node - Node js Examples