Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cucumber-enhancement

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cucumber-enhancement

Enhances cucumber.js to make it easier to interact between steps

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

cucumberjs-enhancement

Enhances cucumber.js to make it easier to interact between steps.

Simple usage

  • Create a file features/support/enhancement-hook.js as follows
module.exports = require('cucumber-enhancement');

This does the following:

  • Adds an additional argument to the step callback that saves the values for use in other steps:
this.Given(/^I am on the "([^/"]*)\/([^"]*)" repository on GitHub$/, function (owner, repo, callback) {
    // This saves owner and repo for use in other steps
    callback(null, {
        owner: owner,
        repo: repo
    });
});
  • Adds a new optional argument to when, then, and given to require data saved from other steps:
this.Then(/^I should see "([^"]*)" as one of the branches$/, {
    branches: this.joi.array()
}, function (data, branch, callback) {
    // data.branches contains data saved from another step
    expect(data.branches).to.contain(branch);

    setImmediate(callback);
});
  • Exposes joi interface for quick access during step definition (see above).

  • Bakes request module into the world for easy access and automatically sets the scope of the callback function:

this.request({
    method: 'GET',
    uri: 'http://foo.yahoo.com/'
}, function (err, message, response) {
    callback(null, {
        'bar': Object.keys(response)
    });
});
  • Allows you to default values for the request module (mostly used by cucumber @tags):
this.Before("@github_api", function(callback) {
    this.default('headers.User-Agent', 'Cucumber Test');
    this.default('json', true);

    setImmediate(callback);
});

Keywords

FAQs

Package last updated on 13 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc