Check out example codes for "how to run mocha tests form a file". It will help you in understanding the concepts better.

Code Example 1

Mocha is javascript test framework!

Code Example 2

Mocha is a JavaScript test framework!

var assert = require('assert');
describe('Array', function () {
  describe('#indexOf()', function () {
    it('should return -1 when the value is not present', function () {
      assert.equal([1, 2, 3].indexOf(4), -1);
    });
  });
});

Code Example 3

$ mocha -g 'logs a'

Learn ReactJs, React Native from akashmittal.com