diff --git a/.eslintrc.yml b/.eslintrc.yml index 669fe0987..1855f4c79 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -24,4 +24,6 @@ rules: "@typescript-eslint/no-inferrable-types": off "@typescript-eslint/no-empty-function": off "@typescript-eslint/ban-types": off - "@typescript-eslint/no-unused-vars": off \ No newline at end of file + "@typescript-eslint/no-unused-vars": off + "simple-import-sort/imports": "error" + "simple-import-sort/exports": "error" \ No newline at end of file diff --git a/compatibility/cck_spec.ts b/compatibility/cck_spec.ts index 0f5f0dbce..8f4203a6d 100644 --- a/compatibility/cck_spec.ts +++ b/compatibility/cck_spec.ts @@ -1,19 +1,20 @@ -import { describe, it } from 'mocha' +import * as messageStreams from '@cucumber/message-streams' +import * as messages from '@cucumber/messages' import { config, expect, use } from 'chai' import chaiExclude from 'chai-exclude' -import glob from 'glob' import fs from 'fs' +import glob from 'glob' +import { describe, it } from 'mocha' import path from 'path' import { PassThrough, pipeline, Writable } from 'stream' -import { Cli } from '../src' import toString from 'stream-to-string' +import util from 'util' + import { ignorableKeys, normalizeMessageOutput, } from '../features/support/formatter_output_helpers' -import * as messages from '@cucumber/messages' -import * as messageStreams from '@cucumber/message-streams' -import util from 'util' +import { Cli } from '../src' const asyncPipeline = util.promisify(pipeline) const PROJECT_PATH = path.join(__dirname, '..') diff --git a/compatibility/features/attachments/attachments.ts b/compatibility/features/attachments/attachments.ts index 4d130baa4..ff3ed40fc 100644 --- a/compatibility/features/attachments/attachments.ts +++ b/compatibility/features/attachments/attachments.ts @@ -1,7 +1,8 @@ -import { Before, When, World } from '../../../src' -import { ReadableStreamBuffer } from 'stream-buffers' import fs from 'fs' import path from 'path' +import { ReadableStreamBuffer } from 'stream-buffers' + +import { Before, When, World } from '../../../src' Before((): void => undefined) diff --git a/compatibility/features/data-tables/data-tables.ts b/compatibility/features/data-tables/data-tables.ts index e901273fa..72064d75a 100644 --- a/compatibility/features/data-tables/data-tables.ts +++ b/compatibility/features/data-tables/data-tables.ts @@ -1,6 +1,7 @@ -import { When, Then, DataTable } from '../../../src' import { expect } from 'chai' +import { DataTable, Then, When } from '../../../src' + When( 'the following table is transposed:', function (this: any, table: DataTable) { diff --git a/compatibility/features/examples-tables/examples-tables.ts b/compatibility/features/examples-tables/examples-tables.ts index e259bd958..e8c6a8295 100644 --- a/compatibility/features/examples-tables/examples-tables.ts +++ b/compatibility/features/examples-tables/examples-tables.ts @@ -1,5 +1,6 @@ import assert from 'assert' -import { Given, When, Then } from '../../../src' + +import { Given, Then, When } from '../../../src' Given('there are {int} cucumbers', function (this: any, initialCount: number) { this.count = initialCount diff --git a/compatibility/features/hooks/hooks.ts b/compatibility/features/hooks/hooks.ts index 1ce001c6f..8ffdd41aa 100644 --- a/compatibility/features/hooks/hooks.ts +++ b/compatibility/features/hooks/hooks.ts @@ -1,7 +1,8 @@ -import { When, Before, After, World } from '../../../src' import fs from 'fs' import path from 'path' +import { After, Before, When, World } from '../../../src' + Before(function () { // no-op }) diff --git a/compatibility/features/markdown/markdown.ts b/compatibility/features/markdown/markdown.ts index 8731e3682..c1dd4c941 100644 --- a/compatibility/features/markdown/markdown.ts +++ b/compatibility/features/markdown/markdown.ts @@ -1,5 +1,6 @@ import assert from 'assert' -import { Given, DataTable, Then, When, World } from '../../../src' + +import { DataTable, Given, Then, When, World } from '../../../src' Given('some TypeScript code:', function (dataTable: DataTable) { assert(dataTable) diff --git a/compatibility/features/minimal/minimal.ts b/compatibility/features/minimal/minimal.ts index bccc4f289..0f726e893 100644 --- a/compatibility/features/minimal/minimal.ts +++ b/compatibility/features/minimal/minimal.ts @@ -1,4 +1,5 @@ import assert from 'assert' + import { Given } from '../../../src' Given('I have {int} cukes in my belly', function (cukeCount: number) { diff --git a/compatibility/features/parameter-types/parameter-types.ts b/compatibility/features/parameter-types/parameter-types.ts index 8a5a57ed1..0147362c2 100644 --- a/compatibility/features/parameter-types/parameter-types.ts +++ b/compatibility/features/parameter-types/parameter-types.ts @@ -1,6 +1,7 @@ -import { Given, defineParameterType } from '../../../src' import { expect } from 'chai' +import { defineParameterType, Given } from '../../../src' + class Flight { constructor(public readonly from: string, public readonly to: string) {} } diff --git a/compatibility/features/rules/rules.ts b/compatibility/features/rules/rules.ts index 629a15b34..3b90e0ef7 100644 --- a/compatibility/features/rules/rules.ts +++ b/compatibility/features/rules/rules.ts @@ -1,5 +1,6 @@ import assert from 'assert' -import { Given, When, Then } from '../../../src' + +import { Given, Then, When } from '../../../src' Given( 'there are {int} {float} coins inside', diff --git a/features/step_definitions/cli_steps.ts b/features/step_definitions/cli_steps.ts index 3735f1866..432bee228 100644 --- a/features/step_definitions/cli_steps.ts +++ b/features/step_definitions/cli_steps.ts @@ -1,13 +1,14 @@ -import { DataTable, Then, When } from '../../' import { expect } from 'chai' -import { normalizeText } from '../support/helpers' -import stringArgv from 'string-argv' import Mustache from 'mustache' +import stringArgv from 'string-argv' + +import { DataTable, Then, When } from '../../' import { doesHaveValue, doesNotHaveValue, valueOrDefault, } from '../../src/value_checker' +import { normalizeText } from '../support/helpers' import { World } from '../support/world' const { version } = require('../../package.json') // eslint-disable-line @typescript-eslint/no-var-requires diff --git a/features/step_definitions/file_steps.ts b/features/step_definitions/file_steps.ts index e671ac05c..ea667e09e 100644 --- a/features/step_definitions/file_steps.ts +++ b/features/step_definitions/file_steps.ts @@ -1,10 +1,11 @@ -import { Given, Then } from '../../' import { expect } from 'chai' -import { normalizeText } from '../support/helpers' -import fs from 'mz/fs' import fsExtra from 'fs-extra' -import path from 'path' import Mustache from 'mustache' +import fs from 'mz/fs' +import path from 'path' + +import { Given, Then } from '../../' +import { normalizeText } from '../support/helpers' import { World } from '../support/world' Given( diff --git a/features/step_definitions/formatter_steps.ts b/features/step_definitions/formatter_steps.ts index f4bc18b7a..667e1cd40 100644 --- a/features/step_definitions/formatter_steps.ts +++ b/features/step_definitions/formatter_steps.ts @@ -1,14 +1,15 @@ -import { Then } from '../../' import { expect, use } from 'chai' import chaiExclude from 'chai-exclude' +import fs from 'mz/fs' +import path from 'path' + +import { Then } from '../../' import { ignorableKeys, normalizeJsonOutput, normalizeMessageOutput, stripMetaMessages, } from '../support/formatter_output_helpers' -import fs from 'mz/fs' -import path from 'path' import { World } from '../support/world' use(chaiExclude) diff --git a/features/step_definitions/message_steps.ts b/features/step_definitions/message_steps.ts index b4b7c0eb2..9712b73c2 100644 --- a/features/step_definitions/message_steps.ts +++ b/features/step_definitions/message_steps.ts @@ -1,5 +1,8 @@ -import { Then } from '../../' +import * as messages from '@cucumber/messages' import { expect } from 'chai' +import semver from 'semver' + +import { Then } from '../../' import DataTable from '../../src/models/data_table' import { getPickleNamesInOrderOfExecution, @@ -9,9 +12,7 @@ import { getTestStepAttachmentsForStep, getTestStepResults, } from '../support/message_helpers' -import * as messages from '@cucumber/messages' import { World } from '../support/world' -import semver from 'semver' const ENCODING_MAP: { [key: string]: messages.AttachmentContentEncoding } = { IDENTITY: messages.AttachmentContentEncoding.IDENTITY, diff --git a/features/step_definitions/report_server_steps.ts b/features/step_definitions/report_server_steps.ts index 2a675c436..3c89c88a5 100644 --- a/features/step_definitions/report_server_steps.ts +++ b/features/step_definitions/report_server_steps.ts @@ -1,9 +1,10 @@ -import { Given, Then, DataTable } from '../..' -import { World } from '../support/world' +import assert from 'assert' import { expect } from 'chai' import { URL } from 'url' + +import { DataTable, Given, Then } from '../..' import FakeReportServer from '../../test/fake_report_server' -import assert from 'assert' +import { World } from '../support/world' Given( 'a report server is running on {string}', diff --git a/features/step_definitions/usage_json_steps.ts b/features/step_definitions/usage_json_steps.ts index 1a559d1d9..c1e0b1860 100644 --- a/features/step_definitions/usage_json_steps.ts +++ b/features/step_definitions/usage_json_steps.ts @@ -1,8 +1,9 @@ -import { DataTable, Then } from '../../' import { expect } from 'chai' import path from 'path' -import { World } from '../support/world' + +import { DataTable, Then } from '../../' import { IUsage } from '../../src/formatter/helpers/usage_helpers' +import { World } from '../support/world' Then('it outputs the usage data:', function (this: World, table: DataTable) { const usageData: IUsage[] = JSON.parse(this.lastRun.output) diff --git a/features/support/formatter_output_helpers.ts b/features/support/formatter_output_helpers.ts index f33da9ff3..4b6c2a798 100644 --- a/features/support/formatter_output_helpers.ts +++ b/features/support/formatter_output_helpers.ts @@ -1,14 +1,15 @@ -import { - doesHaveValue, - doesNotHaveValue, - valueOrDefault, -} from '../../src/value_checker' +import * as messages from '@cucumber/messages' + import { IJsonFeature, IJsonScenario, IJsonStep, } from '../../src/formatter/json_formatter' -import * as messages from '@cucumber/messages' +import { + doesHaveValue, + doesNotHaveValue, + valueOrDefault, +} from '../../src/value_checker' // Converting windows stack trace to posix and removing cwd // C:\\project\\path\\features\\support/code.js diff --git a/features/support/helpers.ts b/features/support/helpers.ts index a17b1dc57..67ea4ac22 100644 --- a/features/support/helpers.ts +++ b/features/support/helpers.ts @@ -1,5 +1,6 @@ -import path from 'path' import figures from 'figures' +import path from 'path' + import { normalizeSummaryDuration } from '../../test/formatter_helpers' export function normalizeText(text: string): string { diff --git a/features/support/hooks.ts b/features/support/hooks.ts index 686822fbf..7b082d6e5 100644 --- a/features/support/hooks.ts +++ b/features/support/hooks.ts @@ -1,12 +1,13 @@ -import { After, Before, formatterHelpers } from '../../' import fs from 'fs' import fsExtra from 'fs-extra' import path from 'path' import tmp from 'tmp' -import { doesHaveValue } from '../../src/value_checker' -import { World } from './world' + +import { After, Before, formatterHelpers } from '../../' import { ITestCaseHookParameter } from '../../src/support_code_library_builder/types' +import { doesHaveValue } from '../../src/value_checker' import { warnUserAboutEnablingDeveloperMode } from './warn_user_about_enabling_developer_mode' +import { World } from './world' const projectPath = path.join(__dirname, '..', '..') diff --git a/features/support/message_helpers.ts b/features/support/message_helpers.ts index 8fd545675..5ebed27d4 100644 --- a/features/support/message_helpers.ts +++ b/features/support/message_helpers.ts @@ -1,13 +1,14 @@ +import * as messages from '@cucumber/messages' +import { getWorstTestStepResult } from '@cucumber/messages' +import { Query } from '@cucumber/query' +import util from 'util' + import { getGherkinStepMap } from '../../src/formatter/helpers/gherkin_document_parser' import { getPickleStepMap, getStepKeyword, } from '../../src/formatter/helpers/pickle_parser' -import util from 'util' -import * as messages from '@cucumber/messages' -import { Query } from '@cucumber/query' import { doesHaveValue, doesNotHaveValue } from '../../src/value_checker' -import { getWorstTestStepResult } from '@cucumber/messages' export interface IStepTextAndResult { text: string diff --git a/features/support/warn_user_about_enabling_developer_mode.ts b/features/support/warn_user_about_enabling_developer_mode.ts index 9afcd37a7..da9ee6c39 100644 --- a/features/support/warn_user_about_enabling_developer_mode.ts +++ b/features/support/warn_user_about_enabling_developer_mode.ts @@ -1,5 +1,5 @@ -import { reindent } from 'reindent-template-literals' import colors from 'colors/safe' +import { reindent } from 'reindent-template-literals' export function warnUserAboutEnablingDeveloperMode(error: any): void { if (!(error?.code === 'EPERM')) { diff --git a/features/support/world.ts b/features/support/world.ts index 6b908df7a..66b02e485 100644 --- a/features/support/world.ts +++ b/features/support/world.ts @@ -1,17 +1,18 @@ -import { Cli, setWorldConstructor } from '../../' -import { execFile } from 'child_process' +import * as messageStreams from '@cucumber/message-streams' +import * as messages from '@cucumber/messages' import { expect } from 'chai' -import toString from 'stream-to-string' -import { PassThrough, pipeline, Writable } from 'stream' +import { execFile } from 'child_process' import colors from 'colors/safe' import fs from 'fs' import path from 'path' +import { PassThrough, pipeline, Writable } from 'stream' +import toString from 'stream-to-string' +import util from 'util' import VError from 'verror' -import * as messages from '@cucumber/messages' -import * as messageStreams from '@cucumber/message-streams' -import FakeReportServer from '../../test/fake_report_server' + +import { Cli, setWorldConstructor } from '../../' import { doesHaveValue } from '../../src/value_checker' -import util from 'util' +import FakeReportServer from '../../test/fake_report_server' const asyncPipeline = util.promisify(pipeline) diff --git a/src/cli/argv_parser.ts b/src/cli/argv_parser.ts index 0519a7a1d..11588e87d 100644 --- a/src/cli/argv_parser.ts +++ b/src/cli/argv_parser.ts @@ -1,8 +1,9 @@ +import { dialects } from '@cucumber/gherkin' import { Command } from 'commander' import path from 'path' -import { dialects } from '@cucumber/gherkin' -import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax' + import Formatters from '../formatter/helpers/formatters' +import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax' // Using require instead of import so compiled typescript will have the desired folder structure const { version } = require('../../package.json') // eslint-disable-line @typescript-eslint/no-var-requires diff --git a/src/cli/configuration_builder.ts b/src/cli/configuration_builder.ts index 384a3da67..9a550f972 100644 --- a/src/cli/configuration_builder.ts +++ b/src/cli/configuration_builder.ts @@ -1,15 +1,16 @@ -import ArgvParser, { - IParsedArgvFormatOptions, - IParsedArgvOptions, -} from './argv_parser' +import glob from 'glob' import fs from 'mz/fs' import path from 'path' -import OptionSplitter from './option_splitter' -import glob from 'glob' import { promisify } from 'util' + import { IPickleFilterOptions } from '../pickle_filter' import { IRuntimeOptions } from '../runtime' import { valueOrDefault } from '../value_checker' +import ArgvParser, { + IParsedArgvFormatOptions, + IParsedArgvOptions, +} from './argv_parser' +import OptionSplitter from './option_splitter' export interface IConfigurationFormat { outputTo: string diff --git a/src/cli/configuration_builder_spec.ts b/src/cli/configuration_builder_spec.ts index b2b8a0111..db16493d6 100644 --- a/src/cli/configuration_builder_spec.ts +++ b/src/cli/configuration_builder_spec.ts @@ -1,11 +1,12 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' -import ConfigurationBuilder from './configuration_builder' import fsExtra from 'fs-extra' +import { describe, it } from 'mocha' import path from 'path' import tmp, { DirOptions } from 'tmp' import { promisify } from 'util' + import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax' +import ConfigurationBuilder from './configuration_builder' async function buildTestWorkingDirectory(): Promise { const cwd = await promisify(tmp.dir)({ diff --git a/src/cli/helpers.ts b/src/cli/helpers.ts index 9c53f9168..e9afb887a 100644 --- a/src/cli/helpers.ts +++ b/src/cli/helpers.ts @@ -1,19 +1,20 @@ -import ArgvParser from './argv_parser' -import ProfileLoader from './profile_loader' -import shuffle from 'knuth-shuffle-seeded' -import { EventEmitter } from 'events' -import PickleFilter from '../pickle_filter' -import { EventDataCollector } from '../formatter/helpers' -import { doesHaveValue } from '../value_checker' -import OptionSplitter from './option_splitter' -import { Readable } from 'stream' +import createMeta from '@cucumber/create-meta' import { IdGenerator } from '@cucumber/messages' import * as messages from '@cucumber/messages' -import createMeta from '@cucumber/create-meta' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import { EventEmitter } from 'events' +import shuffle from 'knuth-shuffle-seeded' +import { Readable } from 'stream' + +import { EventDataCollector } from '../formatter/helpers' import TestCaseHookDefinition from '../models/test_case_hook_definition' import TestRunHookDefinition from '../models/test_run_hook_definition' +import PickleFilter from '../pickle_filter' import { builtinParameterTypes } from '../support_code_library_builder' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import { doesHaveValue } from '../value_checker' +import ArgvParser from './argv_parser' +import OptionSplitter from './option_splitter' +import ProfileLoader from './profile_loader' export interface IGetExpandedArgvRequest { argv: string[] diff --git a/src/cli/helpers_spec.ts b/src/cli/helpers_spec.ts index f4200b536..2477c0583 100644 --- a/src/cli/helpers_spec.ts +++ b/src/cli/helpers_spec.ts @@ -1,28 +1,29 @@ -import { describe, it } from 'mocha' -import { expect } from 'chai' -import { - emitMetaMessage, - emitSupportCodeMessages, - isJavaScript, - parseGherkinMessageStream, -} from './helpers' -import { EventEmitter } from 'events' -import PickleFilter from '../pickle_filter' -import * as messages from '@cucumber/messages' -import { IdGenerator, SourceMediaType } from '@cucumber/messages' -import { EventDataCollector } from '../formatter/helpers' -import { GherkinStreams } from '@cucumber/gherkin-streams' -import { Readable } from 'stream' -import StepDefinition from '../models/step_definition' import { CucumberExpression, ParameterType, ParameterTypeRegistry, RegularExpression, } from '@cucumber/cucumber-expressions' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import { GherkinStreams } from '@cucumber/gherkin-streams' +import * as messages from '@cucumber/messages' +import { IdGenerator, SourceMediaType } from '@cucumber/messages' +import { expect } from 'chai' +import { EventEmitter } from 'events' +import { describe, it } from 'mocha' +import { Readable } from 'stream' + +import { EventDataCollector } from '../formatter/helpers' +import StepDefinition from '../models/step_definition' import TestCaseHookDefinition from '../models/test_case_hook_definition' import TestRunHookDefinition from '../models/test_run_hook_definition' +import PickleFilter from '../pickle_filter' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import { + emitMetaMessage, + emitSupportCodeMessages, + isJavaScript, + parseGherkinMessageStream, +} from './helpers' const noopFunction = (): void => { // no code diff --git a/src/cli/i18n.ts b/src/cli/i18n.ts index be243e9a1..8366c9b00 100644 --- a/src/cli/i18n.ts +++ b/src/cli/i18n.ts @@ -1,6 +1,6 @@ import { dialects } from '@cucumber/gherkin' -import Table from 'cli-table3' import { capitalCase } from 'capital-case' +import Table from 'cli-table3' const keywords = [ 'feature', diff --git a/src/cli/index.ts b/src/cli/index.ts index bd5488e60..81d6d3a7a 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,4 +1,28 @@ +import { GherkinStreams } from '@cucumber/gherkin-streams' +import { IdGenerator } from '@cucumber/messages' +import { EventEmitter } from 'events' +import fs from 'mz/fs' +import path from 'path' +import { Writable } from 'stream' +import { WriteStream as TtyWriteStream } from 'tty' +import { pathToFileURL } from 'url' +import { promisify } from 'util' + +import Formatter, { IFormatterStream } from '../formatter' +import FormatterBuilder from '../formatter/builder' import { EventDataCollector } from '../formatter/helpers' +import HttpStream from '../formatter/http_stream' +import PickleFilter from '../pickle_filter' +import Runtime from '../runtime' +import ParallelRuntimeCoordinator from '../runtime/parallel/coordinator' +import supportCodeLibraryBuilder from '../support_code_library_builder' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import { doesNotHaveValue } from '../value_checker' +import { IParsedArgvFormatOptions } from './argv_parser' +import ConfigurationBuilder, { + IConfiguration, + IConfigurationFormat, +} from './configuration_builder' import { emitMetaMessage, emitSupportCodeMessages, @@ -6,31 +30,8 @@ import { isJavaScript, parseGherkinMessageStream, } from './helpers' -import { validateInstall } from './install_validator' import * as I18n from './i18n' -import ConfigurationBuilder, { - IConfiguration, - IConfigurationFormat, -} from './configuration_builder' -import { EventEmitter } from 'events' -import FormatterBuilder from '../formatter/builder' -import fs from 'mz/fs' -import path from 'path' -import PickleFilter from '../pickle_filter' -import ParallelRuntimeCoordinator from '../runtime/parallel/coordinator' -import Runtime from '../runtime' -import supportCodeLibraryBuilder from '../support_code_library_builder' -import { IdGenerator } from '@cucumber/messages' -import Formatter, { IFormatterStream } from '../formatter' -import { WriteStream as TtyWriteStream } from 'tty' -import { doesNotHaveValue } from '../value_checker' -import { GherkinStreams } from '@cucumber/gherkin-streams' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' -import { IParsedArgvFormatOptions } from './argv_parser' -import HttpStream from '../formatter/http_stream' -import { promisify } from 'util' -import { Writable } from 'stream' -import { pathToFileURL } from 'url' +import { validateInstall } from './install_validator' // eslint-disable-next-line @typescript-eslint/no-var-requires const { importer } = require('../importer') diff --git a/src/cli/option_splitter_spec.ts b/src/cli/option_splitter_spec.ts index 19ec75c93..ec267cc0a 100644 --- a/src/cli/option_splitter_spec.ts +++ b/src/cli/option_splitter_spec.ts @@ -1,5 +1,6 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' +import { describe, it } from 'mocha' + import OptionSplitter from './option_splitter' describe('OptionSplitter', () => { diff --git a/src/cli/profile_loader.ts b/src/cli/profile_loader.ts index 8cd97d499..e03c10c45 100644 --- a/src/cli/profile_loader.ts +++ b/src/cli/profile_loader.ts @@ -1,6 +1,7 @@ import fs from 'mz/fs' import path from 'path' import stringArgv from 'string-argv' + import { doesHaveValue, doesNotHaveValue } from '../value_checker' const DEFAULT_FILENAMES = ['cucumber.cjs', 'cucumber.js'] diff --git a/src/cli/profile_loader_spec.ts b/src/cli/profile_loader_spec.ts index fcbe4c035..019c669d7 100644 --- a/src/cli/profile_loader_spec.ts +++ b/src/cli/profile_loader_spec.ts @@ -1,11 +1,12 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' +import { describe, it } from 'mocha' import fs from 'mz/fs' import path from 'path' -import ProfileLoader from './profile_loader' import tmp, { DirOptions } from 'tmp' import { promisify } from 'util' + import { doesHaveValue, valueOrDefault } from '../value_checker' +import ProfileLoader from './profile_loader' interface TestProfileLoaderOptions { definitionsFileContent?: string diff --git a/src/cli/publish_banner.ts b/src/cli/publish_banner.ts index 788abaefd..ff1a7aa81 100644 --- a/src/cli/publish_banner.ts +++ b/src/cli/publish_banner.ts @@ -1,5 +1,5 @@ -import colors from 'colors/safe' import Table from 'cli-table3' +import colors from 'colors/safe' const underlineBoldCyan = (x: string): string => colors.underline(colors.bold(colors.cyan(x))) diff --git a/src/cli/run.ts b/src/cli/run.ts index c2253d0f2..d9f2eae03 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -1,5 +1,6 @@ -import Cli, { ICliRunResult } from './' import VError from 'verror' + +import Cli, { ICliRunResult } from './' import publishBanner from './publish_banner' function exitWithError(error: Error): void { diff --git a/src/formatter/builder.ts b/src/formatter/builder.ts index fcb20f5ff..98f2999dc 100644 --- a/src/formatter/builder.ts +++ b/src/formatter/builder.ts @@ -1,17 +1,18 @@ -import getColorFns from './get_color_fns' -import JavascriptSnippetSyntax from './step_definition_snippet_builder/javascript_snippet_syntax' +import { EventEmitter } from 'events' import path from 'path' -import StepDefinitionSnippetBuilder from './step_definition_snippet_builder' +import { Writable as WritableStream } from 'stream' +import { pathToFileURL } from 'url' + +import { IParsedArgvFormatOptions } from '../cli/argv_parser' import { ISupportCodeLibrary } from '../support_code_library_builder/types' -import Formatter, { IFormatterCleanupFn, IFormatterLogFn } from '.' import { doesHaveValue, doesNotHaveValue } from '../value_checker' -import { EventEmitter } from 'events' +import Formatter, { IFormatterCleanupFn, IFormatterLogFn } from '.' +import getColorFns from './get_color_fns' import EventDataCollector from './helpers/event_data_collector' -import { Writable as WritableStream } from 'stream' -import { IParsedArgvFormatOptions } from '../cli/argv_parser' -import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax' -import { pathToFileURL } from 'url' import Formatters from './helpers/formatters' +import StepDefinitionSnippetBuilder from './step_definition_snippet_builder' +import JavascriptSnippetSyntax from './step_definition_snippet_builder/javascript_snippet_syntax' +import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax' // eslint-disable-next-line @typescript-eslint/no-var-requires const { importer } = require('../importer') diff --git a/src/formatter/get_color_fns.ts b/src/formatter/get_color_fns.ts index d0a9453ef..6e77b3d31 100644 --- a/src/formatter/get_color_fns.ts +++ b/src/formatter/get_color_fns.ts @@ -1,5 +1,5 @@ -import colors from 'colors/safe' import { TestStepResultStatus } from '@cucumber/messages' +import colors from 'colors/safe' colors.enable() diff --git a/src/formatter/helpers/event_data_collector.ts b/src/formatter/helpers/event_data_collector.ts index d976d1417..6332d225a 100644 --- a/src/formatter/helpers/event_data_collector.ts +++ b/src/formatter/helpers/event_data_collector.ts @@ -1,7 +1,8 @@ import * as messages from '@cucumber/messages' -import { doesHaveValue, doesNotHaveValue } from '../../value_checker' import { EventEmitter } from 'events' +import { doesHaveValue, doesNotHaveValue } from '../../value_checker' + interface ITestCaseAttemptData { attempt: number willBeRetried: boolean diff --git a/src/formatter/helpers/formatters.ts b/src/formatter/helpers/formatters.ts index d5a2698f5..632e45b14 100644 --- a/src/formatter/helpers/formatters.ts +++ b/src/formatter/helpers/formatters.ts @@ -1,4 +1,5 @@ import Formatter from '../.' +import HtmlFormatter from '../html_formatter' import JsonFormatter from '../json_formatter' import MessageFormatter from '../message_formatter' import ProgressBarFormatter from '../progress_bar_formatter' @@ -8,7 +9,6 @@ import SnippetsFormatter from '../snippets_formatter' import SummaryFormatter from '../summary_formatter' import UsageFormatter from '../usage_formatter' import UsageJsonFormatter from '../usage_json_formatter' -import HtmlFormatter from '../html_formatter' const Formatters = { getFormatters(): Record { diff --git a/src/formatter/helpers/gherkin_document_parser.ts b/src/formatter/helpers/gherkin_document_parser.ts index 8b4763181..eae374bf6 100644 --- a/src/formatter/helpers/gherkin_document_parser.ts +++ b/src/formatter/helpers/gherkin_document_parser.ts @@ -1,4 +1,5 @@ import * as messages from '@cucumber/messages' + import { doesHaveValue } from '../../value_checker' export function getGherkinStepMap( diff --git a/src/formatter/helpers/gherkin_document_parser_spec.ts b/src/formatter/helpers/gherkin_document_parser_spec.ts index 8bea18ee7..b63007778 100644 --- a/src/formatter/helpers/gherkin_document_parser_spec.ts +++ b/src/formatter/helpers/gherkin_document_parser_spec.ts @@ -1,16 +1,17 @@ -import { describe, it } from 'mocha' +import * as messages from '@cucumber/messages' import { expect } from 'chai' +import { describe, it } from 'mocha' + +import { + IParsedSourceWithEnvelopes, + parse, +} from '../../../test/gherkin_helpers' import { getGherkinExampleRuleMap, getGherkinScenarioLocationMap, getGherkinScenarioMap, getGherkinStepMap, } from './gherkin_document_parser' -import { - IParsedSourceWithEnvelopes, - parse, -} from '../../../test/gherkin_helpers' -import * as messages from '@cucumber/messages' import IGherkinDocument = messages.GherkinDocument import { reindent } from 'reindent-template-literals' diff --git a/src/formatter/helpers/index.ts b/src/formatter/helpers/index.ts index f7f430ded..4f363ab03 100644 --- a/src/formatter/helpers/index.ts +++ b/src/formatter/helpers/index.ts @@ -1,11 +1,11 @@ import * as GherkinDocumentParser from './gherkin_document_parser' import * as PickleParser from './pickle_parser' -export { parseTestCaseAttempt } from './test_case_attempt_parser' export { default as EventDataCollector } from './event_data_collector' -export { KeywordType, getStepKeywordType } from './keyword_type' -export { formatIssue, isWarning, isFailure, isIssue } from './issue_helpers' +export { formatIssue, isFailure, isIssue, isWarning } from './issue_helpers' +export { getStepKeywordType, KeywordType } from './keyword_type' export { formatLocation } from './location_helpers' export { formatSummary } from './summary_helpers' +export { parseTestCaseAttempt } from './test_case_attempt_parser' export { getUsage } from './usage_helpers' export { GherkinDocumentParser, PickleParser } diff --git a/src/formatter/helpers/issue_helpers.ts b/src/formatter/helpers/issue_helpers.ts index 02fa6f419..dead022eb 100644 --- a/src/formatter/helpers/issue_helpers.ts +++ b/src/formatter/helpers/issue_helpers.ts @@ -1,10 +1,11 @@ -import indentString from 'indent-string' -import { formatTestCaseAttempt } from './test_case_attempt_formatter' import * as messages from '@cucumber/messages' +import indentString from 'indent-string' + +import { ISupportCodeLibrary } from '../../support_code_library_builder/types' import { IColorFns } from '../get_color_fns' import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder' -import { ISupportCodeLibrary } from '../../support_code_library_builder/types' import { ITestCaseAttempt } from './event_data_collector' +import { formatTestCaseAttempt } from './test_case_attempt_formatter' export function isFailure( result: messages.TestStepResult, diff --git a/src/formatter/helpers/issue_helpers_spec.ts b/src/formatter/helpers/issue_helpers_spec.ts index f60cfed10..86bc2cd41 100644 --- a/src/formatter/helpers/issue_helpers_spec.ts +++ b/src/formatter/helpers/issue_helpers_spec.ts @@ -1,12 +1,13 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' -import getColorFns from '../get_color_fns' -import { formatIssue } from './issue_helpers' import figures from 'figures' -import { getTestCaseAttempts } from '../../../test/formatter_helpers' +import { describe, it } from 'mocha' import { reindent } from 'reindent-template-literals' + import { getBaseSupportCodeLibrary } from '../../../test/fixtures/steps' +import { getTestCaseAttempts } from '../../../test/formatter_helpers' import FormatterBuilder from '../builder' +import getColorFns from '../get_color_fns' +import { formatIssue } from './issue_helpers' async function testFormatIssue(sourceData: string): Promise { const sources = [ diff --git a/src/formatter/helpers/keyword_type.ts b/src/formatter/helpers/keyword_type.ts index 59be776d0..7223afab0 100644 --- a/src/formatter/helpers/keyword_type.ts +++ b/src/formatter/helpers/keyword_type.ts @@ -1,4 +1,5 @@ import { Dialect, dialects } from '@cucumber/gherkin' + import { doesHaveValue } from '../../value_checker' export enum KeywordType { diff --git a/src/formatter/helpers/keyword_type_spec.ts b/src/formatter/helpers/keyword_type_spec.ts index 659070319..48f64bdb1 100644 --- a/src/formatter/helpers/keyword_type_spec.ts +++ b/src/formatter/helpers/keyword_type_spec.ts @@ -1,5 +1,6 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' +import { describe, it } from 'mocha' + import { getStepKeywordType, KeywordType } from './keyword_type' describe('KeywordType', () => { diff --git a/src/formatter/helpers/location_helpers.ts b/src/formatter/helpers/location_helpers.ts index fd212b01c..0318a9ed3 100644 --- a/src/formatter/helpers/location_helpers.ts +++ b/src/formatter/helpers/location_helpers.ts @@ -1,6 +1,7 @@ import path from 'path' -import { doesHaveValue } from '../../value_checker' + import { ILineAndUri } from '../../types' +import { doesHaveValue } from '../../value_checker' export function formatLocation(obj: ILineAndUri, cwd?: string): string { let uri = obj.uri diff --git a/src/formatter/helpers/pickle_parser.ts b/src/formatter/helpers/pickle_parser.ts index 166ee3144..a8d5888d4 100644 --- a/src/formatter/helpers/pickle_parser.ts +++ b/src/formatter/helpers/pickle_parser.ts @@ -1,6 +1,7 @@ -import { getGherkinScenarioLocationMap } from './gherkin_document_parser' import * as messages from '@cucumber/messages' +import { getGherkinScenarioLocationMap } from './gherkin_document_parser' + export interface IGetPickleLocationRequest { gherkinDocument: messages.GherkinDocument pickle: messages.Pickle diff --git a/src/formatter/helpers/step_argument_formatter.ts b/src/formatter/helpers/step_argument_formatter.ts index 7381056cc..2ec077f9b 100644 --- a/src/formatter/helpers/step_argument_formatter.ts +++ b/src/formatter/helpers/step_argument_formatter.ts @@ -1,6 +1,7 @@ +import * as messages from '@cucumber/messages' import Table from 'cli-table3' + import { parseStepArgument } from '../../step_arguments' -import * as messages from '@cucumber/messages' function formatDataTable(dataTable: messages.PickleTable): string { const table = new Table({ diff --git a/src/formatter/helpers/summary_helpers.ts b/src/formatter/helpers/summary_helpers.ts index e18bfb9d9..67ec6316e 100644 --- a/src/formatter/helpers/summary_helpers.ts +++ b/src/formatter/helpers/summary_helpers.ts @@ -1,8 +1,9 @@ +import * as messages from '@cucumber/messages' import Duration from 'duration' + +import { doesHaveValue } from '../../value_checker' import { IColorFns } from '../get_color_fns' import { ITestCaseAttempt } from './event_data_collector' -import * as messages from '@cucumber/messages' -import { doesHaveValue } from '../../value_checker' const STATUS_REPORT_ORDER = [ messages.TestStepResultStatus.FAILED, diff --git a/src/formatter/helpers/summary_helpers_spec.ts b/src/formatter/helpers/summary_helpers_spec.ts index bc3dba4be..460b5c5d0 100644 --- a/src/formatter/helpers/summary_helpers_spec.ts +++ b/src/formatter/helpers/summary_helpers_spec.ts @@ -1,16 +1,17 @@ -import { afterEach, beforeEach, describe, it } from 'mocha' +import * as messages from '@cucumber/messages' +import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' import { expect } from 'chai' -import getColorFns from '../get_color_fns' -import { formatSummary } from './summary_helpers' -import { getTestCaseAttempts } from '../../../test/formatter_helpers' +import { afterEach, beforeEach, describe, it } from 'mocha' + import { getBaseSupportCodeLibrary } from '../../../test/fixtures/steps' -import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' -import timeMethods, { durationBetweenTimestamps } from '../../time' +import { getTestCaseAttempts } from '../../../test/formatter_helpers' import { buildSupportCodeLibrary } from '../../../test/runtime_helpers' import { IRuntimeOptions } from '../../runtime' import { ISupportCodeLibrary } from '../../support_code_library_builder/types' +import timeMethods, { durationBetweenTimestamps } from '../../time' import { doesNotHaveValue } from '../../value_checker' -import * as messages from '@cucumber/messages' +import getColorFns from '../get_color_fns' +import { formatSummary } from './summary_helpers' interface ITestFormatSummaryOptions { runtimeOptions?: Partial diff --git a/src/formatter/helpers/test_case_attempt_formatter.ts b/src/formatter/helpers/test_case_attempt_formatter.ts index 3c67c3cb0..7a70c6713 100644 --- a/src/formatter/helpers/test_case_attempt_formatter.ts +++ b/src/formatter/helpers/test_case_attempt_formatter.ts @@ -1,17 +1,18 @@ -import indentString from 'indent-string' import * as messages from '@cucumber/messages' import figures from 'figures' +import indentString from 'indent-string' + +import { ISupportCodeLibrary } from '../../support_code_library_builder/types' +import { doesHaveValue, valueOrDefault } from '../../value_checker' +import { IColorFns } from '../get_color_fns' +import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder' +import { ITestCaseAttempt } from './event_data_collector' import { formatLocation } from './location_helpers' +import { formatStepArgument } from './step_argument_formatter' import { IParsedTestStep, parseTestCaseAttempt, } from './test_case_attempt_parser' -import { formatStepArgument } from './step_argument_formatter' -import { IColorFns } from '../get_color_fns' -import { doesHaveValue, valueOrDefault } from '../../value_checker' -import { ITestCaseAttempt } from './event_data_collector' -import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder' -import { ISupportCodeLibrary } from '../../support_code_library_builder/types' const CHARACTERS: Map = new Map([ [messages.TestStepResultStatus.AMBIGUOUS, figures.cross], diff --git a/src/formatter/helpers/test_case_attempt_parser.ts b/src/formatter/helpers/test_case_attempt_parser.ts index 886eb75cd..59200ab38 100644 --- a/src/formatter/helpers/test_case_attempt_parser.ts +++ b/src/formatter/helpers/test_case_attempt_parser.ts @@ -1,17 +1,18 @@ -import { getStepKeywordType, KeywordType } from './keyword_type' +import * as messages from '@cucumber/messages' +import { TestStepResult } from '@cucumber/messages' + +import TestCaseHookDefinition from '../../models/test_case_hook_definition' +import { ISupportCodeLibrary } from '../../support_code_library_builder/types' +import { ILineAndUri } from '../../types' +import { doesHaveValue, valueOrDefault } from '../../value_checker' +import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder' +import { ITestCaseAttempt } from './event_data_collector' import { getGherkinScenarioLocationMap, getGherkinStepMap, } from './gherkin_document_parser' +import { getStepKeywordType, KeywordType } from './keyword_type' import { getPickleStepMap, getStepKeyword } from './pickle_parser' -import * as messages from '@cucumber/messages' -import { ITestCaseAttempt } from './event_data_collector' -import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder' -import { ISupportCodeLibrary } from '../../support_code_library_builder/types' -import { doesHaveValue, valueOrDefault } from '../../value_checker' -import TestCaseHookDefinition from '../../models/test_case_hook_definition' -import { ILineAndUri } from '../../types' -import { TestStepResult } from '@cucumber/messages' export interface IParsedTestStep { actionLocation?: ILineAndUri diff --git a/src/formatter/helpers/test_case_attempt_parser_spec.ts b/src/formatter/helpers/test_case_attempt_parser_spec.ts index 796ddbde4..f14929aa9 100644 --- a/src/formatter/helpers/test_case_attempt_parser_spec.ts +++ b/src/formatter/helpers/test_case_attempt_parser_spec.ts @@ -1,12 +1,13 @@ -import { describe, it } from 'mocha' -import { expect } from 'chai' -import * as messages from '@cucumber/messages' -import { parseTestCaseAttempt } from '.' -import { getBaseSupportCodeLibrary } from '../../../test/fixtures/steps' -import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder' import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions' +import * as messages from '@cucumber/messages' +import { expect } from 'chai' +import { describe, it } from 'mocha' import { reindent } from 'reindent-template-literals' + +import { getBaseSupportCodeLibrary } from '../../../test/fixtures/steps' import { getTestCaseAttempts } from '../../../test/formatter_helpers' +import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder' +import { parseTestCaseAttempt } from '.' describe('TestCaseAttemptParser', () => { describe('parseTestCaseAttempt', () => { diff --git a/src/formatter/helpers/usage_helpers/index.ts b/src/formatter/helpers/usage_helpers/index.ts index cfd327948..666c99814 100644 --- a/src/formatter/helpers/usage_helpers/index.ts +++ b/src/formatter/helpers/usage_helpers/index.ts @@ -1,9 +1,10 @@ -import { getPickleStepMap } from '../pickle_parser' -import { getGherkinStepMap } from '../gherkin_document_parser' import * as messages from '@cucumber/messages' + import StepDefinition from '../../../models/step_definition' import { doesHaveValue } from '../../../value_checker' import EventDataCollector from '../event_data_collector' +import { getGherkinStepMap } from '../gherkin_document_parser' +import { getPickleStepMap } from '../pickle_parser' export interface IUsageMatch { duration?: messages.Duration diff --git a/src/formatter/helpers/usage_helpers/index_spec.ts b/src/formatter/helpers/usage_helpers/index_spec.ts index 081224a2a..4b88af695 100644 --- a/src/formatter/helpers/usage_helpers/index_spec.ts +++ b/src/formatter/helpers/usage_helpers/index_spec.ts @@ -1,8 +1,9 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' -import { getUsage } from './' +import { describe, it } from 'mocha' + import { getEnvelopesAndEventDataCollector } from '../../../../test/formatter_helpers' import { buildSupportCodeLibrary } from '../../../../test/runtime_helpers' +import { getUsage } from './' describe('Usage Helpers', () => { describe('getUsage', () => { diff --git a/src/formatter/html_formatter.ts b/src/formatter/html_formatter.ts index 458e76fae..770207dd2 100644 --- a/src/formatter/html_formatter.ts +++ b/src/formatter/html_formatter.ts @@ -1,11 +1,12 @@ -import Formatter, { IFormatterOptions } from '.' +import CucumberHtmlStream from '@cucumber/html-formatter' import * as messages from '@cucumber/messages' import resolvePkg from 'resolve-pkg' -import CucumberHtmlStream from '@cucumber/html-formatter' -import { doesHaveValue } from '../value_checker' import { finished } from 'stream' import { promisify } from 'util' +import { doesHaveValue } from '../value_checker' +import Formatter, { IFormatterOptions } from '.' + export default class HtmlFormatter extends Formatter { private readonly _finished: Promise public static readonly documentation: string = 'Outputs HTML report' diff --git a/src/formatter/http_stream.ts b/src/formatter/http_stream.ts index 49a51e579..7e2534104 100644 --- a/src/formatter/http_stream.ts +++ b/src/formatter/http_stream.ts @@ -1,8 +1,9 @@ -import { pipeline, Transform, Writable } from 'stream' -import tmp from 'tmp' import fs from 'fs' import http from 'http' import https from 'https' +import { pipeline, Transform, Writable } from 'stream' +import tmp from 'tmp' + import { doesHaveValue } from '../value_checker' type HttpMethod = 'GET' | 'POST' | 'PUT' diff --git a/src/formatter/http_stream_spec.ts b/src/formatter/http_stream_spec.ts index a49ccfba1..6f113dfac 100644 --- a/src/formatter/http_stream_spec.ts +++ b/src/formatter/http_stream_spec.ts @@ -1,8 +1,9 @@ import assert from 'assert' -import HttpStream from './http_stream' -import FakeReportServer from '../../test/fake_report_server' import { Writable } from 'stream' +import FakeReportServer from '../../test/fake_report_server' +import HttpStream from './http_stream' + type Callback = (err?: Error | null) => void describe('HttpStream', () => { diff --git a/src/formatter/index.ts b/src/formatter/index.ts index 16ff0ad28..75149dc36 100644 --- a/src/formatter/index.ts +++ b/src/formatter/index.ts @@ -1,13 +1,14 @@ -import { IColorFns } from './get_color_fns' -import { EventDataCollector } from './helpers' -import StepDefinitionSnippetBuilder from './step_definition_snippet_builder' -import { PassThrough, Writable as WritableStream } from 'stream' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import { EventEmitter } from 'events' import { WriteStream as FsWriteStream } from 'fs' +import { PassThrough, Writable as WritableStream } from 'stream' import { WriteStream as TtyWriteStream } from 'tty' -import { EventEmitter } from 'events' + import { IParsedArgvFormatOptions } from '../cli/argv_parser' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import { IColorFns } from './get_color_fns' +import { EventDataCollector } from './helpers' import HttpStream from './http_stream' +import StepDefinitionSnippetBuilder from './step_definition_snippet_builder' export type IFormatterStream = | FsWriteStream diff --git a/src/formatter/json_formatter.ts b/src/formatter/json_formatter.ts index cb1396f1a..89b9d4db3 100644 --- a/src/formatter/json_formatter.ts +++ b/src/formatter/json_formatter.ts @@ -1,13 +1,14 @@ +import * as messages from '@cucumber/messages' + +import { parseStepArgument } from '../step_arguments' +import { doesHaveValue, doesNotHaveValue } from '../value_checker' import Formatter, { IFormatterOptions } from './' import { formatLocation, GherkinDocumentParser, PickleParser } from './helpers' -import * as messages from '@cucumber/messages' +import { ITestCaseAttempt } from './helpers/event_data_collector' import { getGherkinExampleRuleMap, getGherkinScenarioLocationMap, } from './helpers/gherkin_document_parser' -import { ITestCaseAttempt } from './helpers/event_data_collector' -import { doesHaveValue, doesNotHaveValue } from '../value_checker' -import { parseStepArgument } from '../step_arguments' const { getGherkinStepMap, getGherkinScenarioMap } = GherkinDocumentParser diff --git a/src/formatter/json_formatter_spec.ts b/src/formatter/json_formatter_spec.ts index de84daedc..bb54fee18 100644 --- a/src/formatter/json_formatter_spec.ts +++ b/src/formatter/json_formatter_spec.ts @@ -1,13 +1,14 @@ -import { afterEach, beforeEach, describe, it } from 'mocha' +import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' import { expect } from 'chai' -import { testFormatter } from '../../test/formatter_helpers' +import { afterEach, beforeEach, describe, it } from 'mocha' + +import { IJsonFeature, IJsonScenario } from '../../lib/formatter/json_formatter' import { getJsonFormatterSupportCodeLibrary, getJsonFormatterSupportCodeLibraryWithHooks, } from '../../test/fixtures/json_formatter_steps' -import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' +import { testFormatter } from '../../test/formatter_helpers' import timeMethods from '../time' -import { IJsonFeature, IJsonScenario } from '../../lib/formatter/json_formatter' describe('JsonFormatter', () => { let clock: InstalledClock diff --git a/src/formatter/message_formatter.ts b/src/formatter/message_formatter.ts index 15f47b0e0..2771cfe90 100644 --- a/src/formatter/message_formatter.ts +++ b/src/formatter/message_formatter.ts @@ -1,6 +1,7 @@ -import Formatter, { IFormatterOptions } from '.' import * as messages from '@cucumber/messages' +import Formatter, { IFormatterOptions } from '.' + export default class MessageFormatter extends Formatter { public static readonly documentation: string = 'Outputs protobuf messages' constructor(options: IFormatterOptions) { diff --git a/src/formatter/progress_bar_formatter.ts b/src/formatter/progress_bar_formatter.ts index 660b3994f..f05d12ca4 100644 --- a/src/formatter/progress_bar_formatter.ts +++ b/src/formatter/progress_bar_formatter.ts @@ -1,11 +1,12 @@ -import { formatIssue, formatSummary, isIssue } from './helpers' -import Formatter, { IFormatterOptions } from './' +import * as messages from '@cucumber/messages' import ProgressBar from 'progress' import { WriteStream as TtyWriteStream } from 'tty' -import * as messages from '@cucumber/messages' + +import { durationBetweenTimestamps } from '../time' import { doesHaveValue, valueOrDefault } from '../value_checker' +import Formatter, { IFormatterOptions } from './' +import { formatIssue, formatSummary, isIssue } from './helpers' import { formatUndefinedParameterType } from './helpers/issue_helpers' -import { durationBetweenTimestamps } from '../time' // Inspired by https://github.com/thekompanee/fuubar and https://github.com/martinciu/fuubar-cucumber export default class ProgressBarFormatter extends Formatter { diff --git a/src/formatter/progress_bar_formatter_spec.ts b/src/formatter/progress_bar_formatter_spec.ts index c0709331a..c4aabf3a1 100644 --- a/src/formatter/progress_bar_formatter_spec.ts +++ b/src/formatter/progress_bar_formatter_spec.ts @@ -1,26 +1,27 @@ -import { afterEach, beforeEach, describe, it } from 'mocha' +import * as messages from '@cucumber/messages' +import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' import { expect } from 'chai' -import sinon from 'sinon' import { EventEmitter } from 'events' -import { EventDataCollector } from './helpers' +import { afterEach, beforeEach, describe, it } from 'mocha' +import ProgressBar from 'progress' +import sinon from 'sinon' +import { PassThrough } from 'stream' +import { promisify } from 'util' + +import { getBaseSupportCodeLibrary } from '../../test/fixtures/steps' import { getEnvelopesAndEventDataCollector, ITestSource, normalizeSummaryDuration, } from '../../test/formatter_helpers' import { buildSupportCodeLibrary } from '../../test/runtime_helpers' -import FormatterBuilder from './builder' -import { getBaseSupportCodeLibrary } from '../../test/fixtures/steps' -import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' -import timeMethods from '../time' import { IRuntimeOptions } from '../runtime' -import * as messages from '@cucumber/messages' import { ISupportCodeLibrary } from '../support_code_library_builder/types' -import ProgressBarFormatter from './progress_bar_formatter' +import timeMethods from '../time' import { doesHaveValue, doesNotHaveValue } from '../value_checker' -import { PassThrough } from 'stream' -import ProgressBar from 'progress' -import { promisify } from 'util' +import FormatterBuilder from './builder' +import { EventDataCollector } from './helpers' +import ProgressBarFormatter from './progress_bar_formatter' interface ITestProgressBarFormatterOptions { runtimeOptions?: Partial diff --git a/src/formatter/progress_formatter.ts b/src/formatter/progress_formatter.ts index cc6198c6c..64677e054 100644 --- a/src/formatter/progress_formatter.ts +++ b/src/formatter/progress_formatter.ts @@ -1,7 +1,8 @@ -import SummaryFormatter from './summary_formatter' +import * as messages from '@cucumber/messages' + import { doesHaveValue } from '../value_checker' import { IFormatterOptions } from './index' -import * as messages from '@cucumber/messages' +import SummaryFormatter from './summary_formatter' import IEnvelope = messages.Envelope import ITestStepFinished = messages.TestStepFinished diff --git a/src/formatter/progress_formatter_spec.ts b/src/formatter/progress_formatter_spec.ts index b7581f2cd..d6e797438 100644 --- a/src/formatter/progress_formatter_spec.ts +++ b/src/formatter/progress_formatter_spec.ts @@ -1,10 +1,11 @@ -import { afterEach, beforeEach, describe, it } from 'mocha' +import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' import { expect } from 'chai' +import figures from 'figures' +import { afterEach, beforeEach, describe, it } from 'mocha' +import { reindent } from 'reindent-template-literals' + import { getBaseSupportCodeLibrary } from '../../test/fixtures/steps' import { testFormatter } from '../../test/formatter_helpers' -import { reindent } from 'reindent-template-literals' -import figures from 'figures' -import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' import timeMethods from '../time' describe('ProgressFormatter', () => { diff --git a/src/formatter/rerun_formatter.ts b/src/formatter/rerun_formatter.ts index ad840e14d..ade9eecb5 100644 --- a/src/formatter/rerun_formatter.ts +++ b/src/formatter/rerun_formatter.ts @@ -1,11 +1,12 @@ -import Formatter, { IFormatterOptions } from './' -import { getGherkinScenarioLocationMap } from './helpers/gherkin_document_parser' +import * as messages from '@cucumber/messages' + import { doesHaveValue, doesNotHaveValue, valueOrDefault, } from '../value_checker' -import * as messages from '@cucumber/messages' +import Formatter, { IFormatterOptions } from './' +import { getGherkinScenarioLocationMap } from './helpers/gherkin_document_parser' const DEFAULT_SEPARATOR = '\n' diff --git a/src/formatter/rerun_formatter_spec.ts b/src/formatter/rerun_formatter_spec.ts index fd9e1c5bf..536aaa80e 100644 --- a/src/formatter/rerun_formatter_spec.ts +++ b/src/formatter/rerun_formatter_spec.ts @@ -1,7 +1,8 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' -import { buildSupportCodeLibrary } from '../../test/runtime_helpers' +import { describe, it } from 'mocha' + import { testFormatter } from '../../test/formatter_helpers' +import { buildSupportCodeLibrary } from '../../test/runtime_helpers' const onePickleSources = [ { diff --git a/src/formatter/snippets_formatter.ts b/src/formatter/snippets_formatter.ts index bbc936d37..38ca00a17 100644 --- a/src/formatter/snippets_formatter.ts +++ b/src/formatter/snippets_formatter.ts @@ -1,7 +1,8 @@ +import * as messages from '@cucumber/messages' + +import { doesHaveValue } from '../value_checker' import Formatter, { IFormatterOptions } from './' import { parseTestCaseAttempt } from './helpers' -import { doesHaveValue } from '../value_checker' -import * as messages from '@cucumber/messages' import IEnvelope = messages.Envelope export default class SnippetsFormatter extends Formatter { diff --git a/src/formatter/step_definition_snippet_builder/index.ts b/src/formatter/step_definition_snippet_builder/index.ts index ce7065d1e..afb5c2502 100644 --- a/src/formatter/step_definition_snippet_builder/index.ts +++ b/src/formatter/step_definition_snippet_builder/index.ts @@ -1,12 +1,13 @@ -import { KeywordType } from '../helpers' -import { parseStepArgument } from '../../step_arguments' -import { ISnippetSnytax } from './snippet_syntax' import { CucumberExpressionGenerator, ParameterTypeRegistry, } from '@cucumber/cucumber-expressions' import * as messages from '@cucumber/messages' + +import { parseStepArgument } from '../../step_arguments' import { doesHaveValue } from '../../value_checker' +import { KeywordType } from '../helpers' +import { ISnippetSnytax } from './snippet_syntax' export interface INewStepDefinitionSnippetBuilderOptions { snippetSyntax: ISnippetSnytax diff --git a/src/formatter/step_definition_snippet_builder/index_spec.ts b/src/formatter/step_definition_snippet_builder/index_spec.ts index b7d22a798..805b6afac 100644 --- a/src/formatter/step_definition_snippet_builder/index_spec.ts +++ b/src/formatter/step_definition_snippet_builder/index_spec.ts @@ -1,11 +1,12 @@ -import { describe, it } from 'mocha' +import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions' import { expect } from 'chai' +import { describe, it } from 'mocha' +import sinon from 'sinon' + +import { getPickleStepWithText } from '../../../test/gherkin_helpers' import { KeywordType } from '../helpers' import StepDefinitionSnippetBuilder, { IBuildRequest } from './' -import sinon from 'sinon' -import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions' import { ISnippetSyntaxBuildOptions } from './snippet_syntax' -import { getPickleStepWithText } from '../../../test/gherkin_helpers' function testStepDefinitionBuilder( request: IBuildRequest diff --git a/src/formatter/step_definition_snippet_builder/javascript_snippet_syntax_spec.ts b/src/formatter/step_definition_snippet_builder/javascript_snippet_syntax_spec.ts index 7d76edb94..8ce19e64a 100644 --- a/src/formatter/step_definition_snippet_builder/javascript_snippet_syntax_spec.ts +++ b/src/formatter/step_definition_snippet_builder/javascript_snippet_syntax_spec.ts @@ -1,15 +1,16 @@ -import { describe, it } from 'mocha' -import { expect } from 'chai' -import JavascriptSnippetSyntax from './javascript_snippet_syntax' -import { SnippetInterface } from './snippet_syntax' -import { ISnippetSyntaxBuildOptions } from '../../../lib/formatter/step_definition_snippet_builder/snippet_syntax' import { CucumberExpressionGenerator, GeneratedExpression, ParameterTypeRegistry, } from '@cucumber/cucumber-expressions' +import { expect } from 'chai' +import { describe, it } from 'mocha' import { reindent } from 'reindent-template-literals' +import { ISnippetSyntaxBuildOptions } from '../../../lib/formatter/step_definition_snippet_builder/snippet_syntax' +import JavascriptSnippetSyntax from './javascript_snippet_syntax' +import { SnippetInterface } from './snippet_syntax' + function generateExpressions(text: string): readonly GeneratedExpression[] { const parameterTypeRegistry = new ParameterTypeRegistry() const cucumberExpressionGenerator = new CucumberExpressionGenerator( diff --git a/src/formatter/summary_formatter.ts b/src/formatter/summary_formatter.ts index f91034a3d..0bc39e618 100644 --- a/src/formatter/summary_formatter.ts +++ b/src/formatter/summary_formatter.ts @@ -1,10 +1,11 @@ -import { formatIssue, formatSummary, isFailure, isWarning } from './helpers' -import Formatter, { IFormatterOptions } from './' -import { doesHaveValue } from '../value_checker' import * as messages from '@cucumber/messages' + +import { durationBetweenTimestamps } from '../time' +import { doesHaveValue } from '../value_checker' +import Formatter, { IFormatterOptions } from './' +import { formatIssue, formatSummary, isFailure, isWarning } from './helpers' import { ITestCaseAttempt } from './helpers/event_data_collector' import { formatUndefinedParameterTypes } from './helpers/issue_helpers' -import { durationBetweenTimestamps } from '../time' interface ILogIssuesRequest { issues: ITestCaseAttempt[] diff --git a/src/formatter/summary_formatter_spec.ts b/src/formatter/summary_formatter_spec.ts index 20acb60ef..59c8ab1c2 100644 --- a/src/formatter/summary_formatter_spec.ts +++ b/src/formatter/summary_formatter_spec.ts @@ -1,11 +1,12 @@ -import { afterEach, beforeEach, describe, it } from 'mocha' +import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' import { expect } from 'chai' import figures from 'figures' -import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' -import timeMethods from '../time' -import { testFormatter } from '../../test/formatter_helpers' +import { afterEach, beforeEach, describe, it } from 'mocha' + import { getBaseSupportCodeLibrary } from '../../test/fixtures/steps' +import { testFormatter } from '../../test/formatter_helpers' import { buildSupportCodeLibrary } from '../../test/runtime_helpers' +import timeMethods from '../time' describe('SummaryFormatter', () => { let clock: InstalledClock diff --git a/src/formatter/usage_formatter.ts b/src/formatter/usage_formatter.ts index 0776d3656..8861eea61 100644 --- a/src/formatter/usage_formatter.ts +++ b/src/formatter/usage_formatter.ts @@ -1,8 +1,9 @@ -import { formatLocation, getUsage } from './helpers' -import Formatter, { IFormatterOptions } from './' +import * as messages from '@cucumber/messages' import Table from 'cli-table3' + import { doesHaveValue } from '../value_checker' -import * as messages from '@cucumber/messages' +import Formatter, { IFormatterOptions } from './' +import { formatLocation, getUsage } from './helpers' import IEnvelope = messages.Envelope export default class UsageFormatter extends Formatter { diff --git a/src/formatter/usage_formatter_spec.ts b/src/formatter/usage_formatter_spec.ts index 5c8545124..c7d110db8 100644 --- a/src/formatter/usage_formatter_spec.ts +++ b/src/formatter/usage_formatter_spec.ts @@ -1,10 +1,11 @@ -import { afterEach, beforeEach, describe, it } from 'mocha' -import { expect } from 'chai' import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' -import timeMethods from '../time' +import { expect } from 'chai' +import { afterEach, beforeEach, describe, it } from 'mocha' +import { reindent } from 'reindent-template-literals' + import { getUsageSupportCodeLibrary } from '../../test/fixtures/usage_steps' import { testFormatter } from '../../test/formatter_helpers' -import { reindent } from 'reindent-template-literals' +import timeMethods from '../time' describe('UsageFormatter', () => { let clock: InstalledClock diff --git a/src/formatter/usage_json_formatter.ts b/src/formatter/usage_json_formatter.ts index c2b522429..606a44c15 100644 --- a/src/formatter/usage_json_formatter.ts +++ b/src/formatter/usage_json_formatter.ts @@ -1,7 +1,8 @@ -import { getUsage } from './helpers' -import Formatter, { IFormatterOptions } from './' -import { doesHaveValue } from '../value_checker' import * as messages from '@cucumber/messages' + +import { doesHaveValue } from '../value_checker' +import Formatter, { IFormatterOptions } from './' +import { getUsage } from './helpers' import IEnvelope = messages.Envelope export default class UsageJsonFormatter extends Formatter { diff --git a/src/formatter/usage_json_formatter_spec.ts b/src/formatter/usage_json_formatter_spec.ts index 128049324..86367dc3a 100644 --- a/src/formatter/usage_json_formatter_spec.ts +++ b/src/formatter/usage_json_formatter_spec.ts @@ -1,9 +1,10 @@ -import { afterEach, beforeEach, describe, it } from 'mocha' -import { expect } from 'chai' import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' -import timeMethods from '../time' +import { expect } from 'chai' +import { afterEach, beforeEach, describe, it } from 'mocha' + import { getUsageSupportCodeLibrary } from '../../test/fixtures/usage_steps' import { testFormatter } from '../../test/formatter_helpers' +import timeMethods from '../time' describe('UsageJsonFormatter', () => { let clock: InstalledClock diff --git a/src/index.ts b/src/index.ts index 3272703ac..c4621c4c7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,18 +1,19 @@ +import * as messages from '@cucumber/messages' + import * as formatterHelpers from './formatter/helpers' import supportCodeLibraryBuilder from './support_code_library_builder' -import * as messages from '@cucumber/messages' // Top level export { default as Cli } from './cli' export { parseGherkinMessageStream } from './cli/helpers' +export { default as DataTable } from './models/data_table' export { default as PickleFilter } from './pickle_filter' export { - default as Runtime, INewRuntimeOptions, IRuntimeOptions, + default as Runtime, } from './runtime' export { default as supportCodeLibraryBuilder } from './support_code_library_builder' -export { default as DataTable } from './models/data_table' // Formatters export { default as Formatter, IFormatterOptions } from './formatter' @@ -42,16 +43,15 @@ export const setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper export const setWorldConstructor = methods.setWorldConstructor export const Then = methods.Then export const When = methods.When -export { - default as World, - IWorld, - IWorldOptions, -} from './support_code_library_builder/world' - export { ITestCaseHookParameter, ITestStepHookParameter, } from './support_code_library_builder/types' +export { + IWorld, + IWorldOptions, + default as World, +} from './support_code_library_builder/world' export const Status = messages.TestStepResultStatus // Time helpers diff --git a/src/models/data_table_spec.ts b/src/models/data_table_spec.ts index 8be0c3ee7..a9eabf3e9 100644 --- a/src/models/data_table_spec.ts +++ b/src/models/data_table_spec.ts @@ -1,7 +1,8 @@ -import { describe, it } from 'mocha' +import * as messages from '@cucumber/messages' import { expect } from 'chai' +import { describe, it } from 'mocha' + import DataTable from './data_table' -import * as messages from '@cucumber/messages' const id = 'id' const location: messages.Location = { line: 0 } diff --git a/src/models/definition.ts b/src/models/definition.ts index 171e89648..88ef8df5c 100644 --- a/src/models/definition.ts +++ b/src/models/definition.ts @@ -1,6 +1,7 @@ +import { Expression } from '@cucumber/cucumber-expressions' import * as messages from '@cucumber/messages' + import { ITestCaseHookParameter } from '../support_code_library_builder/types' -import { Expression } from '@cucumber/cucumber-expressions' export interface IGetInvocationDataRequest { hookParameter: ITestCaseHookParameter diff --git a/src/models/step_definition.ts b/src/models/step_definition.ts index 42b7ae111..928110d88 100644 --- a/src/models/step_definition.ts +++ b/src/models/step_definition.ts @@ -1,3 +1,7 @@ +import { Expression } from '@cucumber/cucumber-expressions' + +import { parseStepArgument } from '../step_arguments' +import { doesHaveValue } from '../value_checker' import DataTable from './data_table' import Definition, { IDefinition, @@ -5,9 +9,6 @@ import Definition, { IGetInvocationDataResponse, IStepDefinitionParameters, } from './definition' -import { parseStepArgument } from '../step_arguments' -import { Expression } from '@cucumber/cucumber-expressions' -import { doesHaveValue } from '../value_checker' export default class StepDefinition extends Definition implements IDefinition { public readonly pattern: string | RegExp diff --git a/src/models/test_case_hook_definition.ts b/src/models/test_case_hook_definition.ts index 21d8b47e7..65a274522 100644 --- a/src/models/test_case_hook_definition.ts +++ b/src/models/test_case_hook_definition.ts @@ -1,3 +1,5 @@ +import * as messages from '@cucumber/messages' + import { PickleTagFilter } from '../pickle_filter' import Definition, { IDefinition, @@ -6,7 +8,6 @@ import Definition, { IGetInvocationDataResponse, IHookDefinitionOptions, } from './definition' -import * as messages from '@cucumber/messages' export default class TestCaseHookDefinition extends Definition diff --git a/src/models/test_case_hook_definition_spec.ts b/src/models/test_case_hook_definition_spec.ts index bb502c551..6b63c9cb0 100644 --- a/src/models/test_case_hook_definition_spec.ts +++ b/src/models/test_case_hook_definition_spec.ts @@ -1,7 +1,8 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' -import TestCaseHookDefinition from './test_case_hook_definition' +import { describe, it } from 'mocha' + import { getPickleWithTags } from '../../test/gherkin_helpers' +import TestCaseHookDefinition from './test_case_hook_definition' describe('TestCaseHookDefinition', () => { describe('appliesToTestCase', () => { diff --git a/src/models/test_step_hook_definition.ts b/src/models/test_step_hook_definition.ts index 32aa03367..c5a7e3c48 100644 --- a/src/models/test_step_hook_definition.ts +++ b/src/models/test_step_hook_definition.ts @@ -1,12 +1,13 @@ +import * as messages from '@cucumber/messages' + import { PickleTagFilter } from '../pickle_filter' import Definition, { IDefinition, - IGetInvocationDataResponse, - IGetInvocationDataRequest, IDefinitionParameters, + IGetInvocationDataRequest, + IGetInvocationDataResponse, IHookDefinitionOptions, } from './definition' -import * as messages from '@cucumber/messages' export default class TestStepHookDefinition extends Definition diff --git a/src/models/test_step_hook_definition_spec.ts b/src/models/test_step_hook_definition_spec.ts index a885050a3..ad000e3a8 100644 --- a/src/models/test_step_hook_definition_spec.ts +++ b/src/models/test_step_hook_definition_spec.ts @@ -1,7 +1,8 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' -import TestStepHookDefinition from './test_step_hook_definition' +import { describe, it } from 'mocha' + import { getPickleWithTags } from '../../test/gherkin_helpers' +import TestStepHookDefinition from './test_step_hook_definition' describe('TestStepHookDefinition', () => { describe('appliesToTestCase', () => { diff --git a/src/pickle_filter.ts b/src/pickle_filter.ts index 0b7bc24cd..0db9eedef 100644 --- a/src/pickle_filter.ts +++ b/src/pickle_filter.ts @@ -1,8 +1,9 @@ -import path from 'path' +import * as messages from '@cucumber/messages' import parse from '@cucumber/tag-expressions' +import path from 'path' + import { getGherkinScenarioLocationMap } from './formatter/helpers/gherkin_document_parser' import { doesHaveValue, doesNotHaveValue } from './value_checker' -import * as messages from '@cucumber/messages' import IGherkinDocument = messages.GherkinDocument import IPickle = messages.Pickle diff --git a/src/pickle_filter_spec.ts b/src/pickle_filter_spec.ts index 23529cd7a..02b47aeea 100644 --- a/src/pickle_filter_spec.ts +++ b/src/pickle_filter_spec.ts @@ -1,7 +1,8 @@ -import { beforeEach, describe, it } from 'mocha' import { expect } from 'chai' -import PickleFilter from './pickle_filter' +import { beforeEach, describe, it } from 'mocha' + import { parse } from '../test/gherkin_helpers' +import PickleFilter from './pickle_filter' describe('PickleFilter', () => { const cwd = '/project' diff --git a/src/runtime/assemble_test_cases.ts b/src/runtime/assemble_test_cases.ts index a07921309..880c799e6 100644 --- a/src/runtime/assemble_test_cases.ts +++ b/src/runtime/assemble_test_cases.ts @@ -1,8 +1,9 @@ -import { EventEmitter } from 'events' +import { Group } from '@cucumber/cucumber-expressions' import * as messages from '@cucumber/messages' import { IdGenerator } from '@cucumber/messages' +import { EventEmitter } from 'events' + import { ISupportCodeLibrary } from '../support_code_library_builder/types' -import { Group } from '@cucumber/cucumber-expressions' import { doesHaveValue } from '../value_checker' export declare type IAssembledTestCases = Record diff --git a/src/runtime/assemble_test_cases_spec.ts b/src/runtime/assemble_test_cases_spec.ts index 1e72bfe22..f204cc062 100644 --- a/src/runtime/assemble_test_cases_spec.ts +++ b/src/runtime/assemble_test_cases_spec.ts @@ -1,14 +1,15 @@ import { IdGenerator } from '@cucumber/messages' import * as messages from '@cucumber/messages' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' +import { expect } from 'chai' import { EventEmitter } from 'events' -import { assembleTestCases, IAssembledTestCases } from './assemble_test_cases' import { afterEach, beforeEach, describe, it } from 'mocha' -import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' -import timeMethods from '../time' -import { buildSupportCodeLibrary } from '../../test/runtime_helpers' + import { parse } from '../../test/gherkin_helpers' -import { expect } from 'chai' +import { buildSupportCodeLibrary } from '../../test/runtime_helpers' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import timeMethods from '../time' +import { assembleTestCases, IAssembledTestCases } from './assemble_test_cases' interface IRequest { gherkinDocument: messages.GherkinDocument diff --git a/src/runtime/attachment_manager/index.ts b/src/runtime/attachment_manager/index.ts index d3ea34255..668be81b3 100644 --- a/src/runtime/attachment_manager/index.ts +++ b/src/runtime/attachment_manager/index.ts @@ -1,6 +1,7 @@ +import * as messages from '@cucumber/messages' import isStream from 'is-stream' import { Readable } from 'stream' -import * as messages from '@cucumber/messages' + import { doesHaveValue, doesNotHaveValue } from '../../value_checker' export interface IAttachmentMedia { diff --git a/src/runtime/attachment_manager/index_spec.ts b/src/runtime/attachment_manager/index_spec.ts index ecf2c45f3..bf0fd5b59 100644 --- a/src/runtime/attachment_manager/index_spec.ts +++ b/src/runtime/attachment_manager/index_spec.ts @@ -1,8 +1,9 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' -import AttachmentManager, { IAttachment } from './' +import { describe, it } from 'mocha' import stream, { Readable } from 'stream' +import AttachmentManager, { IAttachment } from './' + describe('AttachmentManager', () => { describe('create()', () => { describe('buffer', () => { diff --git a/src/runtime/helpers.ts b/src/runtime/helpers.ts index 5ecc031cb..2f1e2f9ad 100644 --- a/src/runtime/helpers.ts +++ b/src/runtime/helpers.ts @@ -1,9 +1,10 @@ -import { formatLocation } from '../formatter/helpers/location_helpers' +import * as messages from '@cucumber/messages' import Table from 'cli-table3' import indentString from 'indent-string' -import { PickleTagFilter } from '../pickle_filter' + +import { formatLocation } from '../formatter/helpers/location_helpers' import StepDefinition from '../models/step_definition' -import * as messages from '@cucumber/messages' +import { PickleTagFilter } from '../pickle_filter' import { IRuntimeOptions } from '.' export function getAmbiguousStepException( diff --git a/src/runtime/helpers_spec.ts b/src/runtime/helpers_spec.ts index 484342138..a9874aed0 100644 --- a/src/runtime/helpers_spec.ts +++ b/src/runtime/helpers_spec.ts @@ -1,9 +1,10 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' -import { getAmbiguousStepException, retriesForPickle } from './helpers' +import { describe, it } from 'mocha' + import { getPickleWithTags } from '../../test/gherkin_helpers' -import StepDefinition from '../models/step_definition' import { buildOptions } from '../../test/runtime_helpers' +import StepDefinition from '../models/step_definition' +import { getAmbiguousStepException, retriesForPickle } from './helpers' describe('Helpers', () => { describe('getAmbiguousStepException', () => { diff --git a/src/runtime/index.ts b/src/runtime/index.ts index 5efced4ca..3d672e887 100644 --- a/src/runtime/index.ts +++ b/src/runtime/index.ts @@ -1,17 +1,18 @@ -import { EventDataCollector, formatLocation } from '../formatter/helpers' -import StackTraceFilter from '../stack_trace_filter' -import UserCodeRunner from '../user_code_runner' -import VError from 'verror' -import { retriesForPickle, shouldCauseFailure } from './helpers' import { IdGenerator } from '@cucumber/messages' import * as messages from '@cucumber/messages' -import TestCaseRunner from './test_case_runner' import { EventEmitter } from 'events' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import VError from 'verror' + +import { EventDataCollector, formatLocation } from '../formatter/helpers' import TestRunHookDefinition from '../models/test_run_hook_definition' +import StackTraceFilter from '../stack_trace_filter' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import UserCodeRunner from '../user_code_runner' import { doesHaveValue, valueOrDefault } from '../value_checker' -import { ITestRunStopwatch, RealTestRunStopwatch } from './stopwatch' import { assembleTestCases } from './assemble_test_cases' +import { retriesForPickle, shouldCauseFailure } from './helpers' +import { ITestRunStopwatch, RealTestRunStopwatch } from './stopwatch' +import TestCaseRunner from './test_case_runner' export interface INewRuntimeOptions { eventBroadcaster: EventEmitter diff --git a/src/runtime/parallel/command_types.ts b/src/runtime/parallel/command_types.ts index 3a884550d..06fc29d7f 100644 --- a/src/runtime/parallel/command_types.ts +++ b/src/runtime/parallel/command_types.ts @@ -1,4 +1,5 @@ import * as messages from '@cucumber/messages' + import { IRuntimeOptions } from '../index' // Messages from Coordinator to Worker diff --git a/src/runtime/parallel/coordinator.ts b/src/runtime/parallel/coordinator.ts index 73e840f63..c527bc708 100644 --- a/src/runtime/parallel/coordinator.ts +++ b/src/runtime/parallel/coordinator.ts @@ -1,16 +1,17 @@ -import { ChildProcess, fork } from 'child_process' -import path from 'path' -import { retriesForPickle, shouldCauseFailure } from '../helpers' import * as messages from '@cucumber/messages' +import { IdGenerator } from '@cucumber/messages' +import { ChildProcess, fork } from 'child_process' import { EventEmitter } from 'events' +import path from 'path' + import { EventDataCollector } from '../../formatter/helpers' -import { IRuntimeOptions } from '..' import { ISupportCodeLibrary } from '../../support_code_library_builder/types' -import { ICoordinatorReport, IWorkerCommand } from './command_types' import { doesHaveValue } from '../../value_checker' -import { ITestRunStopwatch, RealTestRunStopwatch } from '../stopwatch' +import { IRuntimeOptions } from '..' import { assembleTestCases, IAssembledTestCases } from '../assemble_test_cases' -import { IdGenerator } from '@cucumber/messages' +import { retriesForPickle, shouldCauseFailure } from '../helpers' +import { ITestRunStopwatch, RealTestRunStopwatch } from '../stopwatch' +import { ICoordinatorReport, IWorkerCommand } from './command_types' const runWorkerPath = path.resolve(__dirname, 'run_worker.js') diff --git a/src/runtime/parallel/run_worker.ts b/src/runtime/parallel/run_worker.ts index e311d9412..72870c94c 100644 --- a/src/runtime/parallel/run_worker.ts +++ b/src/runtime/parallel/run_worker.ts @@ -1,6 +1,7 @@ -import Worker from './worker' import VError from 'verror' + import { doesHaveValue } from '../../value_checker' +import Worker from './worker' function run(): void { const exit = (exitCode: number, error?: Error, message?: string): void => { diff --git a/src/runtime/parallel/worker.ts b/src/runtime/parallel/worker.ts index 6fd1db60c..175c11a6a 100644 --- a/src/runtime/parallel/worker.ts +++ b/src/runtime/parallel/worker.ts @@ -1,25 +1,26 @@ -import { formatLocation } from '../../formatter/helpers' -import { - ICoordinatorReport, - IWorkerCommand, - IWorkerCommandInitialize, - IWorkerCommandRun, -} from './command_types' -import { EventEmitter } from 'events' -import StackTraceFilter from '../../stack_trace_filter' -import supportCodeLibraryBuilder from '../../support_code_library_builder' -import TestCaseRunner from '../test_case_runner' -import UserCodeRunner from '../../user_code_runner' import { IdGenerator } from '@cucumber/messages' import * as messages from '@cucumber/messages' +import { duration } from 'durations' +import { EventEmitter } from 'events' +import { pathToFileURL } from 'url' + +import { isJavaScript } from '../../cli/helpers' +import { formatLocation } from '../../formatter/helpers' import TestRunHookDefinition from '../../models/test_run_hook_definition' +import StackTraceFilter from '../../stack_trace_filter' +import supportCodeLibraryBuilder from '../../support_code_library_builder' import { ISupportCodeLibrary } from '../../support_code_library_builder/types' +import UserCodeRunner from '../../user_code_runner' import { doesHaveValue, valueOrDefault } from '../../value_checker' import { IRuntimeOptions } from '../index' import { RealTestRunStopwatch } from '../stopwatch' -import { duration } from 'durations' -import { pathToFileURL } from 'url' -import { isJavaScript } from '../../cli/helpers' +import TestCaseRunner from '../test_case_runner' +import { + ICoordinatorReport, + IWorkerCommand, + IWorkerCommandInitialize, + IWorkerCommandRun, +} from './command_types' // eslint-disable-next-line @typescript-eslint/no-var-requires const { importer } = require('../../importer') diff --git a/src/runtime/step_runner.ts b/src/runtime/step_runner.ts index 14e765bfd..b1ce08f2f 100644 --- a/src/runtime/step_runner.ts +++ b/src/runtime/step_runner.ts @@ -1,9 +1,10 @@ -import Time from '../time' -import UserCodeRunner from '../user_code_runner' import * as messages from '@cucumber/messages' import { format } from 'assertion-error-formatter' -import { ITestCaseHookParameter } from '../support_code_library_builder/types' + import { IDefinition, IGetInvocationDataResponse } from '../models/definition' +import { ITestCaseHookParameter } from '../support_code_library_builder/types' +import Time from '../time' +import UserCodeRunner from '../user_code_runner' import { doesHaveValue, doesNotHaveValue, diff --git a/src/runtime/stopwatch.ts b/src/runtime/stopwatch.ts index 592e20e04..dda8cc7a0 100644 --- a/src/runtime/stopwatch.ts +++ b/src/runtime/stopwatch.ts @@ -1,5 +1,5 @@ import * as messages from '@cucumber/messages' -import { stopwatch, Stopwatch, duration, Duration } from 'durations' +import { Duration, duration, Stopwatch, stopwatch } from 'durations' export interface ITestRunStopwatch { from: (duration: Duration) => ITestRunStopwatch diff --git a/src/runtime/stopwatch_spec.ts b/src/runtime/stopwatch_spec.ts index 5516f0cf6..48b70c107 100644 --- a/src/runtime/stopwatch_spec.ts +++ b/src/runtime/stopwatch_spec.ts @@ -1,7 +1,8 @@ +import { TimeConversion } from '@cucumber/messages' +import { expect } from 'chai' import { describe, it } from 'mocha' + import { RealTestRunStopwatch } from './stopwatch' -import { expect } from 'chai' -import { TimeConversion } from '@cucumber/messages' describe('stopwatch', () => { it('returns a timestamp close to now', () => { diff --git a/src/runtime/test_case_runner.ts b/src/runtime/test_case_runner.ts index 9b77ce904..2b472dfaa 100644 --- a/src/runtime/test_case_runner.ts +++ b/src/runtime/test_case_runner.ts @@ -1,20 +1,21 @@ -import { getAmbiguousStepException } from './helpers' -import AttachmentManager from './attachment_manager' -import StepRunner from './step_runner' import * as messages from '@cucumber/messages' import { getWorstTestStepResult, IdGenerator } from '@cucumber/messages' import { EventEmitter } from 'events' + +import { IDefinition } from '../models/definition' +import StepDefinition from '../models/step_definition' +import TestCaseHookDefinition from '../models/test_case_hook_definition' +import TestStepHookDefinition from '../models/test_step_hook_definition' import { ISupportCodeLibrary, ITestCaseHookParameter, ITestStepHookParameter, } from '../support_code_library_builder/types' -import TestCaseHookDefinition from '../models/test_case_hook_definition' -import TestStepHookDefinition from '../models/test_step_hook_definition' -import { IDefinition } from '../models/definition' import { doesHaveValue, doesNotHaveValue } from '../value_checker' +import AttachmentManager from './attachment_manager' +import { getAmbiguousStepException } from './helpers' +import StepRunner from './step_runner' import { ITestRunStopwatch } from './stopwatch' -import StepDefinition from '../models/step_definition' export interface INewTestCaseRunnerOptions { eventBroadcaster: EventEmitter diff --git a/src/runtime/test_case_runner_spec.ts b/src/runtime/test_case_runner_spec.ts index 1d5b1594d..78164ea36 100644 --- a/src/runtime/test_case_runner_spec.ts +++ b/src/runtime/test_case_runner_spec.ts @@ -1,19 +1,20 @@ -import { afterEach, beforeEach, describe, it } from 'mocha' -import { expect } from 'chai' -import sinon from 'sinon' -import TestCaseRunner from './test_case_runner' -import { EventEmitter } from 'events' import { IdGenerator } from '@cucumber/messages' import * as messages from '@cucumber/messages' -import { parse } from '../../test/gherkin_helpers' -import { buildSupportCodeLibrary } from '../../test/runtime_helpers' import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' -import timeMethods from '../time' +import { expect } from 'chai' +import { EventEmitter } from 'events' +import { afterEach, beforeEach, describe, it } from 'mocha' +import sinon from 'sinon' + import { getBaseSupportCodeLibrary } from '../../test/fixtures/steps' +import { parse } from '../../test/gherkin_helpers' +import { buildSupportCodeLibrary } from '../../test/runtime_helpers' import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import timeMethods from '../time' import { valueOrDefault } from '../value_checker' -import { PredictableTestRunStopwatch } from './stopwatch' import { assembleTestCases } from './assemble_test_cases' +import { PredictableTestRunStopwatch } from './stopwatch' +import TestCaseRunner from './test_case_runner' import IEnvelope = messages.Envelope interface ITestRunnerRequest { diff --git a/src/stack_trace_filter.ts b/src/stack_trace_filter.ts index 2275d4685..219dbabf4 100644 --- a/src/stack_trace_filter.ts +++ b/src/stack_trace_filter.ts @@ -1,5 +1,6 @@ -import stackChain from 'stack-chain' import path from 'path' +import stackChain from 'stack-chain' + import { valueOrDefault } from './value_checker' import CallSite = NodeJS.CallSite diff --git a/src/step_arguments.ts b/src/step_arguments.ts index 18fa0ee54..47e8c3a2e 100644 --- a/src/step_arguments.ts +++ b/src/step_arguments.ts @@ -1,5 +1,6 @@ -import util from 'util' import * as messages from '@cucumber/messages' +import util from 'util' + import { doesHaveValue } from './value_checker' export interface IPickleStepArgumentFunctionMap { diff --git a/src/support_code_library_builder/build_parameter_type.ts b/src/support_code_library_builder/build_parameter_type.ts index a05258370..dd2eb2ced 100644 --- a/src/support_code_library_builder/build_parameter_type.ts +++ b/src/support_code_library_builder/build_parameter_type.ts @@ -1,4 +1,5 @@ import { ParameterType } from '@cucumber/cucumber-expressions' + import { IParameterTypeDefinition } from './types' export function buildParameterType({ diff --git a/src/support_code_library_builder/get_definition_line_and_uri.ts b/src/support_code_library_builder/get_definition_line_and_uri.ts index 583319e6a..1db4c8a91 100644 --- a/src/support_code_library_builder/get_definition_line_and_uri.ts +++ b/src/support_code_library_builder/get_definition_line_and_uri.ts @@ -1,9 +1,10 @@ -import path from 'path' import { wrapCallSite } from '@cspotcode/source-map-support' +import path from 'path' import stackChain from 'stack-chain' + import { isFileNameInCucumber } from '../stack_trace_filter' -import { doesHaveValue, valueOrDefault } from '../value_checker' import { ILineAndUri } from '../types' +import { doesHaveValue, valueOrDefault } from '../value_checker' import CallSite = NodeJS.CallSite export function getDefinitionLineAndUri( diff --git a/src/support_code_library_builder/get_definition_line_and_uri_spec.ts b/src/support_code_library_builder/get_definition_line_and_uri_spec.ts index 81956f255..084be40ae 100644 --- a/src/support_code_library_builder/get_definition_line_and_uri_spec.ts +++ b/src/support_code_library_builder/get_definition_line_and_uri_spec.ts @@ -1,7 +1,8 @@ import assert from 'assert' -import { getDefinitionLineAndUri } from './get_definition_line_and_uri' import path from 'path' +import { getDefinitionLineAndUri } from './get_definition_line_and_uri' + describe(getDefinitionLineAndUri.name, () => { it('correctly gets the filename of the caller', () => { const includeAnyFile = (): boolean => false diff --git a/src/support_code_library_builder/index.ts b/src/support_code_library_builder/index.ts index a409df609..4b2923ea4 100644 --- a/src/support_code_library_builder/index.ts +++ b/src/support_code_library_builder/index.ts @@ -1,35 +1,35 @@ -import { buildParameterType } from './build_parameter_type' -import { getDefinitionLineAndUri } from './get_definition_line_and_uri' -import { IdGenerator } from '@cucumber/messages' -import * as messages from '@cucumber/messages' -import TestCaseHookDefinition from '../models/test_case_hook_definition' -import TestStepHookDefinition from '../models/test_step_hook_definition' -import TestRunHookDefinition from '../models/test_run_hook_definition' -import StepDefinition from '../models/step_definition' -import { formatLocation } from '../formatter/helpers' -import validateArguments from './validate_arguments' -import arity from 'util-arity' - import { CucumberExpression, ParameterTypeRegistry, RegularExpression, } from '@cucumber/cucumber-expressions' +import { IdGenerator } from '@cucumber/messages' +import * as messages from '@cucumber/messages' +import arity from 'util-arity' + +import { formatLocation } from '../formatter/helpers' +import StepDefinition from '../models/step_definition' +import TestCaseHookDefinition from '../models/test_case_hook_definition' +import TestRunHookDefinition from '../models/test_run_hook_definition' +import TestStepHookDefinition from '../models/test_step_hook_definition' +import { ICanonicalSupportCodeIds } from '../runtime/parallel/command_types' import { doesHaveValue } from '../value_checker' +import { buildParameterType } from './build_parameter_type' +import { getDefinitionLineAndUri } from './get_definition_line_and_uri' import { DefineStepPattern, IDefineStepOptions, IDefineSupportCodeMethods, IDefineTestCaseHookOptions, - IDefineTestStepHookOptions, IDefineTestRunHookOptions, + IDefineTestStepHookOptions, IParameterTypeDefinition, ISupportCodeLibrary, TestCaseHookFunction, TestStepHookFunction, } from './types' +import validateArguments from './validate_arguments' import World from './world' -import { ICanonicalSupportCodeIds } from '../runtime/parallel/command_types' interface IStepDefinitionConfig { code: any diff --git a/src/support_code_library_builder/index_spec.ts b/src/support_code_library_builder/index_spec.ts index 6485741a5..15048952f 100644 --- a/src/support_code_library_builder/index_spec.ts +++ b/src/support_code_library_builder/index_spec.ts @@ -1,10 +1,11 @@ -import { describe, it } from 'mocha' -import { expect } from 'chai' -import sinon from 'sinon' import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions' -import supportCodeLibraryBuilder from './' import { IdGenerator } from '@cucumber/messages' +import { expect } from 'chai' +import { describe, it } from 'mocha' +import sinon from 'sinon' + import { getPickleWithTags } from '../../test/gherkin_helpers' +import supportCodeLibraryBuilder from './' const { uuid } = IdGenerator diff --git a/src/support_code_library_builder/types.ts b/src/support_code_library_builder/types.ts index 9f24f0ccb..d979e0070 100644 --- a/src/support_code_library_builder/types.ts +++ b/src/support_code_library_builder/types.ts @@ -1,9 +1,10 @@ +import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions' import * as messages from '@cucumber/messages' + +import StepDefinition from '../models/step_definition' import TestCaseHookDefinition from '../models/test_case_hook_definition' -import TestStepHookDefinition from '../models/test_step_hook_definition' import TestRunHookDefinition from '../models/test_run_hook_definition' -import StepDefinition from '../models/step_definition' -import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions' +import TestStepHookDefinition from '../models/test_step_hook_definition' import { IWorld } from './world' export type DefineStepPattern = string | RegExp diff --git a/src/time.ts b/src/time.ts index 32ec1c9ed..c29d2f530 100644 --- a/src/time.ts +++ b/src/time.ts @@ -1,5 +1,5 @@ -import { performance } from 'perf_hooks' import * as messages from '@cucumber/messages' +import { performance } from 'perf_hooks' let previousTimestamp: number diff --git a/src/time_spec.ts b/src/time_spec.ts index 2fe66e793..61e9695b8 100644 --- a/src/time_spec.ts +++ b/src/time_spec.ts @@ -1,5 +1,6 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' +import { describe, it } from 'mocha' + import { wrapPromiseWithTimeout } from './time' describe('wrapPromiseWithTimeout()', () => { diff --git a/src/user_code_runner.ts b/src/user_code_runner.ts index 99d05ab93..d585cf830 100644 --- a/src/user_code_runner.ts +++ b/src/user_code_runner.ts @@ -1,6 +1,7 @@ +import util from 'util' + import { wrapPromiseWithTimeout } from './time' import UncaughtExceptionManager from './uncaught_exception_manager' -import util from 'util' import { doesHaveValue } from './value_checker' export interface IRunRequest { diff --git a/src/user_code_runner_spec.ts b/src/user_code_runner_spec.ts index fe028ddee..27b7a8671 100644 --- a/src/user_code_runner_spec.ts +++ b/src/user_code_runner_spec.ts @@ -1,8 +1,9 @@ -import { describe, it } from 'mocha' import { expect } from 'chai' -import UserCodeRunner, { IRunRequest, IRunResponse } from './user_code_runner' +import { describe, it } from 'mocha' import semver from 'semver' +import UserCodeRunner, { IRunRequest, IRunResponse } from './user_code_runner' + async function testUserCodeRunner( opts: Partial ): Promise { diff --git a/test/fake_report_server.ts b/test/fake_report_server.ts index 9fc459e85..91fa741ea 100644 --- a/test/fake_report_server.ts +++ b/test/fake_report_server.ts @@ -1,8 +1,9 @@ -import { AddressInfo, Server, Socket } from 'net' import express from 'express' -import { pipeline, Writable } from 'stream' import http from 'http' +import { AddressInfo, Server, Socket } from 'net' +import { pipeline, Writable } from 'stream' import { promisify } from 'util' + import { doesHaveValue } from '../src/value_checker' type Callback = (err?: Error | null) => void diff --git a/test/fixtures/json_formatter_steps.ts b/test/fixtures/json_formatter_steps.ts index cbef54b22..6aca86f36 100644 --- a/test/fixtures/json_formatter_steps.ts +++ b/test/fixtures/json_formatter_steps.ts @@ -1,9 +1,10 @@ // Tests depend on the lines the steps are defined on -import { buildSupportCodeLibrary } from '../runtime_helpers' -import { ISupportCodeLibrary } from '../../src/support_code_library_builder/types' import { InstalledClock } from '@sinonjs/fake-timers' + import { World } from '../../src' +import { ISupportCodeLibrary } from '../../src/support_code_library_builder/types' +import { buildSupportCodeLibrary } from '../runtime_helpers' export function getJsonFormatterSupportCodeLibrary( clock: InstalledClock diff --git a/test/fixtures/steps.ts b/test/fixtures/steps.ts index 8a09cc5a5..7ed6c01f0 100644 --- a/test/fixtures/steps.ts +++ b/test/fixtures/steps.ts @@ -1,8 +1,8 @@ // Tests depend on the lines the steps are defined on -import { buildSupportCodeLibrary } from '../runtime_helpers' import { ISupportCodeLibrary } from '../../src/support_code_library_builder/types' import World from '../../src/support_code_library_builder/world' +import { buildSupportCodeLibrary } from '../runtime_helpers' export function getBaseSupportCodeLibrary(): ISupportCodeLibrary { return buildSupportCodeLibrary(__dirname, ({ Given }) => { diff --git a/test/fixtures/usage_steps.ts b/test/fixtures/usage_steps.ts index 7d37e91d2..80cc11db4 100644 --- a/test/fixtures/usage_steps.ts +++ b/test/fixtures/usage_steps.ts @@ -1,9 +1,10 @@ // Tests depend on the lines the steps are defined on -import { buildSupportCodeLibrary } from '../runtime_helpers' -import { ISupportCodeLibrary } from '../../src/support_code_library_builder/types' import { InstalledClock } from '@sinonjs/fake-timers' +import { ISupportCodeLibrary } from '../../src/support_code_library_builder/types' +import { buildSupportCodeLibrary } from '../runtime_helpers' + export function getUsageSupportCodeLibrary( clock: InstalledClock ): ISupportCodeLibrary { diff --git a/test/formatter_helpers.ts b/test/formatter_helpers.ts index 8e2825529..951bf5b1d 100644 --- a/test/formatter_helpers.ts +++ b/test/formatter_helpers.ts @@ -1,19 +1,20 @@ -import { buildOptions, buildSupportCodeLibrary } from './runtime_helpers' -import { generateEvents } from './gherkin_helpers' -import Runtime, { IRuntimeOptions } from '../src/runtime' -import { EventEmitter } from 'events' -import { EventDataCollector } from '../src/formatter/helpers' -import FormatterBuilder from '../src/formatter/builder' import { IdGenerator } from '@cucumber/messages' import * as messages from '@cucumber/messages' -import { ISupportCodeLibrary } from '../src/support_code_library_builder/types' -import { ITestCaseAttempt } from '../src/formatter/helpers/event_data_collector' -import { doesNotHaveValue } from '../src/value_checker' -import { IParsedArgvFormatOptions } from '../src/cli/argv_parser' +import { EventEmitter } from 'events' import { PassThrough } from 'stream' -import { emitSupportCodeMessages } from '../src/cli/helpers' import { promisify } from 'util' +import { IParsedArgvFormatOptions } from '../src/cli/argv_parser' +import { emitSupportCodeMessages } from '../src/cli/helpers' +import FormatterBuilder from '../src/formatter/builder' +import { EventDataCollector } from '../src/formatter/helpers' +import { ITestCaseAttempt } from '../src/formatter/helpers/event_data_collector' +import Runtime, { IRuntimeOptions } from '../src/runtime' +import { ISupportCodeLibrary } from '../src/support_code_library_builder/types' +import { doesNotHaveValue } from '../src/value_checker' +import { generateEvents } from './gherkin_helpers' +import { buildOptions, buildSupportCodeLibrary } from './runtime_helpers' + const { uuid } = IdGenerator export interface ITestSource { diff --git a/test/gherkin_helpers.ts b/test/gherkin_helpers.ts index a0b94e187..cf0da550e 100644 --- a/test/gherkin_helpers.ts +++ b/test/gherkin_helpers.ts @@ -1,10 +1,11 @@ -import * as messages from '@cucumber/messages' -import { SourceMediaType } from '@cucumber/messages' -import { doesHaveValue } from '../src/value_checker' import { IGherkinOptions } from '@cucumber/gherkin' import { GherkinStreams } from '@cucumber/gherkin-streams' +import * as messages from '@cucumber/messages' +import { SourceMediaType } from '@cucumber/messages' import { EventEmitter } from 'events' +import { doesHaveValue } from '../src/value_checker' + export interface IParsedSource { pickles: messages.Pickle[] source: messages.Source diff --git a/test/runtime_helpers.ts b/test/runtime_helpers.ts index 90ba04816..760fce8d0 100644 --- a/test/runtime_helpers.ts +++ b/test/runtime_helpers.ts @@ -1,6 +1,7 @@ -import { SupportCodeLibraryBuilder } from '../src/support_code_library_builder' import { IdGenerator } from '@cucumber/messages' + import { IRuntimeOptions } from '../src/runtime' +import { SupportCodeLibraryBuilder } from '../src/support_code_library_builder' import { IDefineSupportCodeMethods, ISupportCodeLibrary, diff --git a/test/test_helper.ts b/test/test_helper.ts index bbe85dea2..0f0e38e19 100644 --- a/test/test_helper.ts +++ b/test/test_helper.ts @@ -1,6 +1,6 @@ import chai from 'chai' -import sinonChai from 'sinon-chai' import dirtyChai from 'dirty-chai' +import sinonChai from 'sinon-chai' chai.use(sinonChai) chai.use(dirtyChai)