Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@cucumber/gherkin-streams

cucumber4.1mMIT5.0.1TypeScript support: included

Streams for reading Gherkin parser output

readme

Gherkin Streams

This module contains utilities to use the Gherkin library with streams.

Installation

gherkin-streams has 3 peer dependencies: @cucumber/gherkin, @cucumber/messages and @cucumber/message-streams.

You need to have @cucumber/gherkin and@cucumber/message-streams in your dependencies, @cucumber/messages is actually installed automatically with @cucumber/gherkin.

npm install @cucumber/gherkin-streams @cucumber/gherkin @cucumber/message-streams

Usage

const { GherkinStreams } = require('@cucumber/gherkin-streams')

const options = {
  includeSource: true,
  includeGherkinDocument: true,
  includePickles: true,
}
const stream = GherkinStreams.fromPaths(['features/hello.feature'])

// Pipe the stream to another stream that can read messages.
stream.pipe(...)

Shortening URIs with relativeTo

You can include relativeTo option to avoid emitting longer or absolute URIs, instead making them only relative to the current working directory (or whatever makes sense for your use case):

const { GherkinStreams } = require('@cucumber/gherkin-streams')

// imagine `discoverPaths()` is a function that returns absolute paths
const paths = discoverPaths();
const options = {
  includeSource: true,
  includeGherkinDocument: true,
  includePickles: true,
  relativeTo: process.cwd()
}
const stream = GherkinStreams.fromPaths(paths)

// Pipe the stream to another stream that can read messages.
stream.pipe(...)

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Unreleased

5.0.1 - 2022-03-31

Changed

  • Peer dependencies are now more permissive and simply request any version greater than:
    • @cucumber/gherkin: >=22.0.0
    • @cucumber/messages: >=17.1.1
    • @cucumber/message-streams: >=4.0.0

5.0.0 - 2022-03-07

Changed

  • @cucumber/gherkin, @cucumber/messages and @cucumber/message-streams are now peer dependencies. You now have to add @cucumber/gherkin in your dependencies:
    {
      "dependencies": {
    +   "@cucumber/gherkin": "22.0.0",
        "@cucumber/gherkin-streams": "5.0.0",
      }
    }
    (PR#5)

4.0.0 - 2021-09-01

Changed

  • Upgrade to @cucumber/messages 17.1.0
  • Upgrade to @cucumber/gherkin 21.0.0

3.0.0 - 2021-07-08

Changed

  • Upgrade to @cucumber/messages 17.0.0
  • Upgrade to @cucumber/gherkin 20.0.0

2.0.2 - 2021-05-17

Changed

  • Upgrade to @cucumber/message-streams 2.0.0

2.0.1 - 2021-05-17

Fixed

  • Use ^x.y.z version for @cucumber/* dependencies, allowing minor and patch releases to be picked up.

2.0.0 - 2021-05-15

Added

  • Add ability to specify a relativeTo path for cleaner emitted uris #1510

Changed

  • Upgrade to gherkin 19.0.0

1.0.0 - 2021-03-24