Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
jest-cucumber-fusion
Advanced tools
Write cucumber test as part of a jest run (including coverage)
Write 'pure' cucumber test in Jest without syntax clutter
Build on top of Jest-cucumber, Jest-Cucumber-Fusion handle the writing of the corresponding Jest test steps using an uncluttered cucumber style.
Instead of using describe
and it
blocks, you instead write a Jest test for each scenario, and then define Given
, When
, and Then
step definitions inside of your Jest tests.
Jest-Cucumber-Fusion then allows you to link these Cucumber tests to your javascript Cucumber feature steps.
Adding a Fusion
call, the links between your Feature definition and your Steps definition is handled automatically and the necessary scaffolding for jest-cucumber is build behind the scene.
Now use jest naturally in your project like you would use the native Cucumber library.
Jest-cucumber is an amazing project but forces you to write a lot of repetitive scaffolding code to setup the link betwen Jest and Cucumber. With Jest-Cucumber-Fusion, it really takes only the minimal code possible:
Fusion
function to link the twonpm install jest-cucumber-fusion --save-dev
###filename: rocket-launching.feature
Feature: Rocket Launching
Scenario: Launching a SpaceX rocket
Given I am Elon Musk attempting to launch a rocket into space
When I launch the rocket
Then the rocket should end up in space
And the booster(s) should land back on the launch pad
And nobody should doubt me ever again
"jest": { "testMatch": [ "**/*.steps.js" ] }
//filename: rocket-launching.steps.js
const { Given, When, Then, And, But, Fusion } = require( 'jest-cucumber-fusion' )
//filename: rocket-launching.steps.js
const { Given, When, Then, And, But, Fusion } = require( 'jest-cucumber-fusion' )
const { Rocket } = require( '../../src/rocket' )
let rocket
//filename: rocket-launching.steps.js
const { Given, When, Then, And, But, Fusion } = require( 'jest-cucumber-fusion' )
const { Rocket } = require( '../../src/rocket' )
let rocket
Given( 'I am Elon Musk attempting to launch a rocket into space', () => {
rocket = new Rocket()
} )
When( 'I launch the rocket', () => {
rocket.launch()
} )
Then( 'the rocket should end up in space', () => {
expect(rocket.isInSpace).toBe(true)
} )
And( /^the booster\(s\) should land back on the launch pad$/, () => {
expect(rocket.boostersLanded).toBe(true)
} )
But( 'nobody should doubt me ever again', () => {
expect('people').not.toBe('haters')
} )
You have to match it with your Cucumber Feature definition file:
//filename: rocket-launching.steps.js
const { Given, When, Then, And, But, Fusion } = require( 'jest-cucumber-fusion' )
const { Rocket } = require( '../../src/rocket' )
let rocket
Given( 'I am Elon Musk attempting to launch a rocket into space', () => {
rocket = new Rocket()
} )
When( 'I launch the rocket', () => {
rocket.launch()
} )
Then( 'the rocket should end up in space', () => {
expect(rocket.isInSpace).toBe(true)
} )
And( /^the booster\(s\) should land back on the launch pad$/, () => {
expect(rocket.boostersLanded).toBe(true)
} )
But( 'nobody should doubt me ever again', () => {
expect('people').not.toBe('haters')
} )
Fusion( 'rocket-launching.feature' )
Since we're using jest, it is very easy to generate the code coverage of your Cucumber test:
"jest": {
"testMatch": [
"**/*.steps.js"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"/test/"
],
"coverageDirectory": "./coverage/",
"collectCoverage": true
}
FAQs
Write cucumber test as part of a jest run (including coverage)
The npm package jest-cucumber-fusion receives a total of 803 weekly downloads. As such, jest-cucumber-fusion popularity was classified as not popular.
We found that jest-cucumber-fusion 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.