cucumber-promise

Backwards compatible cucumber promise support. All these features are implemented in the core cucumber starting with version 0.5.0. If you are using it you don't need cucumber-promise anymore

Usage no npm install needed!

<script type="module">
  import cucumberPromise from 'https://cdn.skypack.dev/cucumber-promise';
</script>

README

cucumber-promise

Backwards compatible cucumber promise support. All these features are implemented in the core cucumber starting with version 0.5.0. If you are using it you don't need cucumber-promise anymore

Usage

Just wrap your implementation steps function into cpromise, and use promises, or implement steps without explicitly calling the callback function.

var cpromise = require("cucumber-promise").cpromise;
module.exports = cpromise(function() {
    // the old way works
    this.Given(/^I run a test with cucumber\-promise$/, function(callback) {
        callback();
    });
    // code without callbacks works
    this.Then(/^I run code without callbacks$/, function() {
        // if no callback it's present, this also works
    });
    // and promises also work
    this.Then(/^I run a promise call$/, function() {
        return new Promise(function(fulfill, reject) {
            // promise resolving
            fulfill();
        });
    });
});

Install

In order to install this just run:

npm install --save-dev cucumber-promise