Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import assert from 'assert'
import { Given, defineParameterType } from 'fake-cucumber'
class Flight {
constructor(public readonly from: string, public readonly to: string) {}
}
defineParameterType({
name: 'flight',
regexp: /([A-Z]{3})-([A-Z]{3})/,
transformer(from: string, to: string) {
return new Flight(from, to)
},
})
Given('{flight} has been delayed {int} minutes', function(
flight: Flight,
delay: number
) {
assert.equal(flight.from, 'LHR')
assert.equal(flight.to, 'CDG')
})
import { Given, Then, When } from 'fake-cucumber'
Given('a passed {word}', (word: string) => undefined)
Given('a passed {word} with', (word: string, arg: any) => undefined)
Given('a passed {word} with text attachment {string}', function(word: string, attachmentText: string) {
this.attach(attachmentText, 'text/plain')
})
When('a failed {word}', () => {
throw new Error('Some error')
})
When('a failed {word} with', () => {
throw new Error('Some error')
})
Then('a skipped {word}', (word: string) => {
import { Given, Then, When } from 'fake-cucumber'
Given('a passed {word}', (word: string) => undefined)
Given('a passed {word} with', (word: string, arg: any) => undefined)
Given('a passed {word} with text attachment {string}', function(word: string, attachmentText: string) {
this.attach(attachmentText, 'text/plain')
})
When('a failed {word}', () => {
throw new Error('Some error')
})
When('a failed {word} with', () => {
throw new Error('Some error')
})
Then('a skipped {word}', (word: string) => {
throw new Error('Should never be called')
})
import { Given, Then, When } from 'fake-cucumber'
Given('a passed {word}', (word: string) => undefined)
Given('a passed {word} with', (word: string, arg: any) => undefined)
Given('a passed {word} with text attachment {string}', function(word: string, attachmentText: string) {
this.attach(attachmentText, 'text/plain')
})
When('a failed {word}', () => {
throw new Error('Some error')
})
When('a failed {word} with', () => {
throw new Error('Some error')
})
Then('a skipped {word}', (word: string) => {
throw new Error('Should never be called')
})
import { When } from 'fake-cucumber'
When('the string {word} is attached as {word}', function(
text: string,
contentType: string
) {
this.attach(text, contentType)
})
import { Given, Then, When } from 'fake-cucumber'
Given('a passed {word}', (word: string) => undefined)
Given('a passed {word} with', (word: string, arg: any) => undefined)
Given('a passed {word} with text attachment {string}', function(word: string, attachmentText: string) {
this.attach(attachmentText, 'text/plain')
})
When('a failed {word}', () => {
throw new Error('Some error')
})
When('a failed {word} with', () => {
throw new Error('Some error')
})
Then('a skipped {word}', (word: string) => {
throw new Error('Should never be called')
})
import { Given, Then, When } from 'fake-cucumber'
Given('a passed {word}', (word: string) => undefined)
Given('a passed {word} with', (word: string, arg: any) => undefined)
Given('a passed {word} with text attachment {string}', function(word: string, attachmentText: string) {
this.attach(attachmentText, 'text/plain')
})
When('a failed {word}', () => {
throw new Error('Some error')
})
When('a failed {word} with', () => {
throw new Error('Some error')
})
Then('a skipped {word}', (word: string) => {
throw new Error('Should never be called')
})
import { After, Before } from 'fake-cucumber'
Before('@before-passed', function() {
})
After('@after-failed', function() {
throw new Error('Something went wrong')
})
import { After, Before } from 'fake-cucumber'
Before('@before-passed', function() {
})
After('@after-failed', function() {
throw new Error('Something went wrong')
})
Given('a passed {word} with', (word: string, arg: any) => undefined)
Given('a passed {word} with text attachment {string}', function(word: string, attachmentText: string) {
this.attach(attachmentText, 'text/plain')
})
When('a failed {word}', () => {
throw new Error('Some error')
})
When('a failed {word} with', () => {
throw new Error('Some error')
})
Then('a skipped {word}', (word: string) => {
throw new Error('Should never be called')
})