mocha-koans-reporter

A Mocha reporter to allow creation of JavaScript koans for learning enlightenment

npm install mocha-koans-reporter
9 downloads in the last month

mocha-koans-reporter

A reporter for mocha to simplify the creation of JavaScript koans.

Heavily inspired by and modelled on the New Context Ruby Koans.

Pre-requisities

Install

npm install -g mocha-koans-reporter

Usage

  1. Create a project for your koans with the following dependencies:
  2. Create a test directory to hold your koans.
  3. Create a test/mocha.opts file to specify default mocha running options with the following contents

     --reporter mocha-koans-reporter
     --require test/common
     --bail
     --recursive
     --watch
    
  4. Create a test/common.js file to specify global module dependencies across your koans, and set other defaults, e.g:

     global.chai = require('chai');
     global.expect = chai.expect;
     global.__ = "FILL ME IN";
    
  5. Create 1 or more test files in your test directory, e.g. test/about-truth.js:

     describe('truthiness', function() {
       it('is indeed true', function() {
         expect(true).to.equal(__);
       });
     });
    
  6. You can then run koans with mocha, or map npm test to this by adding this to your package.json:

     "scripts": {
       "test": "mocha"
     }
    
npm loves you