Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kahneraja/2ef77a0fcdd27a537b542881080e2196 to your computer and use it in GitHub Desktop.
Save kahneraja/2ef77a0fcdd27a537b542881080e2196 to your computer and use it in GitHub Desktop.

1. Get NodeJs.

...

2. Install mocha globally.

> npm install -g mocha

3. Create working directory

> mkdir test-garden
> cd test-garden

4. Create a test.js file.

var assert = require('assert');
describe('Fruit', function() {
  describe('Apple', function() {
    it('should be either red or green', function() {
      var colour = 'red';
      assert.equal('red', colour);
    });
  });
});

5. Run it!

> mocha test.js

Should return follow result.

  Fruit
    Apple
      √ should be either red or green


  1 passing (16ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment