Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ plugins:
rules:
prettier/prettier:
- error
- trailingComma: none
- trailingComma: es5
singleQuote: true
semi: false
6 changes: 3 additions & 3 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function runFeature() {
eventBroadcaster,
pickleFilter: new Cucumber.PickleFilter({}),
source: featureSource,
uri: '/feature'
uri: '/feature',
})

Cucumber.supportCodeLibraryBuilder.reset('')
Expand All @@ -33,15 +33,15 @@ function runFeature() {
log(data) {
appendToOutput(ansiHTML(data))
},
supportCodeLibrary
supportCodeLibrary,
}
Cucumber.FormatterBuilder.build('progress', formatterOptions)

const runtime = new Cucumber.Runtime({
eventBroadcaster,
options: {},
testCases,
supportCodeLibrary
supportCodeLibrary,
})
return runtime.start()
}
Expand Down
26 changes: 13 additions & 13 deletions features/step_definitions/json_output_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
getScenarioNames,
getSteps,
findScenario,
findStep
findStep,
} from '../support/json_output_helpers'

Then(/^it runs (\d+) scenarios$/, function(count) {
Expand All @@ -33,7 +33,7 @@ Then(/^it runs the scenarios:$/, function(table) {
Then(/^the scenario "([^"]*)" has the steps$/, function(name, table) {
const scenario = findScenario({
features: this.lastRun.jsonOutput,
scenarioPredicate: ['name', name]
scenarioPredicate: ['name', name],
})
const expectedNames = table.rows().map(row => row[0])
const actualNames = scenario.steps.map(step =>
Expand All @@ -45,7 +45,7 @@ Then(/^the scenario "([^"]*)" has the steps$/, function(name, table) {
Then(/^the step "([^"]*)" failed with:$/, function(name, errorMessage) {
const step = findStep({
features: this.lastRun.jsonOutput,
stepPredicate: ['name', name]
stepPredicate: ['name', name],
})
expect(step.result.status).to.eql('failed')
expect(step.result.error_message).to.include(errorMessage)
Expand All @@ -64,41 +64,41 @@ Then(/^all steps have status "([^"]*)"$/, function(status) {
Then(/^the step "([^"]*)" has status "([^"]*)"$/, function(name, status) {
const step = findStep({
features: this.lastRun.jsonOutput,
stepPredicate: ['name', name]
stepPredicate: ['name', name],
})
expect(step.result.status).to.eql(status)
})

Then(/^the "([^"]*)" hook has status "([^"]*)"$/, function(keyword, status) {
const step = findStep({
features: this.lastRun.jsonOutput,
stepPredicate: ['keyword', keyword]
stepPredicate: ['keyword', keyword],
})
expect(step.result.status).to.eql(status)
})

Then('the step {string} has the attachment', function(name, table) {
const step = findStep({
features: this.lastRun.jsonOutput,
stepPredicate: ['name', name]
stepPredicate: ['name', name],
})
const tableRowData = table.hashes()[0]
const expectedAttachment = {
data: tableRowData.DATA,
mime_type: tableRowData['MIME TYPE']
mime_type: tableRowData['MIME TYPE'],
}
expect(step.embeddings[0]).to.eql(expectedAttachment)
})

Then('the {string} hook has the attachment', function(keyword, table) {
const hook = findStep({
features: this.lastRun.jsonOutput,
stepPredicate: ['keyword', keyword]
stepPredicate: ['keyword', keyword],
})
const tableRowData = table.hashes()[0]
const expectedAttachment = {
data: tableRowData.DATA,
mime_type: tableRowData['MIME TYPE']
mime_type: tableRowData['MIME TYPE'],
}
expect(hook.embeddings[0]).to.eql(expectedAttachment)
})
Expand All @@ -107,7 +107,7 @@ Then(/^the (first|second) scenario has the steps$/, function(cardinal, table) {
const scenarioIndex = cardinal === 'first' ? 0 : 1
const scenario = findScenario({
features: this.lastRun.jsonOutput,
scenarioPredicate: (element, index) => index === scenarioIndex
scenarioPredicate: (element, index) => index === scenarioIndex,
})
const stepNames = scenario.steps.map(step => [step.name])
expect(stepNames).to.eql(table.rows())
Expand All @@ -122,7 +122,7 @@ Then(
scenarioPredicate(element, index) {
return index === scenarioIndex
},
stepPredicate: ['name', name]
stepPredicate: ['name', name],
})
expect(step.arguments[0].content).to.eql(docString)
}
Expand All @@ -137,7 +137,7 @@ Then(
scenarioPredicate(element, index) {
return index === scenarioIndex
},
stepPredicate: ['name', name]
stepPredicate: ['name', name],
})
const expected = table.raw().map(row => ({ cells: row }))
expect(step.arguments[0].rows).to.eql(expected)
Expand All @@ -153,7 +153,7 @@ Then(/^the (first|second) scenario has the name "([^"]*)"$/, function(
features: this.lastRun.jsonOutput,
scenarioPredicate(element, index) {
return index === scenarioIndex
}
},
})
expect(scenario.name).to.eql(name)
})
2 changes: 1 addition & 1 deletion features/support/json_output_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function findStep({ features, stepPredicate, scenarioPredicate }) {
}
throw new Error(
`Could not find step matching predicate: ${util.inspect(features, {
depth: null
depth: null,
})}`
)
}
Expand Down
4 changes: 2 additions & 2 deletions features/support/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class World {
const cli = new Cli({
argv: args,
cwd,
stdout
stdout,
})
let error, stderr
try {
Expand Down Expand Up @@ -67,7 +67,7 @@ class World {
error: result.error,
errorOutput: result.stderr,
jsonOutput,
output: colors.strip(result.stdout)
output: colors.strip(result.stdout),
}
this.verifiedLastRunError = false
expect(this.lastRun.output).to.not.include('Unhandled rejection')
Expand Down
2 changes: 1 addition & 1 deletion src/cli/argv_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class ArgvParser {

return {
options: program.opts(),
args: program.args
args: program.args,
}
}
}
8 changes: 4 additions & 4 deletions src/cli/configuration_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ export default class ConfigurationBuilder {
pickleFilterOptions: {
featurePaths: unexpandedFeaturePaths,
names: this.options.name,
tagExpression: this.options.tags
tagExpression: this.options.tags,
},
runtimeOptions: {
dryRun: !!this.options.dryRun,
failFast: !!this.options.failFast,
filterStacktraces: !this.options.backtrace,
strict: !!this.options.strict,
worldParameters: this.options.worldParameters
worldParameters: this.options.worldParameters,
},
shouldExitImmediately: !!this.options.exit,
supportCodePaths,
supportCodeRequiredModules: this.options.requireModule
supportCodeRequiredModules: this.options.requireModule,
}
}

