A Mocha reporter to allow creation of JavaScript koans for learning enlightenment
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.gitignore
index.js
license
package.json
readme.md

readme.md

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:
  1. Create a test directory to hold your koans.

  2. 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
    
  3. 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";
  4. 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(__);
      });
    });
  5. You can then run koans with mocha, or map npm test to this by adding this to your package.json:

    "scripts": {
      "test": "mocha"
    }