
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
cucumber-generator
Advanced tools
Simple generator for cucumber features. It's still under development and currently can transform only simple features to following templates:
but basicaly there can be any yours template given as parameter.
Of course you can use jest-cucumber
templates but if you're using other library
or you have many feature files and you don't want to copy-paste the code from console
then this tool is made for you. :)
Generator will lookup for all features in given directory and generate .spec.ts
files accordingly.
Do I need to state the obvious? :smile:
yarn add -D cucumber-generator
or
npm install -D cucumber-generator
Usage: npx cucumber-generator [parameters]
Options:
--version Show version number [boolean]
-h, --help Show help [boolean]
--includeDirectory If present, the file is generated into the directory
with same name as feature name (within output
folder) [boolean] [default: false]
--output [required] [choices: "stdio", "file"]
-f, --featuresDirectory [string] [required]
--templatesDirectory [string]
--template [string] [default: "jest-cucumber"]
--relativePathToFeatures [string] [default: "./"]
--maintainStructure [boolean] [default: true]
--verbose [boolean] [default: false]
Consider this feature file
Feature: Car
This feature describes how a car works
Scenario: Unlock car
Given keys
Given locked car
When person presses an unlock button
And tries to open the door
Then the door should open
Scenario: Start engine
Given unlocked car
When person inserts key into ignition
And turns the key
Then car should start
after running npx cucumber-generator
(with additional parameters described before) the
result will be
import { defineFeature, loadFeature } from 'jest-cucumber';
const feature = loadFeature('../src/fixtures/Simple.feature');
defineFeature(feature, test => {
test('Unlock car', ({ given, when, and, then }) => {
given('keys', () => {
});
given('locked car', () => {
});
when('person presses an unlock button', () => {
});
and('tries to open the door', () => {
});
then('the door should open', () => {
});
});
test('Start engine', ({ given, when, and, then }) => {
given('unlocked car', () => {
});
when('person inserts key into ignition', () => {
});
and('turns the key', () => {
});
then('car should start', () => {
});
});
});
There is TemplateGenerator
class available with following constructor params:
template: string
- mandatory parameter, defines a template to generate (currently just jest-cucumber
)options
:
featuresDirectory: string
- defines root for searching featuresoutputDirectory: string
- defines where the files will be generatedmaintainStructure: string | undefined
- whether copy directory tree when generating spec files (default: true
). If set to false
, spec files will be generated all in single directory.variables: Record<string, any>
- variables passed to template file when generating
relativePathToFeatures: string
- mandatory variable, defines where are feature files stored relatively to spec files (needed due to loadFeature
function in jest-cucumber
)import {TemplateGenerator} from 'cucumber-generator';
const outputDirectory = './out';
const featuresDirectory = './src/test/features';
const relativePathToFeatures = '../src/test/features';
const generator = new TemplateGenerator('jest-cucumber', {
outputDirectory,
featuresDirectory,
variables: {
relativePathToFeatures,
},
});
const result = await generator.generate();
Any help with the package is always welcome, just be sure to write and run the tests.
FAQs
Generate step definitions for cucumber scenarios
The npm package cucumber-generator receives a total of 152 weekly downloads. As such, cucumber-generator popularity was classified as not popular.
We found that cucumber-generator 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.