npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

karma-gherkin_yadda-preprocessor

v0.0.6

Published

A karma preprocessor. Compiles Gherkin features to yadda steps.

Downloads

12

Readme

Introduction

This preprocessor translates Gherkin-Features to executable yadda-steps and saves them into one or more files. Actually this package is a wrapper of the module gherkin-yadda for making it runnable in karma.

Installation

npm install --save-dev karma-gherkin_yadda-preprocessor

Example

From: Gherkin

Feature: Login
  In order to access the application
  As a registered user
  I need to be able to log in
  Scenario: Successful login

    Given I am a registered user named "Henk"
    When I enter my credentials and submit the login form
    Then I should see a welcome page

To: yadda step library

'use strict';

module.exports = {
	yaddaStepLibrary: yaddaStepLibrary,
	featureBaseName: 'google.feature'
};

var expect = require('chai').expect;
var Yadda = require('yadda'),
	English = Yadda.localisation.English,
	dictionary = new Yadda.Dictionary()
		.define('number', /(d+)/),
	yaddaStepLibrary = English.library(dictionary);

// Given I am a registered user named "Henk"
yaddaStepLibrary.given(/I am a registered user named "$Henk"/, function(input1, done) {

});

// When I enter my credentials and submit the login form
yaddaStepLibrary.when(/I enter my credentials and submit the login form/, function(done) {

});

// Then I should see a welcome page
yaddaStepLibrary.then(/I should see a welcome page/, function(done) {

});

Special Aspects

1. Context Variables

If a word in a feature step is surrounded by double quotes it can be accessed as an parameter of the generated yadda step callback.
Example:

  • Feature Step:
Given I am a registered user named "Henk"
  • Yadda Step:
yaddaStepLibrary.given(/I am a registered user named "$Henk"/, function(input1, done) {
    ...
});

2. Identical Steps

Identical feature steps are going to be generated only one time.

3. Existing Target File

Ýou can choose between the following options if the target file already exists.

3.1 Abort

Gherkin-yadda will be terminated without generating.

3.2 Merge

Only the yadda step feature descriptions of the existing target file are going to be overwritten. Comments with identical feature descriptions are staying the same.

3.3 Overwrite

The existing target file will be overwritten completely.

Configuration:

All mentioned sections are members of karma's config object.

How to include:

Add the name of this package to the plugins section.

plugins: [
    'karma-gherkin_yadda-preprocessor'
]
How to assign:

Assign the value gherkin_yadda to your file match pattern key at the preprocessors section.

preprocessors: {
    'test/features/*.feature': 'gherkin_yadda'
}
How to adjust:

Just append the object gherkin_yaddaPreprocessor as own section. All possible parameters are shown in the example below.

gherkin_yaddaPreprocessor: {
    displayOutputPath: false,
    useChai : true,
    useDefine: true,
    generateFeatureBaseName: true,
    handleExistingFile: 'merge'
}

The default values are:

  • displayOutputPath: false
  • useChai : false
  • useDefine: false
  • generateFeatureBaseName: false
  • handleExistingFile: 'terminate'

The use of the param "handleExistingFile" prevents an dialog for already existing target files since it decides in advance how to handle existing target files. Possible values are:

  • 'terminate'
  • 'merge'
  • 'overwrite'

File Location

All generated files are saved into a folder named "step_definitions". It will be created in those directories where the feature files are found.

Todo

  • add parameter for hooks

Maintainer

kaasbaardje

License

MIT