Skip to content

Commit 1927e5d

Browse files
prettier: use trailing comma (#1024)
1 parent b3b2d51 commit 1927e5d

File tree

76 files changed

+595
-592
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+595
-592
lines changed

.eslintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ plugins:
1414
rules:
1515
prettier/prettier:
1616
- error
17-
- trailingComma: none
17+
- trailingComma: es5
1818
singleQuote: true
1919
semi: false

example/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function runFeature() {
1818
eventBroadcaster,
1919
pickleFilter: new Cucumber.PickleFilter({}),
2020
source: featureSource,
21-
uri: '/feature'
21+
uri: '/feature',
2222
})
2323

2424
Cucumber.supportCodeLibraryBuilder.reset('')
@@ -33,15 +33,15 @@ function runFeature() {
3333
log(data) {
3434
appendToOutput(ansiHTML(data))
3535
},
36-
supportCodeLibrary
36+
supportCodeLibrary,
3737
}
3838
Cucumber.FormatterBuilder.build('progress', formatterOptions)
3939

4040
const runtime = new Cucumber.Runtime({
4141
eventBroadcaster,
4242
options: {},
4343
testCases,
44-
supportCodeLibrary
44+
supportCodeLibrary,
4545
})
4646
return runtime.start()
4747
}

features/step_definitions/json_output_steps.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
getScenarioNames,
88
getSteps,
99
findScenario,
10-
findStep
10+
findStep,
1111
} from '../support/json_output_helpers'
1212

1313
Then(/^it runs (\d+) scenarios$/, function(count) {
@@ -33,7 +33,7 @@ Then(/^it runs the scenarios:$/, function(table) {
3333
Then(/^the scenario "([^"]*)" has the steps$/, function(name, table) {
3434
const scenario = findScenario({
3535
features: this.lastRun.jsonOutput,
36-
scenarioPredicate: ['name', name]
36+
scenarioPredicate: ['name', name],
3737
})
3838
const expectedNames = table.rows().map(row => row[0])
3939
const actualNames = scenario.steps.map(step =>
@@ -45,7 +45,7 @@ Then(/^the scenario "([^"]*)" has the steps$/, function(name, table) {
4545
Then(/^the step "([^"]*)" failed with:$/, function(name, errorMessage) {
4646
const step = findStep({
4747
features: this.lastRun.jsonOutput,
48-
stepPredicate: ['name', name]
48+
stepPredicate: ['name', name],
4949
})
5050
expect(step.result.status).to.eql('failed')
5151
expect(step.result.error_message).to.include(errorMessage)
@@ -64,41 +64,41 @@ Then(/^all steps have status "([^"]*)"$/, function(status) {
6464
Then(/^the step "([^"]*)" has status "([^"]*)"$/, function(name, status) {
6565
const step = findStep({
6666
features: this.lastRun.jsonOutput,
67-
stepPredicate: ['name', name]
67+
stepPredicate: ['name', name],
6868
})
6969
expect(step.result.status).to.eql(status)
7070
})
7171

7272
Then(/^the "([^"]*)" hook has status "([^"]*)"$/, function(keyword, status) {
7373
const step = findStep({
7474
features: this.lastRun.jsonOutput,
75-
stepPredicate: ['keyword', keyword]
75+
stepPredicate: ['keyword', keyword],
7676
})
7777
expect(step.result.status).to.eql(status)
7878
})
7979

8080
Then('the step {string} has the attachment', function(name, table) {
8181
const step = findStep({
8282
features: this.lastRun.jsonOutput,
83-
stepPredicate: ['name', name]
83+
stepPredicate: ['name', name],
8484
})
8585
const tableRowData = table.hashes()[0]
8686
const expectedAttachment = {
8787
data: tableRowData.DATA,
88-
mime_type: tableRowData['MIME TYPE']
88+
mime_type: tableRowData['MIME TYPE'],
8989
}
9090
expect(step.embeddings[0]).to.eql(expectedAttachment)
9191
})
9292

9393
Then('the {string} hook has the attachment', function(keyword, table) {
9494
const hook = findStep({
9595
features: this.lastRun.jsonOutput,
96-
stepPredicate: ['keyword', keyword]
96+
stepPredicate: ['keyword', keyword],
9797
})
9898
const tableRowData = table.hashes()[0]
9999
const expectedAttachment = {
100100
data: tableRowData.DATA,
101-
mime_type: tableRowData['MIME TYPE']
101+
mime_type: tableRowData['MIME TYPE'],
102102
}
103103
expect(hook.embeddings[0]).to.eql(expectedAttachment)
104104
})
@@ -107,7 +107,7 @@ Then(/^the (first|second) scenario has the steps$/, function(cardinal, table) {
107107
const scenarioIndex = cardinal === 'first' ? 0 : 1
108108
const scenario = findScenario({
109109
features: this.lastRun.jsonOutput,
110-
scenarioPredicate: (element, index) => index === scenarioIndex
110+
scenarioPredicate: (element, index) => index === scenarioIndex,
111111
})
112112
const stepNames = scenario.steps.map(step => [step.name])
113113
expect(stepNames).to.eql(table.rows())
@@ -122,7 +122,7 @@ Then(
122122
scenarioPredicate(element, index) {
123123
return index === scenarioIndex
124124
},
125-
stepPredicate: ['name', name]
125+
stepPredicate: ['name', name],
126126
})
127127
expect(step.arguments[0].content).to.eql(docString)
128128
}
@@ -137,7 +137,7 @@ Then(
137137
scenarioPredicate(element, index) {
138138
return index === scenarioIndex
139139
},
140-
stepPredicate: ['name', name]
140+
stepPredicate: ['name', name],
141141
})
142142
const expected = table.raw().map(row => ({ cells: row }))
143143
expect(step.arguments[0].rows).to.eql(expected)
@@ -153,7 +153,7 @@ Then(/^the (first|second) scenario has the name "([^"]*)"$/, function(
153153
features: this.lastRun.jsonOutput,
154154
scenarioPredicate(element, index) {
155155
return index === scenarioIndex
156-
}
156+
},
157157
})
158158
expect(scenario.name).to.eql(name)
159159
})

