Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including protractor-cucumber-framework with all npm packages installed. Try it out:

require("cucumber/package.json"); // cucumber is a peer dependency. require("protractor/package.json"); // protractor is a peer dependency. var protractorCucumberFramework = require("protractor-cucumber-framework")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

protractor-cucumber-framework v6.1.3

Protractor framework for Cucumber.js

Protractor Cucumber Framework

npm-version Join the chat at Build Status dependencies dev dependencies peer dependencies download-count open-issues contributors

This framework was originally part of angular/protractor and is now a separate module to decouple cucumber.js.


npm install --save-dev protractor-cucumber-framework


To implement this framework, utilize the protractor custom framework config option:

exports.config = {
  // set to "custom" instead of cucumber.
  framework: 'custom',

  // path relative to the current config file
  frameworkPath: require.resolve('protractor-cucumber-framework'),

  // require feature files
  specs: [
    'path/to/feature/files/**/*.feature' // accepts a glob

  cucumberOpts: {
    // require step definitions
    require: [
      'path/to/step/definitions/**/*.steps.js' // accepts a glob

Passing Options to cucumberjs

All of the cucumberOpts will be passed to cucumberjs as arguments.

For example, to call cucumberjs with the --strict, --no-colors, and to specify custom formatters:

cucumberOpts: {
  strict: true,
  'no-colors': true,
  format: ['progress', 'pretty:output.txt'],
  // ...

The following parameters have special behavior:

  • require - globs will be expanded to multiple --require arguments
  • rerun - value is passed as an argument; for use with the rerun feature

Formatters when tests are sharded or with multi capabilities

If you have a formatter that outputs to a path and your tests are sharded or you have multi capabilities then this library will add the PID to the path to make them unique. The reason for this is multiple processes can write to the same path which ends up clobbering each other. You'll end up with 1 file per process that protractor spawns.

exports.config = {
  capabilities: {
    shardTestFiles: true,
    // ...

  cucumberOpts: {
    format: 'json:results.json',
    // ...

If there were 2 feature files then you can expect the following output files...


...where the numbers will be the actual PIDs.

Uncaught Exceptions

If your process abruptly stops with an exit code 199 then your steps most likely threw an uncaught exception. Protractor is capturing these and exiting the process in this situation. The solution is to upgrade to at least protractor version 4.0.10 and add the following to your protractor conf...

  ignoreUncaughtExceptions: true

This allows cucumber to handle the exception and record it appropriately.


Pull requests are welcome. Commits should have an appropriate message and be squashed.

For Contributors

Ensure that the following dependencies are installed:

  • Java SDK and JRE
  • node.js
  • Google Chrome

Clone the github repository:

git clone
cd protractor-cucumber-framework
npm install


Start a selenium server:

npm run webdriver

Start the test app that tests will be run against in a separate shell:

npm start

Run the tests in a separate shell:

npm test

For Maintainers


  1. bump version
  2. npm publish
  3. tag release (git tag vx.x.x && git push origin master --tags)
  4. build github release (npx release)
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free