Mocha is a JavaScript test framework for Node.js
Lets build a simple application to test this
Install mocha package as dev dependency

Now in test folder, we will be adding a simple test js file

Here we created a file named mochatests file in test folder.
The pattern for Mocha is
describe() – what group we are testing and can have nested describes for each feature
and for main parent we can set some values in before() and after() functions to execute something for once
And for child beforeEach() here it executes before each feature is completed. It means here after it() function we can set a value back and it() describes the test.
to run test, use npm run test in terminal

You can see all the tests are passed
Code in my github: https://github.com/pbndru/phani.mocha