mycha

/'maɪ.kɑː/

Mycha

/'maɪ.kɑː/

A thin wrapper around mocha that finds tests anywhere in your project and provides a utility that gets tests up and running quickly

  • npm install --save-dev mycha
  • add ./node_modules/.bin to your PATH environment variable
  • mycha install

    • prompts you for where you would like to install your default test helper, testHelperPath

    • runs

      npm install --save-dev chai
      npm install --save-dev sinon
      npm install --save-dev sinon-chai
    • writes to testHelperPath

      chai = require 'chai'
      sinon = require 'sinon'
      chai.use require 'sinon-chai'
       
      global.expect = chai.expect
      global.sinon = sinon
       
      process.env.NODE_ENV = 'test'
    • writes to mycha.coffee

      module.exports =
       
        # Default options to pass to mocha (can be overriden by command line options) 
        mochaOptions:
          colors: yes
          compilers: 'coffee:coffee-script/register'
          reporter: 'dot'
       
        # Path patten used for finding tests (see https://github.com/isaacs/minimatch) 
        testFilePattern: '**/*_{spec,test}.{coffee,js}'
       
        # Files to include before all tests 
        testHelpers: [
          '#{@testHelperPath}'
        ]
  • mycha [mochaOptions] [<folder>...] [<file>...]

    • if no folders or files are specified runs all tests
    • if folders or files are specified, pass them through to mocha
  • deploy a new patch version: ./release