mocha-vary

Easy parametrization for Mocha tests


Keywords
mocha, test, parametrization, parametrized, parametrize
License
MIT
Install
npm install mocha-vary@0.9.0

Documentation

This module allows to parametrize Mocha tests through injection of all required parameters into top-level describes.

Installation

npm install --save mocha-vary

Example

a.js:

var describe = require('mocha-vary').describe

describe('This will be parametrized', function(param1, param2) {
  // some tests, inner describes, etc.
})

b.js:

var describe = require('mocha-vary').describe,
    skipFirstRun = describe.skipWhen('first run')

describe('This will be parametrized too', function(param1, param2) {
  // some tests
})

skipFirstRun('And this too, but it will skip the first run', function(param1, param2) {
  // some tests
})

run.js:

var vary = require('mocha-vary')

vary.run({
  'first run' : { params: ['a', 'b'] },
  'second run': { params: ['c', 'd'] }
})

API

The proper documentation is pending, for now you can inspect the test suite and the examples.

License

MIT