Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cucumber/gherkin-streams

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cucumber/gherkin-streams

Streams for reading Gherkin parser output

  • 5.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
increased by3.4%
Maintainers
2
Weekly downloads
 
Created

What is @cucumber/gherkin-streams?

@cucumber/gherkin-streams is an npm package that provides a way to parse Gherkin documents (commonly used in BDD - Behavior Driven Development) into streams. This allows for efficient processing of Gherkin syntax in a streaming fashion, which can be useful for large files or real-time processing.

What are @cucumber/gherkin-streams's main functionalities?

Parsing Gherkin Documents

This feature allows you to parse Gherkin documents from file paths and process them as streams. The example demonstrates reading a Gherkin file and writing the parsed output to a JSON file.

const { fromPaths } = require('@cucumber/gherkin-streams');
const { pipeline } = require('stream');
const fs = require('fs');

const gherkinStream = fromPaths(['./path/to/feature/file.feature']);
const outputStream = fs.createWriteStream('./output.json');

pipeline(
  gherkinStream,
  outputStream,
  (err) => {
    if (err) {
      console.error('Pipeline failed.', err);
    } else {
      console.log('Pipeline succeeded.');
    }
  }
);

Streaming Gherkin from Strings

This feature allows you to parse Gherkin documents from strings and process them as streams. The example demonstrates creating a Gherkin stream from a string and outputting the parsed data.

const { fromSources } = require('@cucumber/gherkin-streams');
const { pipeline } = require('stream');
const { Readable } = require('stream');

const gherkinSource = `Feature: Example feature
  Scenario: Example scenario
    Given an example step`;

const gherkinStream = fromSources([{ data: gherkinSource, uri: 'example.feature' }]);
const outputStream = new Readable({ read() {} });

pipeline(
  gherkinStream,
  outputStream,
  (err) => {
    if (err) {
      console.error('Pipeline failed.', err);
    } else {
      console.log('Pipeline succeeded.');
    }
  }
);

outputStream.on('data', (chunk) => {
  console.log(chunk.toString());
});

Other packages similar to @cucumber/gherkin-streams

FAQs

Package last updated on 31 Mar 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc