a jest runner for writing cucumber tests
Last updated 2 months ago by dayne.mentier .
MIT · Bugs · Original npm · Tarball · package.json
$ cnpm install pekel 
SYNC missed versions from official npm registry.

< pekel >

Build Passing Build Passing

Jest Test Runner for the Cucumber Framework

npm i pekel

Table of Contents

Gherkin Features

Supported Feature Notes
:white_check_mark: And
:white_check_mark: Background
:white_check_mark: But
:white_check_mark: Comments
:white_check_mark: Data Table
:white_check_mark: DocString if pekel finds the docString is JSON, it will parse it for you
Rule haven't seen examples of this; not sure if it's worth it
:white_check_mark: Scenario
:white_check_mark: Scenario Outline

Cucumber Features

Supported Feature Notes
:white_check_mark: After called after each scenario in a feature file
:white_check_mark: AfterAll called after the feature file is completed; unlike Cucumber, you will have access to "this" context here.
:white_check_mark: Before called before each scenario per feature file
:white_check_mark: BeforeAll called before the feature file is started; unlike Cucumber, you will have access to "this" context here.
:white_check_mark: Given
setDefaultTimeout use jest.setTimeout or set the timeout property in your jest config
:white_check_mark: setDefinitionFunctionWrapper
:white_check_mark: setWorldConstructor
Tags need to identify a way to pass tags through jest
:white_check_mark: Then
:white_check_mark: When

Getting Started

Jest Config

If you have existing jest test cases that do not use Cucumber, create a separate configuration. You can use the Jest CLI to run against specific configurations: jest --config=path/to/your/config.json


 "moduleFileExtensions": [

* If you are not using typescript, remove "ts" and "tsx"


"runner": "pekel"

setupFiles (optional):

 "setupFiles": [

* Add your polyfills here, and it is recommended that for integration testing to add your app entry component here.


 "setupFilesAfterEnv": [


 "testMatch": [


"transform": {
    "^.+\\.(js|jsx|ts|tsx)$": "babel-jest"

* If you are not using typescript, remove "ts" and "tsx"

restoreMocks (optional):

"restoreMocks": true

If you are planning on writing integration tests, I highly recommend that you set this to true. There is an open bug for jest to fix an issue where it does not unset manual mocks that are defined using __mock__ folders. However, if this is set true, pekel will perform a scan of all __mock__ folders and files and manually unmock them for you.




Feature: Button

Given I go to home
When I click the login button
Then the login button is not visible



import React from 'react';
import ReactDOM from 'react-dom';
import { AfterAll, BeforeAll } from 'cucumber';

import SignUp from './path/to/your/app';

BeforeAll(function () {

AfterAll(function () {

You can choose to use the hooks to render/unmount your component before/after each feature file like above, or you can add a path to your application entry point to your jest configuration's setupFiles property. The latter is more performant.



import { Given, When, Then } from 'cucumber';
import expect from 'expect';

Given(/I go to (.*)$/, function(link) {
    window.location.hash = `#/${link}`;

When(/I click the (\S+) button$/, function(name) {

Then(/the (\S+) button is (visible|not visible)$/, function(name, state) {
        .toEqual(state === 'visible')


setWorldConstuctor allows you to set the context of "this" for your steps/hooks definitions. This can be helpful when you want to maintain state between steps/hooks or want your steps/hooks to have access to some predefined data


import { setWorldConstructor } from 'cucumber';

    class MyWorld {
        pages = [];

Current Tags

  • 0.0.8                                ...           latest (2 months ago)

12 Versions

  • 0.0.8                                ...           2 months ago
  • 0.0.7                                ...           2 months ago
  • 0.0.6                                ...           2 months ago
  • 0.0.5                                ...           2 months ago
  • 0.0.5-rc1                                ...           2 months ago
  • 0.0.4                                ...           2 months ago
  • 0.0.4-rc3                                ...           2 months ago
  • 0.0.4-rc2                                ...           2 months ago
  • 0.0.4-rc1                                ...           2 months ago
  • 0.0.3                                ...           2 months ago
  • 0.0.2                                ...           2 months ago
  • 0.0.1                                ...           2 months ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dependents (0)

Copyright 2014 - 2017 © |