🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

karma-cucumber-js

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-cucumber-js

Karma adapter for running Cucumber.js features

1.0.3
latest
Source
npm
Version published
Weekly downloads
22
-45%
Maintainers
1
Weekly downloads
 
Created
Source

karma-cucumber-js

This is the #1 Cucumber.js adapter for Karma. In contrast to other adapters it supports latest version of Cucumber.js (1.3.1). This adapter does not include Cucumber.js. Cucumber.js and jQuery (required by cucumber-html) are peer dependencies.

Getting Started

npm install jquery --save-dev
npm install cucumber --save-dev
npm install karma-cucumber-js --save-dev

Configuring karma.conf.js

...
frameworks: ['cucumber-js'],
...
plugins: [
  ...
  'karma-cucumber-js' // If you have plugins section then also specify this, you could omit it otherwise
  ...
],
...
files: [
  // Feature files to test
  { pattern: 'features/*.feature', included: false },
  ... // Include JS files with step definitions and any other files they require
],
...
client: { // Specify this if you want to test features/scenarios with certain tags only
  args: ['--tags', '@frontend']
},
...
reporters: ['bdd-json'], // Specify this reporter if you need to integrate test results into living documentation
bddJSONReporter: {
  outputFile: 'results.json' // 'results.json' will be filled with all scenarios test results
},
...

Step Definitions

In your step definitions files write them like this:

__adapter__.addStepDefinitions(function (scenario) {
    scenario.Given(/^there is a test step$/, function () { });
    scenario.When(/^it is executed$/, function () { });
    scenario.When(/^it is not executed$/, function (callback) { callback(null, 'pending'); });
    scenario.Then(/^test succeeds$/, function () { });
    scenario.Then(/^test fails$/, function (callback) { callback(new Error('Step failed')); });
});

Building Instructions

After getting adapter's code to build the adapter run the following command:

npm run build

License

Copyright (c) 2016 Eugene Shalyuk. This project is licensed under the terms of the MIT license.

Keywords

karma-plugin

FAQs

Package last updated on 23 Jul 2017

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