diff --git a/.eslintrc.yml b/.eslintrc.yml index dda553875..d005c409e 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -14,6 +14,6 @@ plugins: rules: prettier/prettier: - error - - trailingComma: none + - trailingComma: es5 singleQuote: true semi: false diff --git a/example/index.js b/example/index.js index 57effff16..0ecff37c6 100644 --- a/example/index.js +++ b/example/index.js @@ -18,7 +18,7 @@ function runFeature() { eventBroadcaster, pickleFilter: new Cucumber.PickleFilter({}), source: featureSource, - uri: '/feature' + uri: '/feature', }) Cucumber.supportCodeLibraryBuilder.reset('') @@ -33,7 +33,7 @@ function runFeature() { log(data) { appendToOutput(ansiHTML(data)) }, - supportCodeLibrary + supportCodeLibrary, } Cucumber.FormatterBuilder.build('progress', formatterOptions) @@ -41,7 +41,7 @@ function runFeature() { eventBroadcaster, options: {}, testCases, - supportCodeLibrary + supportCodeLibrary, }) return runtime.start() } diff --git a/features/step_definitions/json_output_steps.js b/features/step_definitions/json_output_steps.js index 2cfa56c35..12952679c 100644 --- a/features/step_definitions/json_output_steps.js +++ b/features/step_definitions/json_output_steps.js @@ -7,7 +7,7 @@ import { getScenarioNames, getSteps, findScenario, - findStep + findStep, } from '../support/json_output_helpers' Then(/^it runs (\d+) scenarios$/, function(count) { @@ -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 => @@ -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) @@ -64,7 +64,7 @@ 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) }) @@ -72,7 +72,7 @@ Then(/^the step "([^"]*)" has status "([^"]*)"$/, function(name, 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) }) @@ -80,12 +80,12 @@ Then(/^the "([^"]*)" hook has status "([^"]*)"$/, function(keyword, 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) }) @@ -93,12 +93,12 @@ Then('the step {string} has the attachment', function(name, table) { 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) }) @@ -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()) @@ -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) } @@ -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) @@ -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) }) diff --git a/features/support/json_output_helpers.js b/features/support/json_output_helpers.js index b093e4b37..0407b9252 100644 --- a/features/support/json_output_helpers.js +++ b/features/support/json_output_helpers.js @@ -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, })}` ) } diff --git a/features/support/world.js b/features/support/world.js index 86798a28a..11cfd5b2b 100644 --- a/features/support/world.js +++ b/features/support/world.js @@ -34,7 +34,7 @@ class World { const cli = new Cli({ argv: args, cwd, - stdout + stdout, }) let error, stderr try { @@ -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') diff --git a/src/cli/argv_parser.js b/src/cli/argv_parser.js index b900c6785..0fe87b412 100644 --- a/src/cli/argv_parser.js +++ b/src/cli/argv_parser.js @@ -131,7 +131,7 @@ export default class ArgvParser { return { options: program.opts(), - args: program.args + args: program.args, } } } diff --git a/src/cli/configuration_builder.js b/src/cli/configuration_builder.js index d865436ae..5ee940e07 100644 --- a/src/cli/configuration_builder.js +++ b/src/cli/configuration_builder.js @@ -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, } } @@ -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) === '') { diff --git a/src/cli/configuration_builder_spec.js b/src/cli/configuration_builder_spec.js index 5e4066bdf..87d3ed426 100644 --- a/src/cli/configuration_builder_spec.js +++ b/src/cli/configuration_builder_spec.js @@ -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, } }) @@ -30,7 +30,7 @@ describe('Configuration', () => { featurePaths: [], formatOptions: { colorsEnabled: true, - cwd: this.tmpDir + cwd: this.tmpDir, }, formats: [{ outputTo: '', type: 'progress' }], listI18nKeywordsFor: '', @@ -39,7 +39,7 @@ describe('Configuration', () => { pickleFilterOptions: { featurePaths: ['features/**/*.feature'], names: [], - tagExpression: '' + tagExpression: '', }, profiles: [], runtimeOptions: { @@ -47,11 +47,11 @@ describe('Configuration', () => { failFast: false, filterStacktraces: true, strict: true, - worldParameters: {} + worldParameters: {}, }, shouldExitImmediately: false, supportCodePaths: [], - supportCodeRequiredModules: [] + supportCodeRequiredModules: [], }) }) }) @@ -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]) }) @@ -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]) }) @@ -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' }, ]) }) @@ -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' }, ]) }) @@ -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', + }, ]) }) diff --git a/src/cli/helpers.js b/src/cli/helpers.js index eaf2fec1a..316194c56 100644 --- a/src/cli/helpers.js +++ b/src/cli/helpers.js @@ -21,7 +21,7 @@ export async function getTestCasesFromFilesystem({ eventBroadcaster, featureDefaultLanguage, featurePaths, - pickleFilter + pickleFilter, }) { let result = [] await Promise.each(featurePaths, async featurePath => { @@ -32,7 +32,7 @@ export async function getTestCasesFromFilesystem({ language: featureDefaultLanguage, source, pickleFilter, - uri: path.relative(cwd, featurePath) + uri: path.relative(cwd, featurePath), }) ) }) @@ -44,7 +44,7 @@ export async function getTestCases({ language, pickleFilter, source, - uri + uri, }) { const result = [] const events = Gherkin.generateEvents(source, uri, {}, language) diff --git a/src/cli/helpers_spec.js b/src/cli/helpers_spec.js index 9e5569d24..0d66aa2f7 100644 --- a/src/cli/helpers_spec.js +++ b/src/cli/helpers_spec.js @@ -35,7 +35,7 @@ describe('helpers', () => { cwd: this.tmpDir, eventBroadcaster: this.eventBroadcaster, featurePaths: [featurePath], - pickleFilter: new PickleFilter({}) + pickleFilter: new PickleFilter({}), }) }) @@ -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, }) }) @@ -80,8 +80,8 @@ describe('helpers', () => { eventBroadcaster: this.eventBroadcaster, featurePaths: [featurePath], pickleFilter: new PickleFilter({ - featurePaths: [`${this.relativeFeaturePath}:5`] - }) + featurePaths: [`${this.relativeFeaturePath}:5`], + }), }) }) @@ -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, }) }) @@ -119,7 +119,7 @@ describe('helpers', () => { cwd: this.tmpDir, eventBroadcaster: this.eventBroadcaster, featurePaths: [featurePath], - pickleFilter: new PickleFilter({}) + pickleFilter: new PickleFilter({}), }) }) @@ -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, }) }) diff --git a/src/cli/i18n.js b/src/cli/i18n.js index db96aad20..451ee1b81 100644 --- a/src/cli/i18n.js +++ b/src/cli/i18n.js @@ -13,7 +13,7 @@ const keywords = [ 'when', 'then', 'and', - 'but' + 'but', ] function getAsTable(header, rows) { @@ -33,13 +33,13 @@ function getAsTable(header, rows) { top: '', 'top-left': '', 'top-mid': '', - 'top-right': '' + 'top-right': '', }, style: { border: [], 'padding-left': 0, - 'padding-right': 0 - } + 'padding-right': 0, + }, }) table.push(header) table.push(...rows) @@ -50,7 +50,7 @@ export function getLanguages() { const rows = _.map(Gherkin.DIALECTS, (data, isoCode) => [ isoCode, data.name, - data.native + data.native, ]) return getAsTable(['ISO 639-1', 'ENGLISH NAME', 'NATIVE NAME'], rows) } diff --git a/src/cli/index.js b/src/cli/index.js index 2886f131b..189554c9f 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -29,7 +29,7 @@ export default class Cli { eventBroadcaster, formatOptions, formats, - supportCodeLibrary + supportCodeLibrary, }) { const streamsToClose = [] const eventDataCollector = new EventDataCollector(eventBroadcaster) @@ -46,7 +46,7 @@ export default class Cli { log: ::stream.write, stream, supportCodeLibrary, - ...formatOptions + ...formatOptions, } return FormatterBuilder.build(type, typeOptions) }) @@ -81,14 +81,14 @@ export default class Cli { eventBroadcaster, formatOptions: configuration.formatOptions, formats: configuration.formats, - supportCodeLibrary + supportCodeLibrary, }) const testCases = await getTestCasesFromFilesystem({ cwd: this.cwd, eventBroadcaster, featureDefaultLanguage: configuration.featureDefaultLanguage, featurePaths: configuration.featurePaths, - pickleFilter: new PickleFilter(configuration.pickleFilterOptions) + pickleFilter: new PickleFilter(configuration.pickleFilterOptions), }) let success if (configuration.parallel) { @@ -97,7 +97,7 @@ export default class Cli { options: configuration.runtimeOptions, supportCodePaths: configuration.supportCodePaths, supportCodeRequiredModules: configuration.supportCodeRequiredModules, - testCases + testCases, }) await new Promise(resolve => { parallelRuntimeMaster.run(configuration.parallel, s => { @@ -110,14 +110,14 @@ export default class Cli { eventBroadcaster, options: configuration.runtimeOptions, supportCodeLibrary, - testCases + testCases, }) success = await runtime.start() } await cleanup() return { shouldExitImmediately: configuration.shouldExitImmediately, - success + success, } } } diff --git a/src/cli/install_validator.js b/src/cli/install_validator.js index 1387ce86e..afcd52119 100644 --- a/src/cli/install_validator.js +++ b/src/cli/install_validator.js @@ -10,7 +10,7 @@ export async function validateInstall(cwd) { } const currentCucumberPath = require.resolve(projectPath) let localCucumberPath = await promisify(resolve)('cucumber', { - basedir: cwd + basedir: cwd, }) localCucumberPath = await fs.realpath(localCucumberPath) if (localCucumberPath !== currentCucumberPath) { diff --git a/src/cli/option_splitter_spec.js b/src/cli/option_splitter_spec.js index 5a0fbe6b9..dbeba7532 100644 --- a/src/cli/option_splitter_spec.js +++ b/src/cli/option_splitter_spec.js @@ -7,28 +7,28 @@ describe('OptionSplitter', () => { { description: "doesn't split when nothing to split on", input: '../custom/formatter', - output: ['../custom/formatter'] + output: ['../custom/formatter'], }, { description: 'splits relative unix paths', input: '../custom/formatter:../formatter/output.txt', - output: ['../custom/formatter', '../formatter/output.txt'] + output: ['../custom/formatter', '../formatter/output.txt'], }, { description: 'splits absolute unix paths', input: '/custom/formatter:/formatter/output.txt', - output: ['/custom/formatter', '/formatter/output.txt'] + output: ['/custom/formatter', '/formatter/output.txt'], }, { description: 'splits absolute windows paths', input: 'C:\\custom\\formatter:C:\\formatter\\output.txt', - output: ['C:\\custom\\formatter', 'C:\\formatter\\output.txt'] + output: ['C:\\custom\\formatter', 'C:\\formatter\\output.txt'], }, { description: 'does not split a single absolute windows paths', input: 'C:\\custom\\formatter', - output: ['C:\\custom\\formatter'] - } + output: ['C:\\custom\\formatter'], + }, ] examples.forEach(({ description, input, output }) => { diff --git a/src/cli/run.js b/src/cli/run.js index 37eb56757..c2b53daa3 100644 --- a/src/cli/run.js +++ b/src/cli/run.js @@ -11,7 +11,7 @@ export default async function run() { const cli = new Cli({ argv: process.argv, cwd, - stdout: process.stdout + stdout: process.stdout, }) let result diff --git a/src/formatter/builder.js b/src/formatter/builder.js index e2b041603..053345388 100644 --- a/src/formatter/builder.js +++ b/src/formatter/builder.js @@ -18,7 +18,7 @@ export default class FormatterBuilder { const extendedOptions = { colorFns: getColorFns(options.colorsEnabled), snippetBuilder: FormatterBuilder.getStepDefinitionSnippetBuilder(options), - ...options + ...options, } return new Formatter(extendedOptions) } @@ -52,7 +52,7 @@ export default class FormatterBuilder { cwd, snippetInterface, snippetSyntax, - supportCodeLibrary + supportCodeLibrary, }) { if (!snippetInterface) { snippetInterface = 'callback' @@ -64,7 +64,7 @@ export default class FormatterBuilder { } return new StepDefinitionSnippetBuilder({ snippetSyntax: new Syntax(snippetInterface), - parameterTypeRegistry: supportCodeLibrary.parameterTypeRegistry + parameterTypeRegistry: supportCodeLibrary.parameterTypeRegistry, }) } diff --git a/src/formatter/event_protocol_formatter.js b/src/formatter/event_protocol_formatter.js index 921b60f32..b66d2c671 100644 --- a/src/formatter/event_protocol_formatter.js +++ b/src/formatter/event_protocol_formatter.js @@ -16,7 +16,7 @@ const EVENT_NAMES = [ 'test-step-attachment', 'test-step-finished', 'test-case-finished', - 'test-run-finished' + 'test-run-finished', ] export default class EventProtocolFormatter extends Formatter { diff --git a/src/formatter/get_color_fns.js b/src/formatter/get_color_fns.js index 6a6291d85..77f27f064 100644 --- a/src/formatter/get_color_fns.js +++ b/src/formatter/get_color_fns.js @@ -11,7 +11,7 @@ export default function getColorFns(enabled) { [Status.SKIPPED]: 'cyan', [Status.UNDEFINED]: 'yellow', location: 'grey', - tag: 'cyan' + tag: 'cyan', }) return colors } diff --git a/src/formatter/helpers/error_helpers.js b/src/formatter/helpers/error_helpers.js index 4ab7f0130..8bcd34452 100644 --- a/src/formatter/helpers/error_helpers.js +++ b/src/formatter/helpers/error_helpers.js @@ -6,7 +6,7 @@ export function formatError(error, colorFns) { diffAdded: colorFns.red, diffRemoved: colorFns.green, errorMessage: colorFns.red, - errorStack: colorFns.gray - } + errorStack: colorFns.gray, + }, }) } diff --git a/src/formatter/helpers/event_data_collector.js b/src/formatter/helpers/event_data_collector.js index aa30f1172..8db588783 100644 --- a/src/formatter/helpers/event_data_collector.js +++ b/src/formatter/helpers/event_data_collector.js @@ -23,7 +23,7 @@ export default class EventDataCollector { return { gherkinDocument: this.gherkinDocumentMap[sourceLocation.uri], pickle: this.pickleMap[this.getTestCaseKey(sourceLocation)], - testCase: this.testCaseMap[this.getTestCaseKey(sourceLocation)] + testCase: this.testCaseMap[this.getTestCaseKey(sourceLocation)], } } diff --git a/src/formatter/helpers/issue_helpers.js b/src/formatter/helpers/issue_helpers.js index 587b46b68..8701da07a 100644 --- a/src/formatter/helpers/issue_helpers.js +++ b/src/formatter/helpers/issue_helpers.js @@ -16,7 +16,7 @@ const CHARACTERS = { [Status.PASSED]: figures.tick, [Status.PENDING]: '?', [Status.SKIPPED]: '-', - [Status.UNDEFINED]: '?' + [Status.UNDEFINED]: '?', } const IS_ISSUE = { @@ -25,7 +25,7 @@ const IS_ISSUE = { [Status.PASSED]: false, [Status.PENDING]: true, [Status.SKIPPED]: false, - [Status.UNDEFINED]: true + [Status.UNDEFINED]: true, } function formatDataTable(arg) { @@ -50,13 +50,13 @@ function formatDataTable(arg) { top: '', 'top-left': '', 'top-mid': '', - 'top-right': '' + 'top-right': '', }, style: { border: [], 'padding-left': 1, - 'padding-right': 1 - } + 'padding-right': 1, + }, }) table.push(...rows) return table.toString() @@ -73,7 +73,7 @@ function formatStep({ keywordType, pickleStep, snippetBuilder, - testStep + testStep, }) { const { status } = testStep.result const colorFn = colorFns[status] @@ -97,7 +97,7 @@ function formatStep({ let str const iterator = buildStepArgumentIterator({ dataTable: arg => (str = formatDataTable(arg)), - docString: arg => (str = formatDocString(arg)) + docString: arg => (str = formatDocString(arg)), }) _.each(pickleStep.arguments, iterator) if (str) { @@ -109,7 +109,7 @@ function formatStep({ keywordType, pickleStep, snippetBuilder, - testStep + testStep, }) if (message) { text += `${indentString(message, 4)}\n` @@ -127,7 +127,7 @@ export function formatIssue({ number, pickle, snippetBuilder, - testCase + testCase, }) { const prefix = `${number}) ` let text = prefix @@ -146,7 +146,7 @@ export function formatIssue({ keywordType = getStepKeywordType({ keyword, language: gherkinDocument.feature.language, - previousKeywordType + previousKeywordType, }) } const formattedStep = formatStep({ @@ -156,7 +156,7 @@ export function formatIssue({ keywordType, pickleStep, snippetBuilder, - testStep + testStep, }) text += indentString(formattedStep, prefix.length) previousKeywordType = keywordType diff --git a/src/formatter/helpers/issue_helpers_spec.js b/src/formatter/helpers/issue_helpers_spec.js index 62c105d09..275c0ab49 100644 --- a/src/formatter/helpers/issue_helpers_spec.js +++ b/src/formatter/helpers/issue_helpers_spec.js @@ -20,19 +20,19 @@ describe('IssueHelpers', () => { this.testCase = { sourceLocation: { uri: 'a.feature', - line: 2 + line: 2, }, steps: [ { actionLocation: { line: 2, uri: 'steps.js' }, - sourceLocation: { line: 3, uri: 'a.feature' } + sourceLocation: { line: 3, uri: 'a.feature' }, }, {}, { actionLocation: { line: 4, uri: 'steps.js' }, - sourceLocation: { line: 5, uri: 'a.feature' } - } - ] + sourceLocation: { line: 5, uri: 'a.feature' }, + }, + ], } this.options = { colorFns: getColorFns(false), @@ -40,7 +40,7 @@ describe('IssueHelpers', () => { number: 1, pickle, snippetBuilder: createMock({ build: 'snippet' }), - testCase: this.testCase + testCase: this.testCase, } this.passedStepResult = { duration: 0, status: Status.PASSED } this.skippedStepResult = { status: Status.SKIPPED } @@ -55,8 +55,8 @@ describe('IssueHelpers', () => { sourceLocation: { line: 4, uri: 'a.feature' }, result: { exception: 'error', - status: Status.FAILED - } + status: Status.FAILED, + }, } this.testCase.steps[2].result = this.skippedStepResult this.formattedIssue = formatIssue(this.options) @@ -84,8 +84,8 @@ describe('IssueHelpers', () => { 'Multiple step definitions match:\n' + ' pattern1 - steps.js:5\n' + ' longer pattern2 - steps.js:6', - status: Status.FAILED - } + status: Status.FAILED, + }, } this.testCase.steps[2].result = this.skippedStepResult this.formattedIssue = formatIssue(this.options) @@ -109,7 +109,7 @@ describe('IssueHelpers', () => { this.testCase.steps[0].result = this.passedStepResult this.testCase.steps[1] = { sourceLocation: { line: 4, uri: 'a.feature' }, - result: { status: Status.UNDEFINED } + result: { status: Status.UNDEFINED }, } this.testCase.steps[2].result = this.skippedStepResult this.formattedIssue = formatIssue(this.options) @@ -135,7 +135,7 @@ describe('IssueHelpers', () => { this.testCase.steps[1] = { actionLocation: { line: 3, uri: 'steps.js' }, sourceLocation: { line: 4, uri: 'a.feature' }, - result: { status: Status.PENDING } + result: { status: Status.PENDING }, } this.testCase.steps[2].result = this.skippedStepResult this.formattedIssue = formatIssue(this.options) @@ -171,7 +171,7 @@ describe('IssueHelpers', () => { this.testCase.steps[1] = { actionLocation: { line: 3, uri: 'steps.js' }, sourceLocation: { line: 4, uri: 'a.feature' }, - result: { status: Status.PENDING } + result: { status: Status.PENDING }, } this.testCase.steps[2].result = this.skippedStepResult this.formattedIssue = formatIssue(this.options) @@ -213,7 +213,7 @@ describe('IssueHelpers', () => { this.testCase.steps[1] = { actionLocation: { line: 3, uri: 'steps.js' }, sourceLocation: { line: 4, uri: 'a.feature' }, - result: { status: Status.PENDING } + result: { status: Status.PENDING }, } this.testCase.steps[2].result = this.skippedStepResult this.formattedIssue = formatIssue(this.options) diff --git a/src/formatter/helpers/keyword_type.js b/src/formatter/helpers/keyword_type.js index d6a379ad7..3a461ed64 100644 --- a/src/formatter/helpers/keyword_type.js +++ b/src/formatter/helpers/keyword_type.js @@ -4,7 +4,7 @@ import Gherkin from 'gherkin' const types = { EVENT: 'event', OUTCOME: 'outcome', - PRECONDITION: 'precondition' + PRECONDITION: 'precondition', } export default types diff --git a/src/formatter/helpers/keyword_type_spec.js b/src/formatter/helpers/keyword_type_spec.js index 7199972ec..30b87a552 100644 --- a/src/formatter/helpers/keyword_type_spec.js +++ b/src/formatter/helpers/keyword_type_spec.js @@ -14,7 +14,7 @@ describe('KeywordType', () => { beforeEach(function() { this.keywordType = getStepKeywordType({ keyword: 'Given ', - language: 'en' + language: 'en', }) }) @@ -27,7 +27,7 @@ describe('KeywordType', () => { beforeEach(function() { this.keywordType = getStepKeywordType({ keyword: 'When ', - language: 'en' + language: 'en', }) }) @@ -40,7 +40,7 @@ describe('KeywordType', () => { beforeEach(function() { this.keywordType = getStepKeywordType({ keyword: 'Then ', - language: 'en' + language: 'en', }) }) @@ -53,7 +53,7 @@ describe('KeywordType', () => { beforeEach(function() { this.keywordType = getStepKeywordType({ keyword: 'And ', - language: 'en' + language: 'en', }) }) @@ -67,7 +67,7 @@ describe('KeywordType', () => { this.keywordType = getStepKeywordType({ keyword: 'And ', language: 'en', - previousKeywordType: KeywordType.EVENT + previousKeywordType: KeywordType.EVENT, }) }) @@ -80,7 +80,7 @@ describe('KeywordType', () => { beforeEach(function() { this.keywordType = getStepKeywordType({ keyword: 'But ', - language: 'en' + language: 'en', }) }) @@ -94,7 +94,7 @@ describe('KeywordType', () => { this.keywordType = getStepKeywordType({ keyword: 'But ', language: 'en', - previousKeywordType: KeywordType.OUTCOME + previousKeywordType: KeywordType.OUTCOME, }) }) @@ -108,7 +108,7 @@ describe('KeywordType', () => { this.keywordType = getStepKeywordType({ index: 0, language: 'en', - stepKeywords: ['other '] + stepKeywords: ['other '], }) }) diff --git a/src/formatter/helpers/pickle_parser.js b/src/formatter/helpers/pickle_parser.js index 856abaf43..d282b7218 100644 --- a/src/formatter/helpers/pickle_parser.js +++ b/src/formatter/helpers/pickle_parser.js @@ -2,7 +2,7 @@ import _ from 'lodash' export function getScenarioDescription({ pickle, - scenarioLineToDescriptionMap + scenarioLineToDescriptionMap, }) { return _.chain(pickle.locations) .map(({ line }) => scenarioLineToDescriptionMap[line]) diff --git a/src/formatter/helpers/step_result_helpers.js b/src/formatter/helpers/step_result_helpers.js index 92668b394..05765ff57 100644 --- a/src/formatter/helpers/step_result_helpers.js +++ b/src/formatter/helpers/step_result_helpers.js @@ -19,7 +19,7 @@ export function getStepMessage({ keywordType, snippetBuilder, testStep, - pickleStep + pickleStep, }) { switch (testStep.result.status) { case Status.AMBIGUOUS: @@ -31,7 +31,7 @@ export function getStepMessage({ colorFns, keywordType, snippetBuilder, - pickleStep + pickleStep, }) case Status.PENDING: return getPendingStepResultMessage({ colorFns }) @@ -42,7 +42,7 @@ function getUndefinedStepResultMessage({ colorFns, keywordType, snippetBuilder, - pickleStep + pickleStep, }) { const snippet = snippetBuilder.build({ keywordType, pickleStep }) const message = `${'Undefined. Implement with the following snippet:' + diff --git a/src/formatter/helpers/summary_helpers.js b/src/formatter/helpers/summary_helpers.js index 9032bf696..8512f5315 100644 --- a/src/formatter/helpers/summary_helpers.js +++ b/src/formatter/helpers/summary_helpers.js @@ -8,7 +8,7 @@ const STATUS_REPORT_ORDER = [ Status.UNDEFINED, Status.PENDING, Status.SKIPPED, - Status.PASSED + Status.PASSED, ] export function formatSummary({ colorFns, testCaseMap, testRun }) { @@ -25,12 +25,12 @@ export function formatSummary({ colorFns, testCaseMap, testRun }) { const scenarioSummary = getCountSummary({ colorFns, objects: testCaseResults, - type: 'scenario' + type: 'scenario', }) const stepSummary = getCountSummary({ colorFns, objects: testStepResults, - type: 'step' + type: 'step', }) const durationSummary = getDuration(testRun.result.duration) return [scenarioSummary, stepSummary, durationSummary].join('\n') diff --git a/src/formatter/helpers/summary_helpers_spec.js b/src/formatter/helpers/summary_helpers_spec.js index 570b01ac3..fb56c9151 100644 --- a/src/formatter/helpers/summary_helpers_spec.js +++ b/src/formatter/helpers/summary_helpers_spec.js @@ -12,7 +12,7 @@ describe('SummaryHelpers', () => { this.options = { colorFns: getColorFns(false), testCaseMap: this.testCaseMap, - testRun: this.testRun + testRun: this.testRun, } }) @@ -34,10 +34,10 @@ describe('SummaryHelpers', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 2 }, - result: { status: Status.PASSED } - } + result: { status: Status.PASSED }, + }, ], - result: { status: Status.PASSED } + result: { status: Status.PASSED }, } this.result = formatSummary(this.options) }) @@ -56,10 +56,10 @@ describe('SummaryHelpers', () => { { result: { status: Status.PASSED } }, { sourceLocation: { uri: 'a.feature', line: 2 }, - result: { status: Status.PASSED } - } + result: { status: Status.PASSED }, + }, ], - result: { status: Status.PASSED } + result: { status: Status.PASSED }, } this.result = formatSummary(this.options) }) @@ -77,14 +77,14 @@ describe('SummaryHelpers', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 2 }, - result: { status: Status.PASSED } + result: { status: Status.PASSED }, }, { sourceLocation: { uri: 'a.feature', line: 3 }, - result: { status: Status.PASSED } - } + result: { status: Status.PASSED }, + }, ], - result: { status: Status.PASSED } + result: { status: Status.PASSED }, } this.result = formatSummary(this.options) }) @@ -102,55 +102,55 @@ describe('SummaryHelpers', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 2 }, - result: { status: Status.AMBIGUOUS } - } + result: { status: Status.AMBIGUOUS }, + }, ], - result: { status: Status.AMBIGUOUS } + result: { status: Status.AMBIGUOUS }, } this.testCaseMap['a.feature:3'] = { steps: [ { sourceLocation: { uri: 'a.feature', line: 4 }, - result: { status: Status.FAILED } - } + result: { status: Status.FAILED }, + }, ], - result: { status: Status.FAILED } + result: { status: Status.FAILED }, } this.testCaseMap['a.feature:5'] = { steps: [ { sourceLocation: { uri: 'a.feature', line: 6 }, - result: { status: Status.PENDING } - } + result: { status: Status.PENDING }, + }, ], - result: { status: Status.PENDING } + result: { status: Status.PENDING }, } this.testCaseMap['a.feature:7'] = { steps: [ { sourceLocation: { uri: 'a.feature', line: 8 }, - result: { status: Status.PASSED } - } + result: { status: Status.PASSED }, + }, ], - result: { status: Status.PASSED } + result: { status: Status.PASSED }, } this.testCaseMap['a.feature:9'] = { steps: [ { sourceLocation: { uri: 'a.feature', line: 10 }, - result: { status: Status.SKIPPED } - } + result: { status: Status.SKIPPED }, + }, ], - result: { status: Status.SKIPPED } + result: { status: Status.SKIPPED }, } this.testCaseMap['a.feature:11'] = { steps: [ { sourceLocation: { uri: 'a.feature', line: 12 }, - result: { status: Status.UNDEFINED } - } + result: { status: Status.UNDEFINED }, + }, ], - result: { status: Status.UNDEFINED } + result: { status: Status.UNDEFINED }, } this.result = formatSummary(this.options) }) diff --git a/src/formatter/helpers/usage_helpers/index.js b/src/formatter/helpers/usage_helpers/index.js index e36d17824..f4f09be03 100644 --- a/src/formatter/helpers/usage_helpers/index.js +++ b/src/formatter/helpers/usage_helpers/index.js @@ -10,7 +10,7 @@ function buildEmptyMapping(stepDefinitions) { line: stepDefinition.line, pattern: stepDefinition.pattern, matches: [], - uri: stepDefinition.uri + uri: stepDefinition.uri, } }) return mapping @@ -30,7 +30,7 @@ function buildMapping({ stepDefinitions, eventDataCollector }) { const match = { line: sourceLocation.line, text: stepLineToPickledStepMap[sourceLocation.line].text, - uri: sourceLocation.uri + uri: sourceLocation.uri, } if (isFinite(duration)) { match.duration = duration @@ -59,7 +59,7 @@ function buildResult(mapping) { .map(({ line, matches, pattern, uri }) => { const sortedMatches = _.sortBy(matches, [ invertNumber('duration'), - 'text' + 'text', ]) const result = { line, matches: sortedMatches, pattern, uri } const meanDuration = _.meanBy(matches, 'duration') diff --git a/src/formatter/helpers/usage_helpers/index_spec.js b/src/formatter/helpers/usage_helpers/index_spec.js index 6f151cdef..8d8c27113 100644 --- a/src/formatter/helpers/usage_helpers/index_spec.js +++ b/src/formatter/helpers/usage_helpers/index_spec.js @@ -14,7 +14,7 @@ describe('Usage Helpers', () => { this.getResult = () => getUsage({ eventDataCollector: this.eventDataCollector, - stepDefinitions: this.stepDefinitions + stepDefinitions: this.stepDefinitions, }) }) @@ -41,7 +41,7 @@ describe('Usage Helpers', () => { this.eventBroadcaster.emit('pickle-accepted', { type: 'pickle-accepted', pickle: event.pickle, - uri: event.uri + uri: event.uri, }) } }) @@ -50,18 +50,18 @@ describe('Usage Helpers', () => { ...testCase, steps: [ { sourceLocation: { uri: 'a.feature', line: 3 } }, - { sourceLocation: { uri: 'a.feature', line: 4 } } - ] + { sourceLocation: { uri: 'a.feature', line: 4 } }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase, - result: {} + result: {}, }) this.eventBroadcaster.emit('test-step-finished', { index: 1, testCase, - result: {} + result: {}, }) this.eventBroadcaster.emit('test-run-finished') }) diff --git a/src/formatter/index.js b/src/formatter/index.js index fd823848d..af7dde13a 100644 --- a/src/formatter/index.js +++ b/src/formatter/index.js @@ -11,7 +11,7 @@ export default class Formatter { 'log', 'snippetBuilder', 'stream', - 'supportCodeLibrary' + 'supportCodeLibrary', ]) ) } diff --git a/src/formatter/json_formatter.js b/src/formatter/json_formatter.js index fefc4d013..f90f68e1a 100644 --- a/src/formatter/json_formatter.js +++ b/src/formatter/json_formatter.js @@ -7,13 +7,13 @@ import { format } from 'assertion-error-formatter' const { getStepLineToKeywordMap, - getScenarioLineToDescriptionMap + getScenarioLineToDescriptionMap, } = GherkinDocumentParser const { getScenarioDescription, getStepLineToPickledStepMap, - getStepKeyword + getStepKeyword, } = PickleParser export default class JsonFormatter extends Formatter { @@ -28,21 +28,21 @@ export default class JsonFormatter extends Formatter { formatDataTable(dataTable) { return { - rows: dataTable.rows.map(row => ({ cells: _.map(row.cells, 'value') })) + rows: dataTable.rows.map(row => ({ cells: _.map(row.cells, 'value') })), } } formatDocString(docString) { return { content: docString.content, - line: docString.location.line + line: docString.location.line, } } formatStepArguments(stepArguments) { const iterator = buildStepArgumentIterator({ dataTable: this.formatDataTable.bind(this), - docString: this.formatDocString.bind(this) + docString: this.formatDocString.bind(this), }) return _.map(stepArguments, iterator) } @@ -70,7 +70,7 @@ export default class JsonFormatter extends Formatter { const scenarioData = this.getScenarioData({ featureId: featureData.id, pickle, - scenarioLineToDescriptionMap + scenarioLineToDescriptionMap, }) const stepLineToPickledStepMap = getStepLineToPickledStepMap(pickle) let isBeforeHook = true @@ -80,7 +80,7 @@ export default class JsonFormatter extends Formatter { isBeforeHook, stepLineToKeywordMap, stepLineToPickledStepMap, - testStep + testStep, }) }) return scenarioData @@ -98,14 +98,14 @@ export default class JsonFormatter extends Formatter { line: feature.location.line, id: this.convertNameToId(feature), tags: this.getTags(feature), - uri + uri, } } getScenarioData({ featureId, pickle, scenarioLineToDescriptionMap }) { const description = getScenarioDescription({ pickle, - scenarioLineToDescriptionMap + scenarioLineToDescriptionMap, }) return { description, @@ -114,7 +114,7 @@ export default class JsonFormatter extends Formatter { line: pickle.locations[0].line, name: pickle.name, tags: this.getTags(pickle), - type: 'scenario' + type: 'scenario', } } @@ -122,7 +122,7 @@ export default class JsonFormatter extends Formatter { isBeforeHook, stepLineToKeywordMap, stepLineToPickledStepMap, - testStep + testStep, }) { const data = {} if (testStep.sourceLocation) { @@ -152,7 +152,7 @@ export default class JsonFormatter extends Formatter { if (_.size(testStep.attachments) > 0) { data.embeddings = testStep.attachments.map(attachment => ({ data: attachment.data, - mime_type: attachment.media.type + mime_type: attachment.media.type, })) } return data @@ -161,7 +161,7 @@ export default class JsonFormatter extends Formatter { getTags(obj) { return _.map(obj.tags, tagData => ({ name: tagData.name, - line: tagData.location.line + line: tagData.location.line, })) } } diff --git a/src/formatter/json_formatter_spec.js b/src/formatter/json_formatter_spec.js index d77f07971..00ba20de2 100644 --- a/src/formatter/json_formatter_spec.js +++ b/src/formatter/json_formatter_spec.js @@ -16,7 +16,7 @@ describe('JsonFormatter', () => { this.jsonFormatter = new JsonFormatter({ eventBroadcaster: this.eventBroadcaster, eventDataCollector: new EventDataCollector(this.eventBroadcaster), - log: logFn + log: logFn, }) }) @@ -47,7 +47,7 @@ describe('JsonFormatter', () => { this.eventBroadcaster.emit('pickle-accepted', { type: 'pickle-accepted', pickle: event.pickle, - uri: event.uri + uri: event.uri, }) } }) @@ -60,18 +60,18 @@ describe('JsonFormatter', () => { sourceLocation: this.testCase.sourceLocation, steps: [ { - sourceLocation: { uri: 'a.feature', line: 6 } - } - ] + sourceLocation: { uri: 'a.feature', line: 6 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -96,20 +96,20 @@ describe('JsonFormatter', () => { name: 'my step', result: { status: 'passed', - duration: 1000000 - } - } + duration: 1000000, + }, + }, ], - tags: [{ name: '@tag1', line: 1 }, { name: '@tag2', line: 1 }] - } + tags: [{ name: '@tag1', line: 1 }, { name: '@tag2', line: 1 }], + }, ], id: 'my-feature', keyword: 'Feature', line: 2, name: 'my feature', tags: [{ name: '@tag1', line: 1 }, { name: '@tag2', line: 1 }], - uri: 'a.feature' - } + uri: 'a.feature', + }, ]) }) }) @@ -120,18 +120,18 @@ describe('JsonFormatter', () => { sourceLocation: this.testCase.sourceLocation, steps: [ { - sourceLocation: { uri: 'a.feature', line: 6 } - } - ] + sourceLocation: { uri: 'a.feature', line: 6 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { duration: 1, exception: 'my error', status: Status.FAILED } + result: { duration: 1, exception: 'my error', status: Status.FAILED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { duration: 1, status: Status.FAILED } + result: { duration: 1, status: Status.FAILED }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -141,7 +141,7 @@ describe('JsonFormatter', () => { expect(features[0].elements[0].steps[0].result).to.eql({ status: 'failed', error_message: 'my error', - duration: 1000000 + duration: 1000000, }) }) }) @@ -153,18 +153,18 @@ describe('JsonFormatter', () => { steps: [ { actionLocation: { uri: 'steps.js', line: 10 }, - sourceLocation: { uri: 'a.feature', line: 6 } - } - ] + sourceLocation: { uri: 'a.feature', line: 6 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -172,7 +172,7 @@ describe('JsonFormatter', () => { it('outputs the step with a match attribute', function() { const features = JSON.parse(this.output) expect(features[0].elements[0].steps[0].match).to.eql({ - location: 'steps.js:10' + location: 'steps.js:10', }) }) }) @@ -183,20 +183,20 @@ describe('JsonFormatter', () => { sourceLocation: this.testCase.sourceLocation, steps: [ { - actionLocation: { uri: 'steps.js', line: 10 } + actionLocation: { uri: 'steps.js', line: 10 }, }, { sourceLocation: { uri: 'a.feature', line: 6 }, - actionLocation: { uri: 'steps.js', line: 11 } + actionLocation: { uri: 'steps.js', line: 11 }, }, { - actionLocation: { uri: 'steps.js', line: 12 } - } - ] + actionLocation: { uri: 'steps.js', line: 12 }, + }, + ], }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -225,29 +225,29 @@ describe('JsonFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 6 }, - actionLocation: { uri: 'steps.js', line: 11 } - } - ] + actionLocation: { uri: 'steps.js', line: 11 }, + }, + ], }) this.eventBroadcaster.emit('test-step-attachment', { testCase: { - sourceLocation: this.testCase.sourceLocation + sourceLocation: this.testCase.sourceLocation, }, index: 0, data: 'first data', - media: { type: 'first media type' } + media: { type: 'first media type' }, }) this.eventBroadcaster.emit('test-step-attachment', { testCase: { - sourceLocation: this.testCase.sourceLocation + sourceLocation: this.testCase.sourceLocation, }, index: 0, data: 'second data', - media: { type: 'second media type' } + media: { type: 'second media type' }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -256,7 +256,7 @@ describe('JsonFormatter', () => { const features = JSON.parse(this.output) expect(features[0].elements[0].steps[0].embeddings).to.eql([ { data: 'first data', mime_type: 'first media type' }, - { data: 'second data', mime_type: 'second media type' } + { data: 'second data', mime_type: 'second media type' }, ]) }) }) @@ -279,7 +279,7 @@ describe('JsonFormatter', () => { this.eventBroadcaster.emit('pickle-accepted', { type: 'pickle-accepted', pickle: event.pickle, - uri: event.uri + uri: event.uri, }) } }) @@ -289,18 +289,18 @@ describe('JsonFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 10 } - } - ] + actionLocation: { uri: 'steps.js', line: 10 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) this.eventBroadcaster.emit('test-case-finished', { ...this.testCase, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -310,8 +310,8 @@ describe('JsonFormatter', () => { expect(features[0].elements[0].steps[0].arguments).to.eql([ { line: 4, - content: 'This is a DocString' - } + content: 'This is a DocString', + }, ]) }) }) @@ -333,7 +333,7 @@ describe('JsonFormatter', () => { this.eventBroadcaster.emit('pickle-accepted', { type: 'pickle-accepted', pickle: event.pickle, - uri: event.uri + uri: event.uri, }) } }) @@ -343,18 +343,18 @@ describe('JsonFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 10 } - } - ] + actionLocation: { uri: 'steps.js', line: 10 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) this.eventBroadcaster.emit('test-case-finished', { ...this.testCase, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -366,9 +366,9 @@ describe('JsonFormatter', () => { rows: [ { cells: ['aaa', 'b', 'c'] }, { cells: ['d', 'e', 'ff'] }, - { cells: ['gg', 'h', 'iii'] } - ] - } + { cells: ['gg', 'h', 'iii'] }, + ], + }, ]) }) }) diff --git a/src/formatter/progress_bar_formatter.js b/src/formatter/progress_bar_formatter.js index 521fe706a..08c5cd75a 100644 --- a/src/formatter/progress_bar_formatter.js +++ b/src/formatter/progress_bar_formatter.js @@ -26,7 +26,7 @@ export default class ProgressBarFormatter extends Formatter { incomplete: ' ', stream: this.stream, total: this.numberOfSteps, - width: this.stream.columns || 80 + width: this.stream.columns || 80, }) } @@ -43,7 +43,7 @@ export default class ProgressBarFormatter extends Formatter { const { gherkinDocument, pickle, - testCase + testCase, } = this.eventDataCollector.getTestCaseData(sourceLocation) this.progressBar.interrupt( formatIssue({ @@ -52,7 +52,7 @@ export default class ProgressBarFormatter extends Formatter { number: this.issueCount, pickle, snippetBuilder: this.snippetBuilder, - testCase + testCase, }) ) } @@ -63,7 +63,7 @@ export default class ProgressBarFormatter extends Formatter { formatSummary({ colorFns: this.colorFns, testCaseMap: this.eventDataCollector.testCaseMap, - testRun + testRun, }) ) } diff --git a/src/formatter/progress_bar_formatter_spec.js b/src/formatter/progress_bar_formatter_spec.js index d175762a9..353f40cab 100644 --- a/src/formatter/progress_bar_formatter_spec.js +++ b/src/formatter/progress_bar_formatter_spec.js @@ -24,7 +24,7 @@ describe('ProgressBarFormatter', () => { eventDataCollector: new EventDataCollector(this.eventBroadcaster), log: logFn, snippetBuilder: createMock({ build: 'snippet' }), - stream: {} + stream: {}, }) }) @@ -32,11 +32,11 @@ describe('ProgressBarFormatter', () => { beforeEach(function() { this.eventBroadcaster.emit('pickle-accepted', { pickle: { locations: [{ line: 2 }], steps: [1, 2, 3] }, - uri: 'path/to/feature' + uri: 'path/to/feature', }) this.eventBroadcaster.emit('pickle-accepted', { pickle: { locations: [{ line: 7 }], steps: [4, 5] }, - uri: 'path/to/feature' + uri: 'path/to/feature', }) this.eventBroadcaster.emit('test-case-started') }) @@ -50,7 +50,7 @@ describe('ProgressBarFormatter', () => { beforeEach(function() { this.progressBarFormatter.progressBar = { interrupt: sinon.stub(), - tick: sinon.stub() + tick: sinon.stub(), } this.eventBroadcaster.emit('test-case-prepared', { sourceLocation: { line: 2, uri: 'path/to/feature' }, @@ -58,9 +58,9 @@ describe('ProgressBarFormatter', () => { { actionLocation: { line: 2, uri: 'path/to/steps' } }, { actionLocation: { line: 2, uri: 'path/to/steps' }, - sourceLocation: { line: 3, uri: 'path/to/feature' } - } - ] + sourceLocation: { line: 3, uri: 'path/to/feature' }, + }, + ], }) }) @@ -69,9 +69,9 @@ describe('ProgressBarFormatter', () => { this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: { - sourceLocation: { line: 2, uri: 'path/to/feature' } + sourceLocation: { line: 2, uri: 'path/to/feature' }, }, - result: { status: Status.PASSED } + result: { status: Status.PASSED }, }) }) @@ -85,9 +85,9 @@ describe('ProgressBarFormatter', () => { this.eventBroadcaster.emit('test-step-finished', { index: 1, testCase: { - sourceLocation: { line: 2, uri: 'path/to/feature' } + sourceLocation: { line: 2, uri: 'path/to/feature' }, }, - result: { status: Status.PASSED } + result: { status: Status.PASSED }, }) }) @@ -101,7 +101,7 @@ describe('ProgressBarFormatter', () => { beforeEach(function() { this.progressBarFormatter.progressBar = { interrupt: sinon.stub(), - tick: sinon.stub() + tick: sinon.stub(), } const events = Gherkin.generateEvents( 'Feature: a\nScenario: b\nGiven a step', @@ -113,7 +113,7 @@ describe('ProgressBarFormatter', () => { this.eventBroadcaster.emit('pickle-accepted', { type: 'pickle-accepted', pickle: event.pickle, - uri: event.uri + uri: event.uri, }) } }) @@ -126,9 +126,9 @@ describe('ProgressBarFormatter', () => { sourceLocation: this.testCase.sourceLocation, steps: [ { - sourceLocation: { uri: 'a.feature', line: 3 } - } - ] + sourceLocation: { uri: 'a.feature', line: 3 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, @@ -138,12 +138,12 @@ describe('ProgressBarFormatter', () => { 'Multiple step definitions match:\n' + ' pattern1 - steps.js:3\n' + ' longer pattern2 - steps.js:4', - status: Status.AMBIGUOUS - } + status: Status.AMBIGUOUS, + }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { status: Status.AMBIGUOUS } + result: { status: Status.AMBIGUOUS }, }) }) @@ -161,18 +161,18 @@ describe('ProgressBarFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 4 } - } - ] + actionLocation: { uri: 'steps.js', line: 4 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { exception: 'error', status: Status.FAILED } + result: { exception: 'error', status: Status.FAILED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { status: Status.FAILED } + result: { status: Status.FAILED }, }) }) @@ -190,18 +190,18 @@ describe('ProgressBarFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 4 } - } - ] + actionLocation: { uri: 'steps.js', line: 4 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { status: Status.PASSED } + result: { status: Status.PASSED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { status: Status.PASSED } + result: { status: Status.PASSED }, }) }) @@ -219,18 +219,18 @@ describe('ProgressBarFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 4 } - } - ] + actionLocation: { uri: 'steps.js', line: 4 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { status: Status.PENDING } + result: { status: Status.PENDING }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { status: Status.PENDING } + result: { status: Status.PENDING }, }) }) @@ -248,18 +248,18 @@ describe('ProgressBarFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 4 } - } - ] + actionLocation: { uri: 'steps.js', line: 4 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { status: Status.SKIPPED } + result: { status: Status.SKIPPED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { status: Status.SKIPPED } + result: { status: Status.SKIPPED }, }) }) @@ -276,18 +276,18 @@ describe('ProgressBarFormatter', () => { sourceLocation: this.testCase.sourceLocation, steps: [ { - sourceLocation: { uri: 'a.feature', line: 3 } - } - ] + sourceLocation: { uri: 'a.feature', line: 3 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { status: Status.UNDEFINED } + result: { status: Status.UNDEFINED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { status: Status.UNDEFINED } + result: { status: Status.UNDEFINED }, }) }) @@ -302,7 +302,7 @@ describe('ProgressBarFormatter', () => { describe('test-run-finished', () => { beforeEach(function() { this.eventBroadcaster.emit('test-run-finished', { - result: { duration: 0 } + result: { duration: 0 }, }) }) diff --git a/src/formatter/progress_formatter.js b/src/formatter/progress_formatter.js index c2d096d69..9ec7cc70b 100644 --- a/src/formatter/progress_formatter.js +++ b/src/formatter/progress_formatter.js @@ -7,7 +7,7 @@ const STATUS_CHARACTER_MAPPING = { [Status.PASSED]: '.', [Status.PENDING]: 'P', [Status.SKIPPED]: '-', - [Status.UNDEFINED]: 'U' + [Status.UNDEFINED]: 'U', } export default class ProgressFormatter extends SummaryFormatter { diff --git a/src/formatter/progress_formatter_spec.js b/src/formatter/progress_formatter_spec.js index 397a474ef..3910d1ee2 100644 --- a/src/formatter/progress_formatter_spec.js +++ b/src/formatter/progress_formatter_spec.js @@ -18,7 +18,7 @@ describe('ProgressFormatter', () => { colorFns, eventBroadcaster: this.eventBroadcaster, eventDataCollector: new EventDataCollector(this.eventBroadcaster), - log: logFn + log: logFn, }) }) @@ -27,7 +27,7 @@ describe('ProgressFormatter', () => { this.testCase = { sourceLocation: { uri: 'path/to/feature', line: 1 } } this.eventBroadcaster.emit('test-case-prepared', { sourceLocation: this.testCase.sourceLocation, - steps: [{}] + steps: [{}], }) }) @@ -36,7 +36,7 @@ describe('ProgressFormatter', () => { this.eventBroadcaster.emit('test-step-finished', { index: 0, result: { status: Status.AMBIGUOUS }, - testCase: this.testCase + testCase: this.testCase, }) }) @@ -50,7 +50,7 @@ describe('ProgressFormatter', () => { this.eventBroadcaster.emit('test-step-finished', { index: 0, result: { status: Status.FAILED }, - testCase: this.testCase + testCase: this.testCase, }) }) @@ -64,7 +64,7 @@ describe('ProgressFormatter', () => { this.eventBroadcaster.emit('test-step-finished', { index: 0, result: { status: Status.PASSED }, - testCase: this.testCase + testCase: this.testCase, }) }) @@ -78,7 +78,7 @@ describe('ProgressFormatter', () => { this.eventBroadcaster.emit('test-step-finished', { index: 0, result: { status: Status.PENDING }, - testCase: this.testCase + testCase: this.testCase, }) }) @@ -92,7 +92,7 @@ describe('ProgressFormatter', () => { this.eventBroadcaster.emit('test-step-finished', { index: 0, result: { status: Status.SKIPPED }, - testCase: this.testCase + testCase: this.testCase, }) }) @@ -106,7 +106,7 @@ describe('ProgressFormatter', () => { this.eventBroadcaster.emit('test-step-finished', { index: 0, result: { status: Status.UNDEFINED }, - testCase: this.testCase + testCase: this.testCase, }) }) @@ -119,7 +119,7 @@ describe('ProgressFormatter', () => { describe('test run finished', () => { beforeEach(function() { this.eventBroadcaster.emit('test-run-finished', { - result: { duration: 0 } + result: { duration: 0 }, }) }) diff --git a/src/formatter/rerun_formatter_spec.js b/src/formatter/rerun_formatter_spec.js index 1c0c93631..a17b63317 100644 --- a/src/formatter/rerun_formatter_spec.js +++ b/src/formatter/rerun_formatter_spec.js @@ -17,7 +17,7 @@ function prepareFormatter(options = {}) { this.rerunFormatter = new RerunFormatter({ ...options, eventBroadcaster: this.eventBroadcaster, - log: logFn + log: logFn, }) } @@ -39,7 +39,7 @@ describe('RerunFormatter', () => { beforeEach(function() { this.eventBroadcaster.emit('test-case-finished', { sourceLocation: { uri: this.feature1Path, line: 1 }, - result: { status } + result: { status }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -56,14 +56,14 @@ describe('RerunFormatter', () => { Status.FAILED, Status.PENDING, Status.SKIPPED, - Status.UNDEFINED + Status.UNDEFINED, ], status => { describe(`with one ${status} scenario`, () => { beforeEach(function() { this.eventBroadcaster.emit('test-case-finished', { sourceLocation: { uri: this.feature1Path, line: 1 }, - result: { status } + result: { status }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -79,11 +79,11 @@ describe('RerunFormatter', () => { beforeEach(function() { this.eventBroadcaster.emit('test-case-finished', { sourceLocation: { uri: this.feature1Path, line: 1 }, - result: { status: Status.FAILED } + result: { status: Status.FAILED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: { uri: this.feature1Path, line: 2 }, - result: { status: Status.FAILED } + result: { status: Status.FAILED }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -97,23 +97,23 @@ describe('RerunFormatter', () => { [ { separator: { opt: undefined, expected: '\n' }, label: 'default' }, { separator: { opt: '\n', expected: '\n' }, label: 'newline' }, - { separator: { opt: ' ', expected: ' ' }, label: 'space' } + { separator: { opt: ' ', expected: ' ' }, label: 'space' }, ], ({ separator, label }) => { describe(`using ${label} separator`, () => { describe('with two failing scenarios in different files', () => { beforeEach(function() { prepareFormatter.apply(this, [ - { rerun: { separator: separator.opt } } + { rerun: { separator: separator.opt } }, ]) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: { uri: this.feature1Path, line: 1 }, - result: { status: Status.FAILED } + result: { status: Status.FAILED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: { uri: this.feature2Path, line: 2 }, - result: { status: Status.FAILED } + result: { status: Status.FAILED }, }) this.eventBroadcaster.emit('test-run-finished') }) diff --git a/src/formatter/snippets_formatter.js b/src/formatter/snippets_formatter.js index fa9362d08..139651554 100644 --- a/src/formatter/snippets_formatter.js +++ b/src/formatter/snippets_formatter.js @@ -15,21 +15,21 @@ export default class SnippetsFormatter extends Formatter { if (result.status === Status.UNDEFINED) { const { gherkinDocument, - testCase + testCase, } = this.eventDataCollector.getTestCaseData(sourceLocation) const { pickleStep, - gherkinKeyword + gherkinKeyword, } = this.eventDataCollector.getTestStepData({ testCase, index }) const previousKeywordType = this.getPreviousKeywordType({ gherkinDocument, testCase, - index + index, }) const keywordType = getStepKeywordType({ keyword: gherkinKeyword, language: gherkinDocument.feature.language, - previousKeywordType + previousKeywordType, }) const snippet = this.snippetBuilder.build({ keywordType, pickleStep }) this.log(`${snippet}\n\n`) @@ -41,12 +41,12 @@ export default class SnippetsFormatter extends Formatter { for (let i = 0; i < index; i += 1) { const { gherkinKeyword } = this.eventDataCollector.getTestStepData({ testCase, - index: i + index: i, }) previousKeywordType = getStepKeywordType({ keyword: gherkinKeyword, language: gherkinDocument.feature.language, - previousKeywordType + previousKeywordType, }) } return previousKeywordType diff --git a/src/formatter/step_definition_snippet_builder/index.js b/src/formatter/step_definition_snippet_builder/index.js index 66acdd624..3084285fe 100644 --- a/src/formatter/step_definition_snippet_builder/index.js +++ b/src/formatter/step_definition_snippet_builder/index.js @@ -23,7 +23,7 @@ export default class StepDefinitionSnippetBuilder { comment, functionName, generatedExpressions, - stepParameterNames + stepParameterNames, }) } @@ -41,7 +41,7 @@ export default class StepDefinitionSnippetBuilder { getStepParameterNames(step) { const iterator = buildStepArgumentIterator({ dataTable: () => 'dataTable', - docString: () => 'docString' + docString: () => 'docString', }) return step.arguments.map(iterator) } diff --git a/src/formatter/step_definition_snippet_builder/index_spec.js b/src/formatter/step_definition_snippet_builder/index_spec.js index 3ce822740..2b7f1dfd5 100644 --- a/src/formatter/step_definition_snippet_builder/index_spec.js +++ b/src/formatter/step_definition_snippet_builder/index_spec.js @@ -11,7 +11,7 @@ describe('StepDefinitionSnippetBuilder', () => { this.transformsLookup = TransformLookupBuilder.build() this.snippetBuilder = new StepDefinitionSnippetBuilder({ snippetSyntax: this.snippetSyntax, - parameterTypeRegistry: this.transformsLookup + parameterTypeRegistry: this.transformsLookup, }) }) @@ -21,8 +21,8 @@ describe('StepDefinitionSnippetBuilder', () => { keywordType: KeywordType.PRECONDITION, pickleStep: { arguments: [], - text: '' - } + text: '', + }, } }) diff --git a/src/formatter/step_definition_snippet_builder/javascript_snippet_syntax_spec.js b/src/formatter/step_definition_snippet_builder/javascript_snippet_syntax_spec.js index 6563fe785..3fa47b7c0 100644 --- a/src/formatter/step_definition_snippet_builder/javascript_snippet_syntax_spec.js +++ b/src/formatter/step_definition_snippet_builder/javascript_snippet_syntax_spec.js @@ -16,10 +16,10 @@ describe('JavascriptSnippetSyntax', () => { generatedExpressions: [ { source: 'pattern', - parameterNames: ['arg1', 'arg2'] - } + parameterNames: ['arg1', 'arg2'], + }, ], - stepParameterNames: [] + stepParameterNames: [], }) const expected = "functionName('pattern', function (arg1, arg2, callback) {\n" + @@ -42,10 +42,10 @@ describe('JavascriptSnippetSyntax', () => { generatedExpressions: [ { source: 'pattern', - parameterNames: ['arg1', 'arg2'] - } + parameterNames: ['arg1', 'arg2'], + }, ], - stepParameterNames: [] + stepParameterNames: [], }) const expected = "functionName('pattern', function *(arg1, arg2) {\n" + @@ -68,10 +68,10 @@ describe('JavascriptSnippetSyntax', () => { generatedExpressions: [ { source: 'pattern', - parameterNames: ['arg1', 'arg2'] - } + parameterNames: ['arg1', 'arg2'], + }, ], - stepParameterNames: [] + stepParameterNames: [], }) const expected = "functionName('pattern', function (arg1, arg2) {\n" + @@ -94,10 +94,10 @@ describe('JavascriptSnippetSyntax', () => { generatedExpressions: [ { source: 'pattern', - parameterNames: ['arg1', 'arg2'] - } + parameterNames: ['arg1', 'arg2'], + }, ], - stepParameterNames: [] + stepParameterNames: [], }) const expected = "functionName('pattern', function (arg1, arg2) {\n" + @@ -120,10 +120,10 @@ describe('JavascriptSnippetSyntax', () => { generatedExpressions: [ { source: "pattern'", - parameterNames: ['arg1', 'arg2'] - } + parameterNames: ['arg1', 'arg2'], + }, ], - stepParameterNames: [] + stepParameterNames: [], }) const expected = "functionName('pattern\\'', function (arg1, arg2) {\n" + @@ -146,18 +146,18 @@ describe('JavascriptSnippetSyntax', () => { generatedExpressions: [ { parameterNames: ['argA', 'argB'], - source: 'pattern1' + source: 'pattern1', }, { parameterNames: ['argC', 'argD'], - source: 'pattern2' + source: 'pattern2', }, { parameterNames: ['argE', 'argF'], - source: 'pattern3' - } + source: 'pattern3', + }, ], - stepParameterNames: [] + stepParameterNames: [], }) const expected = "functionName('pattern1', function (argA, argB) {\n" + diff --git a/src/formatter/summary_formatter.js b/src/formatter/summary_formatter.js index 9729456ee..40a5f39a3 100644 --- a/src/formatter/summary_formatter.js +++ b/src/formatter/summary_formatter.js @@ -40,7 +40,7 @@ export default class SummaryFormatter extends Formatter { formatSummary({ colorFns: this.colorFns, testCaseMap: this.eventDataCollector.testCaseMap, - testRun + testRun, }) ) } @@ -50,7 +50,7 @@ export default class SummaryFormatter extends Formatter { issues.forEach((testCase, index) => { const { gherkinDocument, - pickle + pickle, } = this.eventDataCollector.getTestCaseData(testCase.sourceLocation) this.log( formatIssue({ @@ -59,7 +59,7 @@ export default class SummaryFormatter extends Formatter { number: index + 1, pickle, snippetBuilder: this.snippetBuilder, - testCase + testCase, }) ) }) diff --git a/src/formatter/summary_formatter_spec.js b/src/formatter/summary_formatter_spec.js index 34f5d05ab..aa47df2e4 100644 --- a/src/formatter/summary_formatter_spec.js +++ b/src/formatter/summary_formatter_spec.js @@ -21,7 +21,7 @@ describe('SummaryFormatter', () => { eventBroadcaster: this.eventBroadcaster, eventDataCollector: new EventDataCollector(this.eventBroadcaster), log: logFn, - snippetBuilder: createMock({ build: 'snippet' }) + snippetBuilder: createMock({ build: 'snippet' }), }) }) @@ -37,7 +37,7 @@ describe('SummaryFormatter', () => { this.eventBroadcaster.emit('pickle-accepted', { type: 'pickle-accepted', pickle: event.pickle, - uri: event.uri + uri: event.uri, }) } }) @@ -51,21 +51,21 @@ describe('SummaryFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 4 } - } - ] + actionLocation: { uri: 'steps.js', line: 4 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { exception: 'error', status: Status.FAILED } + result: { exception: 'error', status: Status.FAILED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { status: Status.FAILED } + result: { status: Status.FAILED }, }) this.eventBroadcaster.emit('test-run-finished', { - result: { duration: 0 } + result: { duration: 0 }, }) }) @@ -90,9 +90,9 @@ describe('SummaryFormatter', () => { sourceLocation: this.testCase.sourceLocation, steps: [ { - sourceLocation: { uri: 'a.feature', line: 3 } - } - ] + sourceLocation: { uri: 'a.feature', line: 3 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, @@ -102,15 +102,15 @@ describe('SummaryFormatter', () => { 'Multiple step definitions match:\n' + ' pattern1 - steps.js:3\n' + ' longer pattern2 - steps.js:4', - status: Status.AMBIGUOUS - } + status: Status.AMBIGUOUS, + }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { status: Status.AMBIGUOUS } + result: { status: Status.AMBIGUOUS }, }) this.eventBroadcaster.emit('test-run-finished', { - result: { duration: 0 } + result: { duration: 0 }, }) }) @@ -137,21 +137,21 @@ describe('SummaryFormatter', () => { sourceLocation: this.testCase.sourceLocation, steps: [ { - sourceLocation: { uri: 'a.feature', line: 3 } - } - ] + sourceLocation: { uri: 'a.feature', line: 3 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { status: Status.UNDEFINED } + result: { status: Status.UNDEFINED }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { status: Status.UNDEFINED } + result: { status: Status.UNDEFINED }, }) this.eventBroadcaster.emit('test-run-finished', { - result: { duration: 0 } + result: { duration: 0 }, }) }) @@ -180,21 +180,21 @@ describe('SummaryFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 4 } - } - ] + actionLocation: { uri: 'steps.js', line: 4 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { status: Status.PENDING } + result: { status: Status.PENDING }, }) this.eventBroadcaster.emit('test-case-finished', { sourceLocation: this.testCase.sourceLocation, - result: { status: Status.PENDING } + result: { status: Status.PENDING }, }) this.eventBroadcaster.emit('test-run-finished', { - result: { duration: 0 } + result: { duration: 0 }, }) }) @@ -217,7 +217,7 @@ describe('SummaryFormatter', () => { describe('with a duration of 123 milliseconds', () => { beforeEach(function() { this.eventBroadcaster.emit('test-run-finished', { - result: { duration: 123 } + result: { duration: 123 }, }) }) @@ -229,7 +229,7 @@ describe('SummaryFormatter', () => { describe('with a duration of 12.3 seconds', () => { beforeEach(function() { this.eventBroadcaster.emit('test-run-finished', { - result: { duration: 123 * 100 } + result: { duration: 123 * 100 }, }) }) @@ -241,7 +241,7 @@ describe('SummaryFormatter', () => { describe('with a duration of 120.3 seconds', () => { beforeEach(function() { this.eventBroadcaster.emit('test-run-finished', { - result: { duration: 123 * 1000 } + result: { duration: 123 * 1000 }, }) }) diff --git a/src/formatter/usage_formatter.js b/src/formatter/usage_formatter.js index 3e37bf742..86f968674 100644 --- a/src/formatter/usage_formatter.js +++ b/src/formatter/usage_formatter.js @@ -12,7 +12,7 @@ export default class UsageFormatter extends Formatter { logUsage() { const usage = getUsage({ stepDefinitions: this.supportCodeLibrary.stepDefinitions, - eventDataCollector: this.eventDataCollector + eventDataCollector: this.eventDataCollector, }) if (usage.length === 0) { this.log('No step definitions') @@ -22,8 +22,8 @@ export default class UsageFormatter extends Formatter { head: ['Pattern / Text', 'Duration', 'Location'], style: { border: [], - head: [] - } + head: [], + }, }) usage.forEach(({ line, matches, meanDuration, pattern, uri }) => { const col1 = [pattern.toString()] diff --git a/src/formatter/usage_formatter_spec.js b/src/formatter/usage_formatter_spec.js index df1cdb305..2e0def3c5 100644 --- a/src/formatter/usage_formatter_spec.js +++ b/src/formatter/usage_formatter_spec.js @@ -14,13 +14,13 @@ describe('UsageFormatter', () => { this.output += data } this.supportCodeLibrary = { - stepDefinitions: [] + stepDefinitions: [], } this.usageFormatter = new UsageFormatter({ eventBroadcaster: this.eventBroadcaster, eventDataCollector: new EventDataCollector(this.eventBroadcaster), log: logFn, - supportCodeLibrary: this.supportCodeLibrary + supportCodeLibrary: this.supportCodeLibrary, }) }) @@ -39,7 +39,7 @@ describe('UsageFormatter', () => { this.stepDefinition = { line: 1, pattern: '/^abc?$/', - uri: 'steps.js' + uri: 'steps.js', } this.supportCodeLibrary.stepDefinitions = [this.stepDefinition] }) @@ -72,7 +72,7 @@ describe('UsageFormatter', () => { this.eventBroadcaster.emit('pickle-accepted', { type: 'pickle-accepted', pickle: event.pickle, - uri: event.uri + uri: event.uri, }) } }) @@ -82,13 +82,13 @@ describe('UsageFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 1 } + actionLocation: { uri: 'steps.js', line: 1 }, }, { sourceLocation: { uri: 'a.feature', line: 4 }, - actionLocation: { uri: 'steps.js', line: 1 } - } - ] + actionLocation: { uri: 'steps.js', line: 1 }, + }, + ], }) }) @@ -97,12 +97,12 @@ describe('UsageFormatter', () => { this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: {} + result: {}, }) this.eventBroadcaster.emit('test-step-finished', { index: 1, testCase: this.testCase, - result: {} + result: {}, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -125,12 +125,12 @@ describe('UsageFormatter', () => { this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase: this.testCase, - result: { duration: 1 } + result: { duration: 1 }, }) this.eventBroadcaster.emit('test-step-finished', { index: 1, testCase: this.testCase, - result: { duration: 0 } + result: { duration: 0 }, }) this.eventBroadcaster.emit('test-run-finished') }) @@ -156,18 +156,18 @@ describe('UsageFormatter', () => { { line: 1, pattern: '/abc/', - uri: 'steps.js' + uri: 'steps.js', }, { line: 2, pattern: '/def/', - uri: 'steps.js' + uri: 'steps.js', }, { line: 3, pattern: '/ghi/', - uri: 'steps.js' - } + uri: 'steps.js', + }, ] const events = Gherkin.generateEvents( 'Feature: a\nScenario: b\nGiven abc\nWhen def', @@ -179,7 +179,7 @@ describe('UsageFormatter', () => { this.eventBroadcaster.emit('pickle-accepted', { type: 'pickle-accepted', pickle: event.pickle, - uri: event.uri + uri: event.uri, }) } }) @@ -189,23 +189,23 @@ describe('UsageFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 1 } + actionLocation: { uri: 'steps.js', line: 1 }, }, { sourceLocation: { uri: 'a.feature', line: 4 }, - actionLocation: { uri: 'steps.js', line: 2 } - } - ] + actionLocation: { uri: 'steps.js', line: 2 }, + }, + ], }) this.eventBroadcaster.emit('test-step-finished', { index: 0, testCase, - result: { duration: 1 } + result: { duration: 1 }, }) this.eventBroadcaster.emit('test-step-finished', { index: 1, testCase, - result: { duration: 2 } + result: { duration: 2 }, }) this.eventBroadcaster.emit('test-run-finished') }) diff --git a/src/formatter/usage_json_formatter.js b/src/formatter/usage_json_formatter.js index 81a8c3b00..6c3802e54 100644 --- a/src/formatter/usage_json_formatter.js +++ b/src/formatter/usage_json_formatter.js @@ -10,7 +10,7 @@ export default class UsageJsonFormatter extends Formatter { logUsage() { const usage = getUsage({ stepDefinitions: this.supportCodeLibrary.stepDefinitions, - eventDataCollector: this.eventDataCollector + eventDataCollector: this.eventDataCollector, }) this.log(JSON.stringify(usage, null, 2)) } diff --git a/src/formatter/usage_json_formatter_spec.js b/src/formatter/usage_json_formatter_spec.js index a5ee0a010..ba8a91e4b 100644 --- a/src/formatter/usage_json_formatter_spec.js +++ b/src/formatter/usage_json_formatter_spec.js @@ -18,25 +18,25 @@ describe('UsageJsonFormatter', () => { { line: 1, pattern: '/abc/', - uri: 'steps.js' + uri: 'steps.js', }, { line: 2, pattern: '/def/', - uri: 'steps.js' + uri: 'steps.js', }, { line: 3, pattern: '/ghi/', - uri: 'steps.js' - } - ] + uri: 'steps.js', + }, + ], } this.usageJsonFormatter = new UsageJsonFormatter({ eventBroadcaster, eventDataCollector: new EventDataCollector(eventBroadcaster), log: logFn, - supportCodeLibrary + supportCodeLibrary, }) const events = Gherkin.generateEvents( 'Feature: a\nScenario: b\nGiven abc\nWhen def', @@ -48,7 +48,7 @@ describe('UsageJsonFormatter', () => { eventBroadcaster.emit('pickle-accepted', { type: 'pickle-accepted', pickle: event.pickle, - uri: event.uri + uri: event.uri, }) } }) @@ -58,23 +58,23 @@ describe('UsageJsonFormatter', () => { steps: [ { sourceLocation: { uri: 'a.feature', line: 3 }, - actionLocation: { uri: 'steps.js', line: 1 } + actionLocation: { uri: 'steps.js', line: 1 }, }, { sourceLocation: { uri: 'a.feature', line: 4 }, - actionLocation: { uri: 'steps.js', line: 2 } - } - ] + actionLocation: { uri: 'steps.js', line: 2 }, + }, + ], }) eventBroadcaster.emit('test-step-finished', { index: 0, testCase, - result: { duration: 1 } + result: { duration: 1 }, }) eventBroadcaster.emit('test-step-finished', { index: 1, testCase, - result: { duration: 2 } + result: { duration: 2 }, }) eventBroadcaster.emit('test-run-finished') }) @@ -89,12 +89,12 @@ describe('UsageJsonFormatter', () => { duration: 2, line: 4, text: 'def', - uri: 'a.feature' - } + uri: 'a.feature', + }, ], meanDuration: 2, pattern: '/def/', - uri: 'steps.js' + uri: 'steps.js', }, { line: 1, @@ -103,19 +103,19 @@ describe('UsageJsonFormatter', () => { duration: 1, line: 3, text: 'abc', - uri: 'a.feature' - } + uri: 'a.feature', + }, ], meanDuration: 1, pattern: '/abc/', - uri: 'steps.js' + uri: 'steps.js', }, { line: 3, matches: [], pattern: '/ghi/', - uri: 'steps.js' - } + uri: 'steps.js', + }, ]) }) }) diff --git a/src/index.js b/src/index.js index 716575e8a..8b4b62a2a 100644 --- a/src/index.js +++ b/src/index.js @@ -8,7 +8,7 @@ export { default as PickleFilter } from './pickle_filter' export { default as Runtime } from './runtime' export { default as Status } from './status' export { - default as supportCodeLibraryBuilder + default as supportCodeLibraryBuilder, } from './support_code_library_builder' // Formatters diff --git a/src/models/data_table_spec.js b/src/models/data_table_spec.js index 7c741ab92..c63a65b2f 100644 --- a/src/models/data_table_spec.js +++ b/src/models/data_table_spec.js @@ -8,15 +8,15 @@ describe('DataTable', () => { this.dataTable = new DataTable({ rows: [ { - cells: [{ value: 'header 1' }, { value: 'header 2' }] + cells: [{ value: 'header 1' }, { value: 'header 2' }], }, { - cells: [{ value: 'row 1 col 1' }, { value: 'row 1 col 2' }] + cells: [{ value: 'row 1 col 1' }, { value: 'row 1 col 2' }], }, { - cells: [{ value: 'row 2 col 1' }, { value: 'row 2 col 2' }] - } - ] + cells: [{ value: 'row 2 col 1' }, { value: 'row 2 col 2' }], + }, + ], }) }) @@ -24,7 +24,7 @@ describe('DataTable', () => { it('returns a 2-D array without the header', function() { expect(this.dataTable.rows()).to.eql([ ['row 1 col 1', 'row 1 col 2'], - ['row 2 col 1', 'row 2 col 2'] + ['row 2 col 1', 'row 2 col 2'], ]) }) }) @@ -33,7 +33,7 @@ describe('DataTable', () => { it('returns an array of object where the keys are the headers', function() { expect(this.dataTable.hashes()).to.eql([ { 'header 1': 'row 1 col 1', 'header 2': 'row 1 col 2' }, - { 'header 1': 'row 2 col 1', 'header 2': 'row 2 col 2' } + { 'header 1': 'row 2 col 1', 'header 2': 'row 2 col 2' }, ]) }) }) @@ -44,12 +44,12 @@ describe('DataTable', () => { this.dataTable = new DataTable({ rows: [ { - cells: [{ value: 'row 1 col 1' }, { value: 'row 1 col 2' }] + cells: [{ value: 'row 1 col 1' }, { value: 'row 1 col 2' }], }, { - cells: [{ value: 'row 2 col 1' }, { value: 'row 2 col 2' }] - } - ] + cells: [{ value: 'row 2 col 1' }, { value: 'row 2 col 2' }], + }, + ], }) }) @@ -57,7 +57,7 @@ describe('DataTable', () => { it('returns a 2-D array', function() { expect(this.dataTable.raw()).to.eql([ ['row 1 col 1', 'row 1 col 2'], - ['row 2 col 1', 'row 2 col 2'] + ['row 2 col 1', 'row 2 col 2'], ]) }) }) @@ -66,7 +66,7 @@ describe('DataTable', () => { it('returns an object where the keys are the first column', function() { expect(this.dataTable.rowsHash()).to.eql({ 'row 1 col 1': 'row 1 col 2', - 'row 2 col 1': 'row 2 col 2' + 'row 2 col 1': 'row 2 col 2', }) }) }) diff --git a/src/models/step_definition.js b/src/models/step_definition.js index 7e6cbec9e..2ea6eeb99 100644 --- a/src/models/step_definition.js +++ b/src/models/step_definition.js @@ -33,7 +33,7 @@ export default class StepDefinition { .map(arg => arg.getValue(world)) const iterator = buildStepArgumentIterator({ dataTable: arg => new DataTable(arg), - docString: arg => arg.content + docString: arg => arg.content, }) const stepArgumentParameters = step.arguments.map(iterator) return stepNameParameters.concat(stepArgumentParameters) diff --git a/src/models/test_case_hook_definition.js b/src/models/test_case_hook_definition.js index 2d3ca9d2a..1b82b6507 100644 --- a/src/models/test_case_hook_definition.js +++ b/src/models/test_case_hook_definition.js @@ -5,7 +5,7 @@ export default class TestCaseHookDefinition extends StepDefinition { constructor(data) { super(data) this.pickleFilter = new PickleFilter({ - tagExpression: this.options.tags + tagExpression: this.options.tags, }) } diff --git a/src/models/test_case_hook_definition_spec.js b/src/models/test_case_hook_definition_spec.js index 2a78149b3..916a9fe28 100644 --- a/src/models/test_case_hook_definition_spec.js +++ b/src/models/test_case_hook_definition_spec.js @@ -7,16 +7,16 @@ describe('TestCaseHookDefinition', () => { beforeEach(function() { this.input = { pickle: { - tags: [] + tags: [], }, - uri: '' + uri: '', } }) describe('no tags', () => { beforeEach(function() { this.testCaseHookDefinition = new TestCaseHookDefinition({ - options: {} + options: {}, }) }) @@ -31,7 +31,7 @@ describe('TestCaseHookDefinition', () => { beforeEach(function() { this.input.pickle.tags = [{ name: '@tagA' }] this.testCaseHookDefinition = new TestCaseHookDefinition({ - options: { tags: '@tagA' } + options: { tags: '@tagA' }, }) }) @@ -45,7 +45,7 @@ describe('TestCaseHookDefinition', () => { describe('tags do not match', () => { beforeEach(function() { this.testCaseHookDefinition = new TestCaseHookDefinition({ - options: { tags: '@tagA' } + options: { tags: '@tagA' }, }) }) diff --git a/src/pickle_filter_spec.js b/src/pickle_filter_spec.js index b9e136a2b..1a3d8d076 100644 --- a/src/pickle_filter_spec.js +++ b/src/pickle_filter_spec.js @@ -9,9 +9,9 @@ describe('PickleFilter', () => { pickle: { locations: [], name: '', - tags: [] + tags: [], }, - uri: '' + uri: '', } }) @@ -20,7 +20,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features'], names: [], - tagExpressions: [] + tagExpressions: [], }) }) @@ -34,7 +34,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features/a.feature', 'features/b.feature:1:2'], names: [], - tagExpressions: [] + tagExpressions: [], }) }) @@ -107,7 +107,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features'], names: ['nameA'], - tagExpressions: [] + tagExpressions: [], }) }) @@ -137,7 +137,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features'], names: ['nameA', 'nameB'], - tagExpressions: [] + tagExpressions: [], }) }) @@ -179,7 +179,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features'], names: [], - tagExpression: '@tagA' + tagExpression: '@tagA', }) }) @@ -205,7 +205,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features'], names: [], - tagExpression: 'not @tagA' + tagExpression: 'not @tagA', }) }) @@ -231,7 +231,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features'], names: [], - tagExpression: '@tagA and @tagB' + tagExpression: '@tagA and @tagB', }) }) @@ -277,7 +277,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features'], names: [], - tagExpression: '@tagA or @tagB' + tagExpression: '@tagA or @tagB', }) }) @@ -329,7 +329,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features/b.feature:1:2'], names: ['nameA'], - tagExpressions: ['@tagA'] + tagExpressions: ['@tagA'], }) this.input.pickle.locations = [{ line: 1 }] this.input.pickle.name = 'nameA descriptionA' @@ -346,7 +346,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features/b.feature:1:2'], names: ['nameA'], - tagExpressions: ['tagA'] + tagExpressions: ['tagA'], }) this.input.pickle.locations = [{ line: 1 }] }) @@ -361,7 +361,7 @@ describe('PickleFilter', () => { this.pickleFilter = new PickleFilter({ featurePaths: ['features/b.feature:1:2'], names: ['nameA'], - tagExpression: '@tagA' + tagExpression: '@tagA', }) this.input.pickle.locations = [{ line: 1 }] }) diff --git a/src/runtime/attachment_manager/index.js b/src/runtime/attachment_manager/index.js index 31b24a9d4..36baa2551 100644 --- a/src/runtime/attachment_manager/index.js +++ b/src/runtime/attachment_manager/index.js @@ -32,7 +32,7 @@ export default class AttachmentManager { createBufferAttachment(data, mediaType) { this.createStringAttachment(data.toString('base64'), { encoding: 'base64', - type: mediaType + type: mediaType, }) } diff --git a/src/runtime/attachment_manager/index_spec.js b/src/runtime/attachment_manager/index_spec.js index ad26c56b8..ea0358cee 100644 --- a/src/runtime/attachment_manager/index_spec.js +++ b/src/runtime/attachment_manager/index_spec.js @@ -29,7 +29,7 @@ describe('AttachmentManager', () => { expect(decodedData).to.eql('my string') expect(attachment.media).to.eql({ encoding: 'base64', - type: 'text/special' + type: 'text/special', }) }) }) @@ -72,7 +72,7 @@ describe('AttachmentManager', () => { expect(decodedData).to.eql('my string') expect(attachment.media).to.eql({ encoding: 'base64', - type: 'text/special' + type: 'text/special', }) }) }) @@ -104,7 +104,7 @@ describe('AttachmentManager', () => { expect(decodedData).to.eql('my string') expect(attachment.media).to.eql({ encoding: 'base64', - type: 'text/special' + type: 'text/special', }) }) }) diff --git a/src/runtime/helpers.js b/src/runtime/helpers.js index ec61cbb9d..a0a1323b3 100644 --- a/src/runtime/helpers.js +++ b/src/runtime/helpers.js @@ -19,13 +19,13 @@ export function getAmbiguousStepException(stepDefinitions) { top: '', 'top-left': '', 'top-mid': '', - 'top-right': '' + 'top-right': '', }, style: { border: [], 'padding-left': 0, - 'padding-right': 0 - } + 'padding-right': 0, + }, }) table.push( ...stepDefinitions.map(stepDefinition => { diff --git a/src/runtime/helpers_spec.js b/src/runtime/helpers_spec.js index 58ff6dc73..576ea2579 100644 --- a/src/runtime/helpers_spec.js +++ b/src/runtime/helpers_spec.js @@ -10,8 +10,8 @@ describe('Helpers', () => { { line: 4, pattern: 'longer pattern2', - uri: 'steps2.js' - } + uri: 'steps2.js', + }, ]) }) diff --git a/src/runtime/index.js b/src/runtime/index.js index 82b96e86e..53097c94e 100644 --- a/src/runtime/index.js +++ b/src/runtime/index.js @@ -17,7 +17,7 @@ export default class Runtime { this.testCases = testCases || [] this.result = { duration: 0, - success: true + success: true, } } @@ -29,7 +29,7 @@ export default class Runtime { thisArg: null, timeoutInMilliseconds: hookDefinition.options.timeout || - this.supportCodeLibrary.defaultTimeout + this.supportCodeLibrary.defaultTimeout, }) if (error) { const location = formatLocation(hookDefinition) @@ -49,7 +49,7 @@ export default class Runtime { skip, supportCodeLibrary: this.supportCodeLibrary, testCase, - worldParameters: this.options.worldParameters + worldParameters: this.options.worldParameters, }) const testCaseResult = await testCaseRunner.run() if (testCaseResult.duration) { diff --git a/src/runtime/parallel/command_types.js b/src/runtime/parallel/command_types.js index 70ec34d8d..736f5c8f6 100644 --- a/src/runtime/parallel/command_types.js +++ b/src/runtime/parallel/command_types.js @@ -3,7 +3,7 @@ const commandTypes = { RUN: 'run', READY: 'ready', FINALIZE: 'finalize', - EVENT: 'event' + EVENT: 'event', } export default commandTypes diff --git a/src/runtime/parallel/master.js b/src/runtime/parallel/master.js index 222f47e28..e1b62e8cb 100644 --- a/src/runtime/parallel/master.js +++ b/src/runtime/parallel/master.js @@ -21,7 +21,7 @@ export default class Master { options, supportCodePaths, supportCodeRequiredModules, - testCases + testCases, }) { this.eventBroadcaster = eventBroadcaster this.options = options || {} @@ -32,7 +32,7 @@ export default class Master { this.testCasesCompleted = 0 this.result = { duration: 0, - success: true + success: true, } this.slaves = {} } @@ -59,9 +59,9 @@ export default class Master { env: _.assign({}, process.env, { CUCUMBER_PARALLEL: 'true', CUCUMBER_TOTAL_SLAVES: total, - CUCUMBER_SLAVE_ID: id + CUCUMBER_SLAVE_ID: id, }), - stdio: ['pipe', 'pipe', process.stderr] + stdio: ['pipe', 'pipe', process.stderr], }) const rl = readline.createInterface({ input: slaveProcess.stdout }) const slave = { process: slaveProcess } @@ -79,7 +79,7 @@ export default class Master { filterStacktraces: this.options.filterStacktraces, supportCodePaths: this.supportCodePaths, supportCodeRequiredModules: this.supportCodeRequiredModules, - worldParameters: this.options.worldParameters + worldParameters: this.options.worldParameters, }) + '\n' ) } diff --git a/src/runtime/parallel/run_slave.js b/src/runtime/parallel/run_slave.js index 140f6d8bd..ea8350849 100644 --- a/src/runtime/parallel/run_slave.js +++ b/src/runtime/parallel/run_slave.js @@ -4,7 +4,7 @@ export default async function run() { const slave = new Slave({ stdin: process.stdin, stdout: process.stdout, - cwd: process.cwd() + cwd: process.cwd(), }) await slave.run() } diff --git a/src/runtime/parallel/slave.js b/src/runtime/parallel/slave.js index c22d20c79..c9798864d 100644 --- a/src/runtime/parallel/slave.js +++ b/src/runtime/parallel/slave.js @@ -15,7 +15,7 @@ const EVENTS = [ 'test-step-started', 'test-step-attachment', 'test-step-finished', - 'test-case-finished' + 'test-case-finished', ] export default class Slave { @@ -39,7 +39,7 @@ export default class Slave { filterStacktraces, supportCodeRequiredModules, supportCodePaths, - worldParameters + worldParameters, }) { supportCodeRequiredModules.map(module => require(module)) supportCodeLibraryBuilder.reset(this.cwd) @@ -86,7 +86,7 @@ export default class Slave { skip, supportCodeLibrary: this.supportCodeLibrary, testCase, - worldParameters: this.worldParameters + worldParameters: this.worldParameters, }) await testCaseRunner.run() this.stdout.write(JSON.stringify({ command: commandTypes.READY }) + '\n') @@ -100,7 +100,7 @@ export default class Slave { thisArg: null, timeoutInMilliseconds: hookDefinition.options.timeout || - this.supportCodeLibrary.defaultTimeout + this.supportCodeLibrary.defaultTimeout, }) if (error) { const location = formatLocation(hookDefinition) diff --git a/src/runtime/step_runner.js b/src/runtime/step_runner.js index cb750c96a..8142b3d5c 100644 --- a/src/runtime/step_runner.js +++ b/src/runtime/step_runner.js @@ -12,7 +12,7 @@ async function run({ parameterTypeRegistry, step, stepDefinition, - world + world, }) { beginTiming() let error, result, parameters @@ -23,7 +23,7 @@ async function run({ hookParameter, parameterTypeRegistry, step, - world + world, }) ) } catch (err) { @@ -40,7 +40,7 @@ async function run({ argsArray: parameters, fn: stepDefinition.code, thisArg: world, - timeoutInMilliseconds + timeoutInMilliseconds, }) error = data.error result = data.result diff --git a/src/runtime/test_case_runner.js b/src/runtime/test_case_runner.js index f236ffb6e..7708ddf50 100644 --- a/src/runtime/test_case_runner.js +++ b/src/runtime/test_case_runner.js @@ -11,13 +11,13 @@ export default class TestCaseRunner { skip, testCase, supportCodeLibrary, - worldParameters + worldParameters, }) { const attachmentManager = new AttachmentManager(({ data, media }) => { this.emit('test-step-attachment', { index: this.testStepIndex, data, - media + media, }) }) this.eventBroadcaster = eventBroadcaster @@ -26,18 +26,18 @@ export default class TestCaseRunner { this.supportCodeLibrary = supportCodeLibrary this.world = new supportCodeLibrary.World({ attach: ::attachmentManager.create, - parameters: worldParameters + parameters: worldParameters, }) this.beforeHookDefinitions = this.getBeforeHookDefinitions() this.afterHookDefinitions = this.getAfterHookDefinitions() this.testStepIndex = 0 this.result = { duration: 0, - status: this.skip ? Status.SKIPPED : Status.PASSED + status: this.skip ? Status.SKIPPED : Status.PASSED, } this.testCaseSourceLocation = { uri: this.testCase.uri, - line: this.testCase.pickle.locations[0].line + line: this.testCase.pickle.locations[0].line, } } @@ -60,11 +60,11 @@ export default class TestCaseRunner { this.testCase.pickle.steps.forEach(step => { const actionLocations = this.getStepDefinitions(step).map(definition => ({ uri: definition.uri, - line: definition.line + line: definition.line, })) const sourceLocation = { uri: this.testCase.uri, - line: _.last(step.locations).line + line: _.last(step.locations).line, } const data = { sourceLocation } if (actionLocations.length === 1) { @@ -95,7 +95,7 @@ export default class TestCaseRunner { return this.supportCodeLibrary.stepDefinitions.filter(stepDefinition => stepDefinition.matchesStepName({ stepName: step.text, - parameterTypeRegistry: this.supportCodeLibrary.parameterTypeRegistry + parameterTypeRegistry: this.supportCodeLibrary.parameterTypeRegistry, }) ) } @@ -107,7 +107,7 @@ export default class TestCaseRunner { parameterTypeRegistry: this.supportCodeLibrary.parameterTypeRegistry, step, stepDefinition, - world: this.world + world: this.world, }) } @@ -145,7 +145,7 @@ export default class TestCaseRunner { } this.emit('test-step-finished', { index: this.testStepIndex, - result: testStepResult + result: testStepResult, }) this.testStepIndex += 1 } @@ -155,13 +155,13 @@ export default class TestCaseRunner { this.emit('test-case-started', {}) await this.runHooks(this.beforeHookDefinitions, { sourceLocation: this.testCaseSourceLocation, - pickle: this.testCase.pickle + pickle: this.testCase.pickle, }) await this.runSteps() await this.runHooks(this.afterHookDefinitions, { sourceLocation: this.testCaseSourceLocation, pickle: this.testCase.pickle, - result: this.result + result: this.result, }) this.emit('test-case-finished', { result: this.result }) return this.result @@ -189,7 +189,7 @@ export default class TestCaseRunner { } else if (stepDefinitions.length > 1) { return { exception: getAmbiguousStepException(stepDefinitions), - status: Status.AMBIGUOUS + status: Status.AMBIGUOUS, } } else if (this.isSkippingSteps()) { return { status: Status.SKIPPED } diff --git a/src/runtime/test_case_runner_spec.js b/src/runtime/test_case_runner_spec.js index 931ccac35..2ea3ab834 100644 --- a/src/runtime/test_case_runner_spec.js +++ b/src/runtime/test_case_runner_spec.js @@ -23,9 +23,9 @@ describe('TestCaseRunner', () => { this.testCase = { pickle: { steps: [], - locations: [{ line: 1 }] + locations: [{ line: 1 }], }, - uri: 'path/to/feature' + uri: 'path/to/feature', } this.supportCodeLibrary = { afterTestCaseHookDefinitions: [], @@ -33,7 +33,7 @@ describe('TestCaseRunner', () => { defaultTimeout: 5000, stepDefinitions: [], parameterTypeRegistry: {}, - World() {} + World() {}, } sinon.stub(StepRunner, 'run') }) @@ -49,7 +49,7 @@ describe('TestCaseRunner', () => { eventBroadcaster: this.eventBroadcaster, skip: false, testCase: this.testCase, - supportCodeLibrary: this.supportCodeLibrary + supportCodeLibrary: this.supportCodeLibrary, }) await scenarioRunner.run() }) @@ -58,14 +58,14 @@ describe('TestCaseRunner', () => { expect(this.onTestCasePrepared).to.have.callCount(1) expect(this.onTestCasePrepared).to.have.been.calledWith({ steps: [], - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) it('emits test-case-started', function() { expect(this.onTestCaseStarted).to.have.callCount(1) expect(this.onTestCaseStarted).to.have.been.calledWith({ - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) @@ -73,7 +73,7 @@ describe('TestCaseRunner', () => { expect(this.onTestCaseFinished).to.have.callCount(1) expect(this.onTestCaseFinished).to.have.been.calledWith({ result: { duration: 0, status: Status.PASSED }, - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) }) @@ -83,12 +83,12 @@ describe('TestCaseRunner', () => { this.step = { uri: 'path/to/feature', locations: [{ line: 2 }] } this.stepResult = { duration: 1, - status: Status.PASSED + status: Status.PASSED, } const stepDefinition = { uri: 'path/to/steps', line: 3, - matchesStepName: sinon.stub().returns(true) + matchesStepName: sinon.stub().returns(true), } StepRunner.run.resolves(this.stepResult) this.supportCodeLibrary.stepDefinitions = [stepDefinition] @@ -97,7 +97,7 @@ describe('TestCaseRunner', () => { eventBroadcaster: this.eventBroadcaster, skip: false, testCase: this.testCase, - supportCodeLibrary: this.supportCodeLibrary + supportCodeLibrary: this.supportCodeLibrary, }) await scenarioRunner.run() }) @@ -108,17 +108,17 @@ describe('TestCaseRunner', () => { steps: [ { actionLocation: { line: 3, uri: 'path/to/steps' }, - sourceLocation: { line: 2, uri: 'path/to/feature' } - } + sourceLocation: { line: 2, uri: 'path/to/feature' }, + }, ], - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) it('emits test-case-started', function() { expect(this.onTestCaseStarted).to.have.callCount(1) expect(this.onTestCaseStarted).to.have.been.calledWith({ - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) @@ -126,7 +126,7 @@ describe('TestCaseRunner', () => { expect(this.onTestStepStarted).to.have.callCount(1) expect(this.onTestStepStarted).to.have.been.calledWith({ index: 0, - testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } } + testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, }) }) @@ -135,7 +135,7 @@ describe('TestCaseRunner', () => { expect(this.onTestStepFinished).to.have.been.calledWith({ index: 0, testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, - result: { duration: 1, status: Status.PASSED } + result: { duration: 1, status: Status.PASSED }, }) }) @@ -143,7 +143,7 @@ describe('TestCaseRunner', () => { expect(this.onTestCaseFinished).to.have.callCount(1) expect(this.onTestCaseFinished).to.have.been.calledWith({ result: { duration: 1, status: Status.PASSED }, - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) }) @@ -155,12 +155,12 @@ describe('TestCaseRunner', () => { this.stepResult = { duration: 1, status: Status.FAILED, - exception: this.error + exception: this.error, } const stepDefinition = { uri: 'path/to/steps', line: 3, - matchesStepName: sinon.stub().returns(true) + matchesStepName: sinon.stub().returns(true), } StepRunner.run.resolves(this.stepResult) this.supportCodeLibrary.stepDefinitions = [stepDefinition] @@ -169,7 +169,7 @@ describe('TestCaseRunner', () => { eventBroadcaster: this.eventBroadcaster, skip: false, testCase: this.testCase, - supportCodeLibrary: this.supportCodeLibrary + supportCodeLibrary: this.supportCodeLibrary, }) await scenarioRunner.run() }) @@ -180,17 +180,17 @@ describe('TestCaseRunner', () => { steps: [ { actionLocation: { line: 3, uri: 'path/to/steps' }, - sourceLocation: { line: 2, uri: 'path/to/feature' } - } + sourceLocation: { line: 2, uri: 'path/to/feature' }, + }, ], - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) it('emits test-case-started', function() { expect(this.onTestCaseStarted).to.have.callCount(1) expect(this.onTestCaseStarted).to.have.been.calledWith({ - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) @@ -198,7 +198,7 @@ describe('TestCaseRunner', () => { expect(this.onTestStepStarted).to.have.callCount(1) expect(this.onTestStepStarted).to.have.been.calledWith({ index: 0, - testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } } + testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, }) }) @@ -210,8 +210,8 @@ describe('TestCaseRunner', () => { result: { duration: 1, status: Status.FAILED, - exception: this.error - } + exception: this.error, + }, }) }) @@ -221,9 +221,9 @@ describe('TestCaseRunner', () => { result: { duration: 1, status: Status.FAILED, - exception: this.error + exception: this.error, }, - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) }) @@ -235,24 +235,24 @@ describe('TestCaseRunner', () => { pattern: 'pattern1', uri: 'path/to/steps', line: 3, - matchesStepName: sinon.stub().returns(true) + matchesStepName: sinon.stub().returns(true), } const stepDefinition2 = { pattern: 'pattern2', uri: 'path/to/steps', line: 4, - matchesStepName: sinon.stub().returns(true) + matchesStepName: sinon.stub().returns(true), } this.supportCodeLibrary.stepDefinitions = [ stepDefinition1, - stepDefinition2 + stepDefinition2, ] this.testCase.pickle.steps = [this.step] const scenarioRunner = new TestCaseRunner({ eventBroadcaster: this.eventBroadcaster, skip: false, testCase: this.testCase, - supportCodeLibrary: this.supportCodeLibrary + supportCodeLibrary: this.supportCodeLibrary, }) await scenarioRunner.run() }) @@ -262,17 +262,17 @@ describe('TestCaseRunner', () => { expect(this.onTestCasePrepared).to.have.been.calledWith({ steps: [ { - sourceLocation: { line: 2, uri: 'path/to/feature' } - } + sourceLocation: { line: 2, uri: 'path/to/feature' }, + }, ], - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) it('emits test-case-started', function() { expect(this.onTestCaseStarted).to.have.callCount(1) expect(this.onTestCaseStarted).to.have.been.calledWith({ - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) @@ -280,7 +280,7 @@ describe('TestCaseRunner', () => { expect(this.onTestStepStarted).to.have.callCount(1) expect(this.onTestStepStarted).to.have.been.calledWith({ index: 0, - testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } } + testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, }) }) @@ -294,8 +294,8 @@ describe('TestCaseRunner', () => { 'Multiple step definitions match:\n' + ' pattern1 - path/to/steps:3\n' + ' pattern2 - path/to/steps:4', - status: Status.AMBIGUOUS - } + status: Status.AMBIGUOUS, + }, }) }) @@ -308,9 +308,9 @@ describe('TestCaseRunner', () => { exception: 'Multiple step definitions match:\n' + ' pattern1 - path/to/steps:3\n' + - ' pattern2 - path/to/steps:4' + ' pattern2 - path/to/steps:4', }, - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) }) @@ -323,7 +323,7 @@ describe('TestCaseRunner', () => { eventBroadcaster: this.eventBroadcaster, skip: false, testCase: this.testCase, - supportCodeLibrary: this.supportCodeLibrary + supportCodeLibrary: this.supportCodeLibrary, }) await scenarioRunner.run() }) @@ -332,14 +332,14 @@ describe('TestCaseRunner', () => { expect(this.onTestCasePrepared).to.have.callCount(1) expect(this.onTestCasePrepared).to.have.been.calledWith({ steps: [{ sourceLocation: { line: 2, uri: 'path/to/feature' } }], - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) it('emits test-case-started', function() { expect(this.onTestCaseStarted).to.have.callCount(1) expect(this.onTestCaseStarted).to.have.been.calledWith({ - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) @@ -347,7 +347,7 @@ describe('TestCaseRunner', () => { expect(this.onTestStepStarted).to.have.callCount(1) expect(this.onTestStepStarted).to.have.been.calledWith({ index: 0, - testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } } + testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, }) }) @@ -356,7 +356,7 @@ describe('TestCaseRunner', () => { expect(this.onTestStepFinished).to.have.been.calledWith({ index: 0, testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, - result: { status: Status.UNDEFINED } + result: { status: Status.UNDEFINED }, }) }) @@ -364,7 +364,7 @@ describe('TestCaseRunner', () => { expect(this.onTestCaseFinished).to.have.callCount(1) expect(this.onTestCaseFinished).to.have.been.calledWith({ result: { duration: 0, status: Status.UNDEFINED }, - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) }) @@ -375,7 +375,7 @@ describe('TestCaseRunner', () => { const stepDefinition = { uri: 'path/to/steps', line: 3, - matchesStepName: sinon.stub().returns(true) + matchesStepName: sinon.stub().returns(true), } this.supportCodeLibrary.stepDefinitions = [stepDefinition] this.testCase.pickle.steps = [this.step] @@ -383,7 +383,7 @@ describe('TestCaseRunner', () => { eventBroadcaster: this.eventBroadcaster, skip: true, testCase: this.testCase, - supportCodeLibrary: this.supportCodeLibrary + supportCodeLibrary: this.supportCodeLibrary, }) await scenarioRunner.run() }) @@ -394,17 +394,17 @@ describe('TestCaseRunner', () => { steps: [ { actionLocation: { line: 3, uri: 'path/to/steps' }, - sourceLocation: { line: 2, uri: 'path/to/feature' } - } + sourceLocation: { line: 2, uri: 'path/to/feature' }, + }, ], - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) it('emits test-case-started', function() { expect(this.onTestCaseStarted).to.have.callCount(1) expect(this.onTestCaseStarted).to.have.been.calledWith({ - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) @@ -412,7 +412,7 @@ describe('TestCaseRunner', () => { expect(this.onTestStepStarted).to.have.callCount(1) expect(this.onTestStepStarted).to.have.been.calledWith({ index: 0, - testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } } + testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, }) }) @@ -421,7 +421,7 @@ describe('TestCaseRunner', () => { expect(this.onTestStepFinished).to.have.been.calledWith({ index: 0, testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, - result: { status: Status.SKIPPED } + result: { status: Status.SKIPPED }, }) }) @@ -429,7 +429,7 @@ describe('TestCaseRunner', () => { expect(this.onTestCaseFinished).to.have.callCount(1) expect(this.onTestCaseFinished).to.have.been.calledWith({ result: { duration: 0, status: Status.SKIPPED }, - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) }) @@ -442,16 +442,16 @@ describe('TestCaseRunner', () => { }, line: 4, options: {}, - uri: 'path/to/hooks' + uri: 'path/to/hooks', }) this.supportCodeLibrary.beforeTestCaseHookDefinitions = [ - testCaseHookDefinition + testCaseHookDefinition, ] this.step = { uri: 'path/to/feature', locations: [{ line: 2 }] } const stepDefinition = { uri: 'path/to/steps', line: 3, - matchesStepName: sinon.stub().returns(true) + matchesStepName: sinon.stub().returns(true), } this.supportCodeLibrary.stepDefinitions = [stepDefinition] this.testCase.pickle.steps = [this.step] @@ -459,7 +459,7 @@ describe('TestCaseRunner', () => { eventBroadcaster: this.eventBroadcaster, skip: true, testCase: this.testCase, - supportCodeLibrary: this.supportCodeLibrary + supportCodeLibrary: this.supportCodeLibrary, }) await scenarioRunner.run() }) @@ -471,17 +471,17 @@ describe('TestCaseRunner', () => { { actionLocation: { line: 4, uri: 'path/to/hooks' } }, { actionLocation: { line: 3, uri: 'path/to/steps' }, - sourceLocation: { line: 2, uri: 'path/to/feature' } - } + sourceLocation: { line: 2, uri: 'path/to/feature' }, + }, ], - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) it('emits test-case-started', function() { expect(this.onTestCaseStarted).to.have.callCount(1) expect(this.onTestCaseStarted).to.have.been.calledWith({ - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) @@ -489,11 +489,11 @@ describe('TestCaseRunner', () => { expect(this.onTestStepStarted).to.have.callCount(2) expect(this.onTestStepStarted).to.have.been.calledWith({ index: 0, - testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } } + testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, }) expect(this.onTestStepStarted).to.have.been.calledWith({ index: 1, - testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } } + testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, }) }) @@ -502,12 +502,12 @@ describe('TestCaseRunner', () => { expect(this.onTestStepFinished).to.have.been.calledWith({ index: 0, testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, - result: { status: Status.SKIPPED } + result: { status: Status.SKIPPED }, }) expect(this.onTestStepFinished).to.have.been.calledWith({ index: 1, testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, - result: { status: Status.SKIPPED } + result: { status: Status.SKIPPED }, }) }) @@ -515,7 +515,7 @@ describe('TestCaseRunner', () => { expect(this.onTestCaseFinished).to.have.callCount(1) expect(this.onTestCaseFinished).to.have.been.calledWith({ result: { duration: 0, status: Status.SKIPPED }, - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) }) @@ -528,16 +528,16 @@ describe('TestCaseRunner', () => { }, line: 4, options: {}, - uri: 'path/to/hooks' + uri: 'path/to/hooks', }) this.supportCodeLibrary.afterTestCaseHookDefinitions = [ - testCaseHookDefinition + testCaseHookDefinition, ] this.step = { uri: 'path/to/feature', locations: [{ line: 2 }] } const stepDefinition = { uri: 'path/to/steps', line: 3, - matchesStepName: sinon.stub().returns(true) + matchesStepName: sinon.stub().returns(true), } this.supportCodeLibrary.stepDefinitions = [stepDefinition] this.testCase.pickle.steps = [this.step] @@ -545,7 +545,7 @@ describe('TestCaseRunner', () => { eventBroadcaster: this.eventBroadcaster, skip: true, testCase: this.testCase, - supportCodeLibrary: this.supportCodeLibrary + supportCodeLibrary: this.supportCodeLibrary, }) await scenarioRunner.run() }) @@ -556,18 +556,18 @@ describe('TestCaseRunner', () => { steps: [ { actionLocation: { line: 3, uri: 'path/to/steps' }, - sourceLocation: { line: 2, uri: 'path/to/feature' } + sourceLocation: { line: 2, uri: 'path/to/feature' }, }, - { actionLocation: { line: 4, uri: 'path/to/hooks' } } + { actionLocation: { line: 4, uri: 'path/to/hooks' } }, ], - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) it('emits test-case-started', function() { expect(this.onTestCaseStarted).to.have.callCount(1) expect(this.onTestCaseStarted).to.have.been.calledWith({ - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) @@ -575,11 +575,11 @@ describe('TestCaseRunner', () => { expect(this.onTestStepStarted).to.have.callCount(2) expect(this.onTestStepStarted).to.have.been.calledWith({ index: 0, - testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } } + testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, }) expect(this.onTestStepStarted).to.have.been.calledWith({ index: 1, - testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } } + testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, }) }) @@ -588,12 +588,12 @@ describe('TestCaseRunner', () => { expect(this.onTestStepFinished).to.have.been.calledWith({ index: 0, testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, - result: { status: Status.SKIPPED } + result: { status: Status.SKIPPED }, }) expect(this.onTestStepFinished).to.have.been.calledWith({ index: 1, testCase: { sourceLocation: { line: 1, uri: 'path/to/feature' } }, - result: { status: Status.SKIPPED } + result: { status: Status.SKIPPED }, }) }) @@ -601,7 +601,7 @@ describe('TestCaseRunner', () => { expect(this.onTestCaseFinished).to.have.callCount(1) expect(this.onTestCaseFinished).to.have.been.calledWith({ result: { duration: 0, status: Status.SKIPPED }, - sourceLocation: { line: 1, uri: 'path/to/feature' } + sourceLocation: { line: 1, uri: 'path/to/feature' }, }) }) }) diff --git a/src/status.js b/src/status.js index e37370bd6..428d33197 100644 --- a/src/status.js +++ b/src/status.js @@ -6,7 +6,7 @@ const statuses = { PASSED: 'passed', PENDING: 'pending', SKIPPED: 'skipped', - UNDEFINED: 'undefined' + UNDEFINED: 'undefined', } export default statuses diff --git a/src/status_spec.js b/src/status_spec.js index 6f17534e0..4283b1b10 100644 --- a/src/status_spec.js +++ b/src/status_spec.js @@ -11,7 +11,7 @@ describe('Status', () => { 'PASSED', 'PENDING', 'SKIPPED', - 'UNDEFINED' + 'UNDEFINED', ]) }) }) @@ -25,7 +25,7 @@ describe('Status', () => { [Status.PASSED]: 0, [Status.PENDING]: 0, [Status.SKIPPED]: 0, - [Status.UNDEFINED]: 0 + [Status.UNDEFINED]: 0, }) }) }) diff --git a/src/support_code_library_builder/define_helpers.js b/src/support_code_library_builder/define_helpers.js index ee998e986..f68d0cfd2 100644 --- a/src/support_code_library_builder/define_helpers.js +++ b/src/support_code_library_builder/define_helpers.js @@ -21,13 +21,13 @@ export function defineTestCaseHook(builder, collectionName) { validateArguments({ args: { code, options }, fnName: 'defineTestCaseHook', - location: formatLocation({ line, uri }) + location: formatLocation({ line, uri }), }) const hookDefinition = new TestCaseHookDefinition({ code, line, options, - uri + uri, }) builder.options[collectionName].push(hookDefinition) } @@ -45,13 +45,13 @@ export function defineTestRunHook(builder, collectionName) { validateArguments({ args: { code, options }, fnName: 'defineTestRunHook', - location: formatLocation({ line, uri }) + location: formatLocation({ line, uri }), }) const hookDefinition = new TestRunHookDefinition({ code, line, options, - uri + uri, }) builder.options[collectionName].push(hookDefinition) } @@ -67,14 +67,14 @@ export function defineStep(builder) { validateArguments({ args: { code, pattern, options }, fnName: 'defineStep', - location: formatLocation({ line, uri }) + location: formatLocation({ line, uri }), }) const stepDefinition = new StepDefinition({ code, line, options, pattern, - uri + uri, }) builder.options.stepDefinitions.push(stepDefinition) } @@ -112,7 +112,7 @@ export function defineParameterType(builder) { regexp, transformer, useForSnippets, - preferForRegexpMatch + preferForRegexpMatch, }) => { const getTypeName = deprecate( () => typeName, diff --git a/src/support_code_library_builder/finalize_helpers.js b/src/support_code_library_builder/finalize_helpers.js index 6b647e41a..3d097c2bd 100644 --- a/src/support_code_library_builder/finalize_helpers.js +++ b/src/support_code_library_builder/finalize_helpers.js @@ -6,7 +6,7 @@ import path from 'path' export function wrapDefinitions({ cwd, definitionFunctionWrapper, - definitions + definitions, }) { if (definitionFunctionWrapper) { definitions.forEach(definition => { diff --git a/src/support_code_library_builder/index.js b/src/support_code_library_builder/index.js index 8cd09b27a..e1cd6c875 100644 --- a/src/support_code_library_builder/index.js +++ b/src/support_code_library_builder/index.js @@ -5,7 +5,7 @@ import { defineTestRunHook, defineParameterType, defineTestCaseHook, - defineStep + defineStep, } from './define_helpers' import { wrapDefinitions } from './finalize_helpers' @@ -29,7 +29,7 @@ export class SupportCodeLibraryBuilder { }, setWorldConstructor: fn => { this.options.World = fn - } + }, } this.methods.Given = this.methods.When = this.methods.Then = this.methods.defineStep } @@ -43,11 +43,11 @@ export class SupportCodeLibraryBuilder { 'afterTestRunHook', 'beforeTestCaseHook', 'beforeTestRunHook', - 'step' + 'step', ]) .map(key => this.options[`${key}Definitions`]) .flatten() - .value() + .value(), }) this.options.afterTestCaseHookDefinitions.reverse() this.options.afterTestRunHookDefinitions.reverse() @@ -68,7 +68,7 @@ export class SupportCodeLibraryBuilder { World({ attach, parameters }) { this.attach = attach this.parameters = parameters - } + }, }) } } diff --git a/src/support_code_library_builder/index_spec.js b/src/support_code_library_builder/index_spec.js index bf3b6d74b..8631e0121 100644 --- a/src/support_code_library_builder/index_spec.js +++ b/src/support_code_library_builder/index_spec.js @@ -24,7 +24,7 @@ describe('supportCodeLibraryBuilder', () => { ) const worldInstance = new this.options.World({ attach: this.attachFn, - parameters: { some: 'data' } + parameters: { some: 'data' }, }) expect(worldInstance.attach).to.eql(this.attachFn) expect(worldInstance.parameters).to.eql({ some: 'data' }) diff --git a/src/support_code_library_builder/validate_arguments.js b/src/support_code_library_builder/validate_arguments.js index 26e6437a0..c3772d7da 100644 --- a/src/support_code_library_builder/validate_arguments.js +++ b/src/support_code_library_builder/validate_arguments.js @@ -4,7 +4,7 @@ const optionsValidation = { expectedType: 'object or function', predicate({ options }) { return _.isPlainObject(options) - } + }, } const optionsTimeoutValidation = { @@ -12,21 +12,21 @@ const optionsTimeoutValidation = { expectedType: 'integer', predicate({ options }) { return !options.timeout || _.isInteger(options.timeout) - } + }, } const fnValidation = { expectedType: 'function', predicate({ code }) { return _.isFunction(code) - } + }, } const validations = { defineTestRunHook: [ { identifier: 'first argument', ...optionsValidation }, optionsTimeoutValidation, - { identifier: 'second argument', ...fnValidation } + { identifier: 'second argument', ...fnValidation }, ], defineTestCaseHook: [ { identifier: 'first argument', ...optionsValidation }, @@ -35,10 +35,10 @@ const validations = { expectedType: 'string', predicate({ options }) { return !options.tags || _.isString(options.tags) - } + }, }, optionsTimeoutValidation, - { identifier: 'second argument', ...fnValidation } + { identifier: 'second argument', ...fnValidation }, ], defineStep: [ { @@ -46,12 +46,12 @@ const validations = { expectedType: 'string or regular expression', predicate({ pattern }) { return _.isRegExp(pattern) || _.isString(pattern) - } + }, }, { identifier: 'second argument', ...optionsValidation }, optionsTimeoutValidation, - { identifier: 'third argument', ...fnValidation } - ] + { identifier: 'third argument', ...fnValidation }, + ], } export default function validateArguments({ args, fnName, location }) { diff --git a/src/time.js b/src/time.js index 2583d7f56..d0f11538d 100644 --- a/src/time.js +++ b/src/time.js @@ -11,7 +11,7 @@ const methods = { return getTimestamp() - previousTimestamp }, setInterval: setInterval.bind(global), - setTimeout: setTimeout.bind(global) + setTimeout: setTimeout.bind(global), } if (typeof setImmediate !== 'undefined') { diff --git a/src/user_code_runner.js b/src/user_code_runner.js index c4dd2f8d6..f03477302 100644 --- a/src/user_code_runner.js +++ b/src/user_code_runner.js @@ -33,7 +33,7 @@ export default class UserCodeRunner { 'function uses multiple asynchronous interfaces: callback and promise\n' + 'to use the callback interface: do not return a promise\n' + 'to use the promise interface: remove the last argument to the function' - ) + ), } } else if (callbackInterface) { racingPromises.push(callbackPromise) diff --git a/src/user_code_runner_spec.js b/src/user_code_runner_spec.js index d5f65cc12..08759111e 100644 --- a/src/user_code_runner_spec.js +++ b/src/user_code_runner_spec.js @@ -9,7 +9,7 @@ describe('UserCodeRunner', () => { this.options = { argsArray: [], thisArg: {}, - timeoutInMilliseconds: 100 + timeoutInMilliseconds: 100, } })