Wednesday, 14 June 2017

mocha module with nodeJs tutorial

mocha module with nodeJs tutorial

Question: What is Mocha?
Mocha is a Rich JavaScript framework running on Node.js and in the browser making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.

Question: How to install Mocha?
npm install --global mocha

Question: How to write Asynchronous code with Mocha?
describe('User', function() {
  describe('#save()', function() {
    it('should save without error', function(done) {
      var user = new User('Luna');;

Question: How to write Synchronous code with Mocha?
describe('Array', function() {
  describe('#indexOf()', function() {
    it('should return -1 when the value is not present', function() {

Question: How we can achieve HOOKS with Mocha?
describe('hooks', function() {
  before(function() { });
  after(function() {  });
  beforeEach(function() {  });
  afterEach(function() {});  

Question: What is Github URL for mocha?

Question: In Which language mocha is written?

Question: What is offical website URL of Mocha?

No comments :

Post a Comment