Expand All @@ -72,7 +72,7 @@ export default class ConfigurationBuilder {
async unexpandedPath => {
const matches = await globP(unexpandedPath, {
absolute: true,
cwd: this.cwd
cwd: this.cwd,
})
return Promise.map(matches, async match => {
if (path.extname(match) === '') {
Expand Down
27 changes: 15 additions & 12 deletions src/cli/configuration_builder_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Configuration', () => {
this.argv = ['path/to/node', 'path/to/cucumber.js']
this.configurationOptions = {
argv: this.argv,
cwd: this.tmpDir
cwd: this.tmpDir,
}
})

Expand All @@ -30,7 +30,7 @@ describe('Configuration', () => {
featurePaths: [],
formatOptions: {
colorsEnabled: true,
cwd: this.tmpDir
cwd: this.tmpDir,
},
formats: [{ outputTo: '', type: 'progress' }],
listI18nKeywordsFor: '',
Expand All @@ -39,19 +39,19 @@ describe('Configuration', () => {
pickleFilterOptions: {
featurePaths: ['features/**/*.feature'],
names: [],
tagExpression: ''
tagExpression: '',
},
profiles: [],
runtimeOptions: {
dryRun: false,
failFast: false,
filterStacktraces: true,
strict: true,
worldParameters: {}
worldParameters: {},
},
shouldExitImmediately: false,
supportCodePaths: [],
supportCodeRequiredModules: []
supportCodeRequiredModules: [],
})
})
})
Expand All @@ -71,11 +71,11 @@ describe('Configuration', () => {
const {
featurePaths,
pickleFilterOptions,
supportCodePaths
supportCodePaths,
} = this.result
expect(featurePaths).to.eql([this.featurePath])
expect(pickleFilterOptions.featurePaths).to.eql([
this.relativeFeaturePath
this.relativeFeaturePath,
])
expect(supportCodePaths).to.eql([this.supportCodePath])
})
Expand All @@ -96,11 +96,11 @@ describe('Configuration', () => {
const {
featurePaths,
pickleFilterOptions,
supportCodePaths
supportCodePaths,
} = this.result
expect(featurePaths).to.eql([this.featurePath])
expect(pickleFilterOptions.featurePaths).to.eql([
this.relativeFeaturePath
this.relativeFeaturePath,
])
expect(supportCodePaths).to.eql([this.supportCodePath])
})
Expand All @@ -118,7 +118,7 @@ describe('Configuration', () => {

expect(formats).to.eql([
{ outputTo: '', type: 'progress' },
{ outputTo: '../formatter/output.txt', type: '../custom/formatter' }
{ outputTo: '../formatter/output.txt', type: '../custom/formatter' },
])
})

Expand All @@ -128,7 +128,7 @@ describe('Configuration', () => {

expect(formats).to.eql([
{ outputTo: '', type: 'progress' },
{ outputTo: '/formatter/output.txt', type: '/custom/formatter' }
{ outputTo: '/formatter/output.txt', type: '/custom/formatter' },
])
})

Expand All @@ -138,7 +138,10 @@ describe('Configuration', () => {

expect(formats).to.eql([
{ outputTo: '', type: 'progress' },
{ outputTo: 'D:\\formatter\\output.txt', type: 'C:\\custom\\formatter' }
{
outputTo: 'D:\\formatter\\output.txt',
type: 'C:\\custom\\formatter',
},
])
})

Expand Down
6 changes: 3 additions & 3 deletions src/cli/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function getTestCasesFromFilesystem({
eventBroadcaster,
featureDefaultLanguage,
featurePaths,
pickleFilter
pickleFilter,
}) {
let result = []
await Promise.each(featurePaths, async featurePath => {
Expand All @@ -32,7 +32,7 @@ export async function getTestCasesFromFilesystem({
language: featureDefaultLanguage,
source,
pickleFilter,
uri: path.relative(cwd, featurePath)
uri: path.relative(cwd, featurePath),
})
)
})
Expand All @@ -44,7 +44,7 @@ export async function getTestCases({
language,
pickleFilter,
source,
uri
uri,
}) {
const result = []
const events = Gherkin.generateEvents(source, uri, {}, language)
Expand Down
14 changes: 7 additions & 7 deletions src/cli/helpers_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('helpers', () => {
cwd: this.tmpDir,
eventBroadcaster: this.eventBroadcaster,
featurePaths: [featurePath],
pickleFilter: new PickleFilter({})
pickleFilter: new PickleFilter({}),
})
})