features/support/json_output_helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function findStep({ features, stepPredicate, scenarioPredicate }) {
4848
}
4949
throw new Error(
5050
`Could not find step matching predicate: ${util.inspect(features, {
51-
depth: null
51+
depth: null,
5252
})}`
5353
)
5454
}

features/support/world.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class World {
3434
const cli = new Cli({
3535
argv: args,
3636
cwd,
37-
stdout
37+
stdout,
3838
})
3939
let error, stderr
4040
try {
@@ -67,7 +67,7 @@ class World {
6767
error: result.error,
6868
errorOutput: result.stderr,
6969
jsonOutput,
70-
output: colors.strip(result.stdout)
70+
output: colors.strip(result.stdout),
7171
}
7272
this.verifiedLastRunError = false
7373
expect(this.lastRun.output).to.not.include('Unhandled rejection')

src/cli/argv_parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export default class ArgvParser {
131131

132132
return {
133133
options: program.opts(),
134-
args: program.args
134+
args: program.args,
135135
}
136136
}
137137
}

src/cli/configuration_builder.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ export default class ConfigurationBuilder {
5151
pickleFilterOptions: {
5252
featurePaths: unexpandedFeaturePaths,
5353
names: this.options.name,
54-
tagExpression: this.options.tags
54+
tagExpression: this.options.tags,
5555
},
5656
runtimeOptions: {
5757
dryRun: !!this.options.dryRun,
5858
failFast: !!this.options.failFast,
5959
filterStacktraces: !this.options.backtrace,
6060
strict: !!this.options.strict,
61-
worldParameters: this.options.worldParameters
61+
worldParameters: this.options.worldParameters,
6262
},
6363
shouldExitImmediately: !!this.options.exit,
6464
supportCodePaths,
65-
supportCodeRequiredModules: this.options.requireModule
65+
supportCodeRequiredModules: this.options.requireModule,
6666
}
6767
}
6868

@@ -72,7 +72,7 @@ export default class ConfigurationBuilder {
7272
async unexpandedPath => {
7373
const matches = await globP(unexpandedPath, {
7474
absolute: true,
75-
cwd: this.cwd
75+
cwd: this.cwd,
7676
})
7777
return Promise.map(matches, async match => {
7878
if (path.extname(match) === '') {

src/cli/configuration_builder_spec.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Configuration', () => {
1515
this.argv = ['path/to/node', 'path/to/cucumber.js']
1616
this.configurationOptions = {
1717
argv: this.argv,
18-
cwd: this.tmpDir
18+
cwd: this.tmpDir,
1919
}
2020
})
2121

@@ -30,7 +30,7 @@ describe('Configuration', () => {
3030
featurePaths: [],
3131
formatOptions: {
3232
colorsEnabled: true,
33-
cwd: this.tmpDir
33+
cwd: this.tmpDir,
3434
},
3535
formats: [{ outputTo: '', type: 'progress' }],
3636
listI18nKeywordsFor: '',
@@ -39,19 +39,19 @@ describe('Configuration', () => {
3939
pickleFilterOptions: {
4040
featurePaths: ['features/**/*.feature'],
4141
names: [],
42-
tagExpression: ''
42+
tagExpression: '',
4343
},
4444
profiles: [],
4545
runtimeOptions: {
4646
dryRun: false,
4747
failFast: false,
4848
filterStacktraces: true,
4949
strict: true,
50-
worldParameters: {}
50+
worldParameters: {},
5151
},
5252
shouldExitImmediately: false,
5353
supportCodePaths: [],
54-
supportCodeRequiredModules: []
54+
supportCodeRequiredModules: [],
5555
})
5656
})
5757
})
@@ -71,11 +71,11 @@ describe('Configuration', () => {
7171
const {
7272
featurePaths,
7373
pickleFilterOptions,
74-
supportCodePaths
74+
supportCodePaths,
7575
} = this.result
7676
expect(featurePaths).to.eql([this.featurePath])
7777
expect(pickleFilterOptions.featurePaths).to.eql([
78-
this.relativeFeaturePath
78+
this.relativeFeaturePath,
7979
])
8080
expect(supportCodePaths).to.eql([this.supportCodePath])
8181
})
@@ -96,11 +96,11 @@ describe('Configuration', () => {
9696
const {
9797
featurePaths,
9898
pickleFilterOptions,
99-
supportCodePaths
99+
supportCodePaths,
100100
} = this.result
101101
expect(featurePaths).to.eql([this.featurePath])
102102
expect(pickleFilterOptions.featurePaths).to.eql([
103-
this.relativeFeaturePath
103+
this.relativeFeaturePath,
104104
])
105105
expect(supportCodePaths).to.eql([this.supportCodePath])
106106
})
@@ -118,7 +118,7 @@ describe('Configuration', () => {
118118

119119
expect(formats).to.eql([
120120
{ outputTo: '', type: 'progress' },
121-
{ outputTo: '../formatter/output.txt', type: '../custom/formatter' }
121+
{ outputTo: '../formatter/output.txt', type: '../custom/formatter' },
122122
])
123123
})
124124

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

129129
expect(formats).to.eql([
130130
{ outputTo: '', type: 'progress' },
131-
{ outputTo: '/formatter/output.txt', type: '/custom/formatter' }
131+
{ outputTo: '/formatter/output.txt', type: '/custom/formatter' },
132132
])
133133
})
134134

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

139139
expect(formats).to.eql([
140140
{ outputTo: '', type: 'progress' },
141-
{ outputTo: 'D:\\formatter\\output.txt', type: 'C:\\custom\\formatter' }
141+
{
142+
outputTo: 'D:\\formatter\\output.txt',
143+
type: 'C:\\custom\\formatter',
144+
},
142145
])
143146
})
144147

src/cli/helpers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function getTestCasesFromFilesystem({
2121
eventBroadcaster,
2222
featureDefaultLanguage,
2323
featurePaths,
24-
pickleFilter
24+
pickleFilter,
2525
}) {
2626
let result = []
2727
await Promise.each(featurePaths, async featurePath => {
@@ -32,7 +32,7 @@ export async function getTestCasesFromFilesystem({
3232
language: featureDefaultLanguage,
3333
source,
3434
pickleFilter,
35-
uri: path.relative(cwd, featurePath)
35+
uri: path.relative(cwd, featurePath),
3636
})
3737
)
3838
})
@@ -44,7 +44,7 @@ export async function getTestCases({
4444
language,
4545
pickleFilter,
4646
source,
47-
uri
47+
uri,
4848
}) {
4949
const result = []
5050
const events = Gherkin.generateEvents(source, uri, {}, language)

src/cli/helpers_spec.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('helpers', () => {
3535
cwd: this.tmpDir,
3636
eventBroadcaster: this.eventBroadcaster,
3737
featurePaths: [featurePath],
38-
pickleFilter: new PickleFilter({})
38+
pickleFilter: new PickleFilter({}),
3939
})
4040
})
4141

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

@@ -80,8 +80,8 @@ describe('helpers', () => {
8080
eventBroadcaster: this.eventBroadcaster,
8181
featurePaths: [featurePath],
8282
pickleFilter: new PickleFilter({
83-
featurePaths: [`${this.relativeFeaturePath}:5`]
84-
})
83+
featurePaths: [`${this.relativeFeaturePath}:5`],
84+
}),
8585
})
8686
})
8787

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

@@ -119,7 +119,7 @@ describe('helpers', () => {
119119
cwd: this.tmpDir,
120120
eventBroadcaster: this.eventBroadcaster,
121121
featurePaths: [featurePath],
122-
pickleFilter: new PickleFilter({})
122+
pickleFilter: new PickleFilter({}),
123123
})
124124
})
125125

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

0 commit comments

Comments
 (0)