Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
gherkin-formatter
Advanced tools
Tool to format gherkin-ast model to gherkin string
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...
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.
Option | Description | Default |
---|---|---|
oneTagPerLine | Should 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 |
separateStepGroups | Should step groups (when-then) be separated? | false |
compact | Should empty lines be skipped, removed from the result? | false , i.e., there will be empty lines in appropriate places |
lineBreak | The line break character(s). | null , i.e., it will determine the line-break based on the platform |
indentation | The indentation character(s). | ' ' , i.e., it uses two space characters to add indentation where it's appropriate |
tagFormat | The tag format to be used (see gherkin-ast. | TagFormat.FUNCTIONAL , i.e., the tags will be outputed as @name(value) |
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
FAQs
Tool to format gherkin-ast model to gherkin string
The npm package gherkin-formatter receives a total of 7,494 weekly downloads. As such, gherkin-formatter popularity was classified as popular.
We found that gherkin-formatter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.