Expand All @@ -48,7 +48,7 @@ describe('helpers', () => {
expect(this.onSource).to.have.been.calledWith({
data: '',
media: { encoding: 'utf-8', type: 'text/x.cucumber.gherkin+plain' },
uri: this.relativeFeaturePath
uri: this.relativeFeaturePath,
})
})

Expand Down Expand Up @@ -80,8 +80,8 @@ describe('helpers', () => {
eventBroadcaster: this.eventBroadcaster,
featurePaths: [featurePath],
pickleFilter: new PickleFilter({
featurePaths: [`${this.relativeFeaturePath}:5`]
})
featurePaths: [`${this.relativeFeaturePath}:5`],
}),
})
})

Expand All @@ -94,7 +94,7 @@ describe('helpers', () => {
expect(this.onSource).to.have.been.calledWith({
data: 'Feature: a\nScenario: b\nGiven a step',
media: { encoding: 'utf-8', type: 'text/x.cucumber.gherkin+plain' },
uri: this.relativeFeaturePath
uri: this.relativeFeaturePath,
})
})

Expand All @@ -119,7 +119,7 @@ describe('helpers', () => {
cwd: this.tmpDir,
eventBroadcaster: this.eventBroadcaster,
featurePaths: [featurePath],
pickleFilter: new PickleFilter({})
pickleFilter: new PickleFilter({}),
})
})

Expand All @@ -134,7 +134,7 @@ describe('helpers', () => {
expect(this.onSource).to.have.been.calledWith({
data: 'Feature: a\nScenario: b\nGiven a step',
media: { encoding: 'utf-8', type: 'text/x.cucumber.gherkin+plain' },
uri: this.relativeFeaturePath
uri: this.relativeFeaturePath,
})
})

Expand Down
Loading