mocha-cucumber
v0.0.5
Published
Mocha and Cucumber - two great tastes that taste great together!
Maintainers
Readme
mocha-cucumber
mocha-cucumber is a UI module for mocha that allows you to describe your features using Given/When/Then!
Installing
You should first have mocha installed:
npm install -g mochaThen install mocha-cucumber, either globally or inside your project:
npm install -g mocha-cucumberUsage
Write your feature(s):
{expect} = require 'chai'
Feature 'Math', ->
Scenario 'Incrementing numbers', ->
Given 'A number that starts at 0', ->
@n = 0
When 'the number is incremented', ->
@n++
Then 'it becomes 1', ->
expect(@n).to.equal 1Or if you prefer plan ole js:
var expect = require('chai').expect;
Feature('Math', function() {
Scenario('Incrementing numbers', function() {
Given('A number that starts at 0', function() {
this.n = 0;
});
When('the number is incremented', function() {
this.n++;
});
Then('it becomes 1', function() {
expect(this.n).to.equal(1);
});
});
});Then run mocha:
mocha --ui mocha-cucumber test/*And you get:

What's going on?
mocha-cucumber aliases Scenario and Feature as alieses to mocha's
exising describe, and Given/When/Then/And/But as aliases to mocha's
it BDD methods.
describe and it still work as usual, so you can combine your cucumber features
with BDD specs and it will Just Work(tm).
Contributing
Feel free to submit issues and/or PRs! In lieu of a formal style guide, please follow existing styles.
