mocha-koans-reporter

0.2.0 • Public • Published

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"
    }

Readme

Keywords

none

Package Sidebar

Install

npm i mocha-koans-reporter

Weekly Downloads

3

Version

0.2.0

License

WTFPL

Last publish

Collaborators

  • froots