Socket
Socket
Sign inDemoInstall

gherkin-formatter

Package Overview
Dependencies
28
Maintainers
6
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gherkin-formatter

Tool to format gherkin-ast model to gherkin string


Version published
Weekly downloads
4.9K
decreased by-28.9%
Maintainers
6
Install size
2.55 MB
Created
Weekly downloads
 

Changelog

Source

1.2.2 - 2024-01-22

Fixed

  • Fixed issue with escaped pipe in table cell (#26)

Readme

Source

gherkin-formatter

Downloads Version@npm Version@git CI Docs

Tool to format gherkin-ast model to gherkin string

Usage

The format function of this package provides a formatted string (gherkin document) from your AST.

In TypeScript

import { format, FormatOptions } from "gherkin-formatter";
import { Document } from "gherkin-ast";
import { read } from "gherkin-io";

const document: Document[] = await read("./test.feature");
const options: FormatOptions = {separateStepGroups: false};
console.log(format(document[0], options));
// Feature: Test Feature
//
//   As a user...

In JavaScript

const {format, FormatOptions} = require("gherkin-formatter");
const {Document} = require("gherkin-ast");
const {read} = require("gherkin-io");

const document = await read("./test.feature");
const options = {
    separateStepGroups: false
};
console.log(format(document[0], options));
// Feature: Test Feature
//
//   As a user...

Configuration - FormatConfig

Passing a FormatConfig object to format method (or other Ast type methods where it's applicable), how feature file text is rendered can be set.

OptionDescriptionDefault
oneTagPerLineShould the tags be rendered separately, one by line?false, i.e., all tags of a scenario, feature, etc. will be rendered in the same line
separateStepGroupsShould step groups (when-then) be separated?false
compactShould empty lines be skipped, removed from the result?false, i.e., there will be empty lines in appropriate places
lineBreakThe line break character(s).null, i.e., it will determine the line-break based on the platform
indentationThe indentation character(s).' ', i.e., it uses two space characters to add indentation where it's appropriate
tagFormatThe tag format to be used (see gherkin-ast.TagFormat.FUNCTIONAL, i.e., the tags will be outputed as @name(value)

Other

For detailed documentation see the TypeDocs documentation.

This package uses debug for logging, use gherkin-formatter to see debug logs:

DEBUG=gherkin-formatter* node my-script.js

Keywords

FAQs

Last updated on 22 Jan 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc