Socket
Book a DemoInstallSign in
Socket

gherkin-parser

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

gherkin-parser

Parse gherkin feature files

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
7
-22.22%
Maintainers
1
Weekly downloads
 
Created
Source

gherkin-parser

NPM version build status Test coverage Downloads js-standard-style

Parse gherkin feature files.

Installation

$ npm install gherkin-parser

Usage

const gherkin = require('gherkin-parser')
const fs = require('fs')

fs.createReadStream('some-gherkin-file.feature')
  .pipe(gherkin())
  .pipe(process.stdout)

The parser turns cucumber files into AST. An example:

Feature: Can drink beer when thirsty
  As a drinker
  I want to take beer off the wall
  In order to satisfy my thirst
 
  Scenario: Can take a single beer
    Given 100 bottles of beer on the wall
    When a bottle is taken down
    Then there are 99 bottles of beer on the wall
[
  {
    feature: 'Can drink beer when thirsty',
    perspective: 'drinker',
    desire: 'to take beer off the wall',
    reason: 'to satisfy my thirst',
    scenarios: [
      {
        scenario: 'Can take a single beer',
        given: [
          '100 bottles of beer on the wall'
        ],
        when: [
          'a bottle is taken down'
        ],
        then: [
          'there are 99 bottles of beer on the wall'
        ]
      }
    ]
  }
]

API

transformStream = gherkin()

Create a gherkin transform stream. Transforms gherkin .feature files into an AST object.

See Also

  • gherk.js

License

MIT

Keywords

gherkin

FAQs

Package last updated on 17 Sep 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