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-assembler
Advanced tools
It allows to convert Gherkin AST to feature file string.
objectToAST(document)
The objectToAST
API method converts the given Gherkin object into GherkinDocument
object.
A complete sample Gherkin object can be found here: Complete Gherkin object.
Params:
{Object} documet
- a single Gherkin objectReturns: {GherkinDocument}
format(document, options)
The format
API method formats the given Gherkin Document(s) to string (which could be written out to feature file(s)).
Params:
{GherkinDocument|Array<GherkinDocument>} document
- a single or multiple Gherkin Documents given in it's AST model.{FormatConfig} options
- options to set attributes of formatting.Returns: {string|Array<string>}
'use strict';
const fs = require('fs');
const assembler = require('gherkin-assembler');
const document = assembler.objectToAST(require('./login.ast.json'));
fs.writeFileSync('./login.feature', assembler.format(document), 'utf8');
FormatConfig
By passing an FormatConfig
object to format method (or other Ast type methods where it's applicable) it can be set, how feature file text is rendered.
Option | Description | Default |
---|---|---|
oneTagPerLine | Should tags rendered separately, one by line? | false , i.e. all tag 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). | \n , i.e. it uses Unix line break, to set Windows style, set \r\n |
indentation | The indentation character(s). | ' ' , i.e. it uses two space character to add indentation where it's appropriate |
Although this package does not contain method to parse feature file to Gherkin object, you can use the gherkin subpackage of CucumberJS.
'use strict';
const fs = require('fs');
const {Parser} = require('gherkin');
const parser = new Parser();
const document = parser.parse(fs.readFileSync('./login.feature'));
// use objectToAST and format to write it to file again
2.0.1 - 2018-03-23
FAQs
Assembling Gherkin ASTs to feature file string
The npm package gherkin-assembler receives a total of 16,671 weekly downloads. As such, gherkin-assembler popularity was classified as popular.
We found that gherkin-assembler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.