
Security News
pnpm 10.16 Adds New Setting for Delayed Dependency Updates
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Gherkin like feature file parser with a dash of lemon.
$ npm install cucumon
const Cucumon = require("cucumon");
const options = {
tagExpression : "", //@focus
//clubBgSteps : true,
}
const cucumonSlice = new Cucumon(options);
const output = cucumonSlice.parse(featureFileAsString);
Cucumon supports gherkin feature file format.
@tag @tag2
@tag3
Feature: statement
Description
Rule: some rule
Background: statement
Given some step
Scenario: statment
When some step
Scenario Outline: statement <header>
Then some step
And data table
#> {}
|header|<header>|
But doc string
#> json
"""
{ header: "<header>" }
"""
Examples:
|header|
|val|
Rule: Other sub feature
Background: statement
Given some step
Example: statment
When some step
@taghere
Scenario Template: statement <header>
Then some step
Scenarios:
|header|
|val|
Note the instruction statment #> {}
. Instruction statments are special comments which can help parser to take some extra steps. Currently, they are supported with scenario, steps, docstring, and data table inputs.
{
feature: {
"keyword": "Feature",
"description": "",
"statement": "Special Characters",
"lineNumber": 1,
"tags": [],
rules: [
{
"keyword": "Rule",
"description": "",
"statement": "some rule",
"lineNumber": 2,
"hasBgSection": true,
"background": {
"keyword": "Background",
"statement": "one per rule",
"description": "Background can have description",
"lineNumber": 14,
"id": -1,
"steps": [
{
"keyword": "Given",
"statement": "a string tokenizer",
"lineNumber": 17,
"arg": null
}
]
},
scenarios: [
{
"keyword": "Scenario",
"statement": "normal scenario",
"description": "",
"lineNumber": 3,
"id": 1,
"tags": [],
"steps": [
{
"keyword": "Given",
"statement": "an example",
"lineNumber": 4,
"arg": {
"content": "some docstring",
"type": "DocString",
"lineNumber": 26,
"instruction": "no format; single line;"
}
}
]
},{
"keyword": "Scenario Template",
"statement": "scenario outline",
"description": "",
"lineNumber": 3,
"id": 1,
"tags": ["@wip"],
"expanded" : [
{
"keyword": "Scenario Template",
"statement": "scenario outline",
"description": "",
"lineNumber": 3,
"id": 1,
"steps": [
{
"keyword": "Given",
"statement": "an example",
"lineNumber": 4,
"arg": null
}
],
"tags": [ "@wip", "@examples" ],
"examplesLineNumber": [ 19 ]
}
],
"examples": [
{
"lineNumber": 10,
"rows": [
{
"lineNumber": 11,
"regex": [ {} ],
"cells": [ "data" ]
}, {
"lineNumber": 19,
"cells": [ "" ]
}
],
"instruction": "instruction",
"tags": [ "@examples" ]
}
]
}
]
}
]
}
}
new Cucumon({clubBgSteps: false});
You can set clubBgSteps: true
to club background steps with scenario steps.
Check sample parsed response for better idea;
Feature: Matrix Outliner
Scenario Template: Matrix example
Given an example
And I can Multiply <a> with <b>
#> matrix: row 1
Examples:
| a |
| 3 |
#> matrix: row 2
Examples:
| b |
| 4 |
Note that #>
is a special statment considered as instruction statement. You'll get it's value as outline.examples[0].instruction
.
const cucumon = new Cucumon({clubBgSteps: false});
cucumon.registerOutlineExpander((outline) => {});
FAQs
Cucumber Gherkin Feature file parser with custom additional features
The npm package cucumon receives a total of 459 weekly downloads. As such, cucumon popularity was classified as not popular.
We found that cucumon 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
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.