Created: 2014-05-18 20:28
Updated: 2018-12-18 04:46

cucumber-js-caffeinator Build Status

Cucumber.js supercharged with Mocha reporters (both built-in and third-party).

This project is just a plugin (i.e. it does not replace Cucumber.js in any way. In fact, you have to npm install cucumber prior to cucumber-caffeinator).


$ npm install --save cucumber-caffeinator


Imagine you keep your tests under "test" directory as shown bellow:


Now, depending on how you run cucumber and on the level of coupling you are willing to introduce, you have the following options:

Use cucumber-js (or cucumber.js) shell script as before but with addition of "--require ./node_modules/cucumber-caffeinator/src/index.js --reporter:<mocha's reporter name>".

So, for example, if you are running cucumber-js like so

$ cucumber-js test/features

and all you can think of is "nyan" reporter, then type in

$ cucumber-js --require ./node_modules/cucumber-caffeinator/src/index.js --reporter:nyan --require test/features test/features

and hit enter. To switch between different reporters change the value next to "--reporter:" (e.g. --reporter:spec, --reporter:xunit, ...).

Note the addition of "--require test/features". Cucumber's CLI disables automatic scripts loading on "--require", so you have to add that part as well.

(OR) Add require('cucumber-caffeinator').call(this, options) to the world.js (recommended)

In this case world.js might look like:

var caffeinator = require('cucumber-caffeinator');

module.exports = function() {, {
        reporter: process.env.REPORTER || 'spec'


Note that you'll still be able to switch reporters with "--reporter:<mocha's reporter name>". In case of cucumber-js (or cucumber.js) shell script it's as simple as cucumber-js --reporter:nyan test/features.


  • 1.1.4 - Fixed pending/fail callbacks advising (by jhenriquez).
  • 1.1.3 - Compatibility with Cucumber.js 0.4.3.
  • 1.1.2 - Fixed "Test duration: NaN".
  • 1.1.1 - Fixed "RangeError: Maximum call stack size exceeded", Cucumber's output suppression.
  • 1.1.0 - Backgrounds support, turned off leaks detection.
  • 1.0.0 - Requires Cucumber.js >=0.4.1. Better compatibility with existing Mocha reporters, optional activation and output formatting.
  • 0.1.0 - Compatible with Cucumber.js <=0.4.0.


MIT License

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more