December 2017
Intermediate to advanced
282 pages
5h 54m
English
Mocha is an asynchronous JavaScript testing framework that runs on Node.js and has salient features to support unit testing the web components.
We can install Mocha globally with npm using the following command:
npm install --global mocha
We can install it as a development dependency to our project using the following command:
npm install --save-dev mocha
We can also use chai, an easy to consume behavior/test-driven development assertion library for JavaScript testing frameworks. We use the following command:
npm install chai
Once Mocha and Chai are installed, we can add the following web content to the components to unit test the respective components:
//HTML<div id="mocha"></div>//JavaScriptvar ourDataArray = { Questions: [{ Text: ...Read now
Unlock full access