From ef4cf5f0b319075f468985fee83064dd416df9ed Mon Sep 17 00:00:00 2001 From: David Goss Date: Sun, 8 Oct 2023 16:57:53 +0100 Subject: [PATCH] enforce import order, autofix --- .eslintrc.yml | 1 + compatibility/cck_spec.ts | 12 ++++----- .../features/attachments/attachments.ts | 4 +-- .../features/data-tables/data-tables.ts | 2 +- compatibility/features/hooks/hooks.ts | 2 +- .../parameter-types/parameter-types.ts | 2 +- features/step_definitions/cli_steps.ts | 4 +-- features/step_definitions/file_steps.ts | 6 ++--- features/step_definitions/formatter_steps.ts | 6 ++--- features/step_definitions/install_steps.ts | 4 +-- features/step_definitions/message_steps.ts | 6 ++--- features/step_definitions/parallel_steps.ts | 4 +-- .../step_definitions/report_server_steps.ts | 6 ++--- features/step_definitions/usage_json_steps.ts | 4 +-- features/support/formatter_output_helpers.ts | 2 +- features/support/hooks.ts | 4 +-- features/support/message_helpers.ts | 12 ++++----- features/support/world.ts | 10 +++---- src/api/convert_configuration.ts | 2 +- src/api/convert_configuration_spec.ts | 2 +- src/api/formatters.ts | 14 +++++----- src/api/gherkin.ts | 2 +- src/api/load_configuration.ts | 12 ++++----- src/api/load_sources.ts | 4 +-- src/api/load_sources_spec.ts | 2 +- src/api/load_support.ts | 4 +-- src/api/load_support_spec.ts | 4 +-- src/api/paths.ts | 4 +-- src/api/paths_spec.ts | 4 +-- src/api/plugins.ts | 2 +- src/api/run_cucumber.ts | 4 +-- src/api/runtime.ts | 6 ++--- src/api/support.ts | 2 +- src/api/test_helpers.ts | 4 +-- src/api/types.ts | 2 +- src/cli/helpers.ts | 8 +++--- src/cli/helpers_spec.ts | 26 +++++++++---------- src/cli/index.ts | 2 +- src/cli/run.ts | 2 +- src/configuration/from_file.ts | 8 +++--- src/configuration/from_file_spec.ts | 6 ++--- src/configuration/locate_file.ts | 2 +- src/configuration/merge_configurations.ts | 2 +- .../split_format_descriptor_spec.ts | 2 +- src/configuration/validate_configuration.ts | 2 +- src/filter_stack_trace.ts | 2 +- src/formatter/builder.ts | 20 +++++++------- src/formatter/builder_spec.ts | 4 +-- src/formatter/get_color_fns.ts | 2 +- src/formatter/helpers/event_data_collector.ts | 2 +- .../helpers/gherkin_document_parser_spec.ts | 13 +++++----- src/formatter/helpers/issue_helpers.ts | 2 +- src/formatter/helpers/issue_helpers_spec.ts | 8 +++--- src/formatter/helpers/pickle_parser.ts | 2 +- .../helpers/step_argument_formatter.ts | 2 +- src/formatter/helpers/summary_helpers.ts | 6 ++--- src/formatter/helpers/summary_helpers_spec.ts | 8 +++--- .../helpers/test_case_attempt_formatter.ts | 8 +++--- .../helpers/test_case_attempt_parser.ts | 14 +++++----- .../helpers/test_case_attempt_parser_spec.ts | 6 ++--- src/formatter/helpers/usage_helpers/index.ts | 2 +- .../helpers/usage_helpers/index_spec.ts | 2 +- src/formatter/html_formatter.ts | 6 ++--- src/formatter/index.ts | 8 +++--- src/formatter/json_formatter.ts | 8 +++--- src/formatter/json_formatter_spec.ts | 2 +- src/formatter/junit_formatter.ts | 6 ++--- src/formatter/message_formatter.ts | 2 +- src/formatter/progress_bar_formatter.ts | 8 +++--- src/formatter/progress_bar_formatter_spec.ts | 18 ++++++------- src/formatter/progress_formatter.ts | 4 +-- src/formatter/progress_formatter_spec.ts | 4 +-- src/formatter/rerun_formatter.ts | 6 ++--- src/formatter/snippets_formatter.ts | 6 ++--- .../step_definition_snippet_builder/index.ts | 6 ++--- .../index_spec.ts | 6 ++--- .../javascript_snippet_syntax_spec.ts | 6 ++--- src/formatter/summary_formatter.ts | 8 +++--- src/formatter/usage_formatter.ts | 6 ++--- src/formatter/usage_formatter_spec.ts | 2 +- src/formatter/usage_json_formatter.ts | 4 +-- src/index.ts | 4 +-- src/models/data_table_spec.ts | 2 +- src/models/definition.ts | 2 +- src/models/step_definition.ts | 6 ++--- src/models/test_case_hook_definition.ts | 2 +- src/models/test_case_hook_definition_spec.ts | 2 +- src/models/test_step_hook_definition.ts | 2 +- src/models/test_step_hook_definition_spec.ts | 2 +- src/pickle_filter.ts | 2 +- src/pickle_filter_spec.ts | 4 +-- src/plugin/plugin_manager.ts | 2 +- src/plugin/types.ts | 2 +- src/publish/http_stream.ts | 2 +- src/publish/publish_plugin.ts | 4 +-- src/runtime/assemble_test_cases.ts | 2 +- src/runtime/assemble_test_cases_spec.ts | 8 +++--- src/runtime/attachment_manager/index.ts | 2 +- src/runtime/attachment_manager/index_spec.ts | 2 +- src/runtime/format_error_spec.ts | 2 +- src/runtime/helpers.ts | 4 +-- src/runtime/helpers_spec.ts | 2 +- src/runtime/index.ts | 2 +- src/runtime/parallel/coordinator.ts | 8 +++--- src/runtime/parallel/run_worker.ts | 2 +- src/runtime/parallel/worker.ts | 6 ++--- src/runtime/run_test_run_hooks.ts | 2 +- src/runtime/step_runner.ts | 4 +-- src/runtime/stopwatch_spec.ts | 2 +- src/runtime/test_case_runner.ts | 10 +++---- src/runtime/test_case_runner_spec.ts | 12 ++++----- .../get_definition_line_and_uri_spec.ts | 2 +- src/support_code_library_builder/index.ts | 20 +++++++------- .../index_spec.ts | 2 +- .../parallel_can_assign_helpers_spec.ts | 2 +- src/user_code_runner.ts | 2 +- src/user_code_runner_spec.ts | 2 +- test/fake_logger.ts | 2 +- test/fake_report_server.ts | 2 +- test/fixtures/json_formatter_steps.ts | 2 +- test/fixtures/usage_steps.ts | 2 +- test/formatter_helpers.ts | 14 +++++----- test/gherkin_helpers.ts | 4 +-- test/runtime_helpers.ts | 2 +- 124 files changed, 306 insertions(+), 304 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index adcabf809..f651c31e2 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -14,6 +14,7 @@ plugins: - '@typescript-eslint' rules: 'no-console': 'error' + 'import/order': 'error' 'unicorn/prefer-node-protocol': 'error' # requires strictNullChecks compiler option, produces many errors with messages objects '@typescript-eslint/strict-boolean-expressions': off diff --git a/compatibility/cck_spec.ts b/compatibility/cck_spec.ts index 8d3b6f12e..7025ff619 100644 --- a/compatibility/cck_spec.ts +++ b/compatibility/cck_spec.ts @@ -1,16 +1,16 @@ +import fs from 'node:fs' +import path from 'node:path' +import { PassThrough, pipeline, Writable } from 'node:stream' +import util from 'node:util' import { describe, it } from 'mocha' import { config, expect, use } from 'chai' import chaiExclude from 'chai-exclude' import { glob } from 'glob' -import fs from 'node:fs' -import path from 'node:path' -import { PassThrough, pipeline, Writable } from 'node:stream' -import { ignorableKeys } from '../features/support/formatter_output_helpers' import * as messages from '@cucumber/messages' import * as messageStreams from '@cucumber/message-streams' -import util from 'node:util' -import { runCucumber, IRunConfiguration } from '../src/api' import { Envelope } from '@cucumber/messages' +import { ignorableKeys } from '../features/support/formatter_output_helpers' +import { runCucumber, IRunConfiguration } from '../src/api' 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 bf6ce41fc..9d55b7d1a 100644 --- a/compatibility/features/attachments/attachments.ts +++ b/compatibility/features/attachments/attachments.ts @@ -1,7 +1,7 @@ -import { Before, When, World } from '../../../src' -import { ReadableStreamBuffer } from 'stream-buffers' import fs from 'node:fs' import path from 'node: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 168180f3c..daa8f6296 100644 --- a/compatibility/features/data-tables/data-tables.ts +++ b/compatibility/features/data-tables/data-tables.ts @@ -1,5 +1,5 @@ -import { When, Then, DataTable } from '../../../src' import { expect } from 'chai' +import { When, Then, DataTable } from '../../../src' type World = { transposed: DataTable diff --git a/compatibility/features/hooks/hooks.ts b/compatibility/features/hooks/hooks.ts index 47d467f0b..d4d469e5d 100644 --- a/compatibility/features/hooks/hooks.ts +++ b/compatibility/features/hooks/hooks.ts @@ -1,6 +1,6 @@ -import { When, Before, After, World } from '../../../src' import fs from 'node:fs' import path from 'node:path' +import { When, Before, After, World } from '../../../src' Before(function () { // no-op diff --git a/compatibility/features/parameter-types/parameter-types.ts b/compatibility/features/parameter-types/parameter-types.ts index b4baf7b93..c3213591f 100644 --- a/compatibility/features/parameter-types/parameter-types.ts +++ b/compatibility/features/parameter-types/parameter-types.ts @@ -1,5 +1,5 @@ -import { Given, defineParameterType } from '../../../src' import { expect } from 'chai' +import { Given, defineParameterType } from '../../../src' class Flight { constructor( diff --git a/features/step_definitions/cli_steps.ts b/features/step_definitions/cli_steps.ts index c23774d4d..5b33284d0 100644 --- a/features/step_definitions/cli_steps.ts +++ b/features/step_definitions/cli_steps.ts @@ -1,8 +1,8 @@ -import { DataTable, Then, When } from '../../' import { expect } from 'chai' -import { normalizeText } from '../support/helpers' import stringArgv from 'string-argv' import Mustache from 'mustache' +import { normalizeText } from '../support/helpers' +import { DataTable, Then, When } from '../../' import { doesHaveValue, doesNotHaveValue, diff --git a/features/step_definitions/file_steps.ts b/features/step_definitions/file_steps.ts index 7dc76accd..b65f43594 100644 --- a/features/step_definitions/file_steps.ts +++ b/features/step_definitions/file_steps.ts @@ -1,11 +1,11 @@ -import { Given, Then } from '../../' +import path from 'node:path' import { expect } from 'chai' import hasAnsi from 'has-ansi' -import { normalizeText } from '../support/helpers' import fs from 'mz/fs' import fsExtra from 'fs-extra' -import path from 'node:path' import Mustache from 'mustache' +import { normalizeText } from '../support/helpers' +import { Given, Then } from '../../' import { World } from '../support/world' Given( diff --git a/features/step_definitions/formatter_steps.ts b/features/step_definitions/formatter_steps.ts index 24c900149..9c2d9af16 100644 --- a/features/step_definitions/formatter_steps.ts +++ b/features/step_definitions/formatter_steps.ts @@ -1,14 +1,14 @@ -import { Then } from '../../' +import path from 'node:path' import { expect, use } from 'chai' import chaiExclude from 'chai-exclude' +import fs from 'mz/fs' +import { Then } from '../../' import { ignorableKeys, normalizeJsonOutput, normalizeMessageOutput, stripMetaMessages, } from '../support/formatter_output_helpers' -import fs from 'mz/fs' -import path from 'node:path' import { World } from '../support/world' use(chaiExclude) diff --git a/features/step_definitions/install_steps.ts b/features/step_definitions/install_steps.ts index be4eea734..0d16b112c 100644 --- a/features/step_definitions/install_steps.ts +++ b/features/step_definitions/install_steps.ts @@ -1,8 +1,8 @@ -import { Given } from '../../' -import tmp from 'tmp' import path from 'node:path' import fs from 'node:fs' +import tmp from 'tmp' import fsExtra from 'fs-extra' +import { Given } from '../../' import { World } from '../support/world' /* diff --git a/features/step_definitions/message_steps.ts b/features/step_definitions/message_steps.ts index b4b7c0eb2..96daff1d1 100644 --- a/features/step_definitions/message_steps.ts +++ b/features/step_definitions/message_steps.ts @@ -1,5 +1,7 @@ -import { Then } from '../../' import { expect } from 'chai' +import * as messages from '@cucumber/messages' +import semver from 'semver' +import { Then } from '../../' import DataTable from '../../src/models/data_table' import { getPickleNamesInOrderOfExecution, @@ -9,9 +11,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/parallel_steps.ts b/features/step_definitions/parallel_steps.ts index c5facfb3d..9788d1f29 100644 --- a/features/step_definitions/parallel_steps.ts +++ b/features/step_definitions/parallel_steps.ts @@ -1,7 +1,7 @@ -import { DataTable, Then } from '../../' -import { World } from '../support/world' import messages from '@cucumber/messages' import { expect } from 'chai' +import { DataTable, Then } from '../../' +import { World } from '../support/world' function getSetsOfPicklesRunningAtTheSameTime( envelopes: messages.Envelope[] diff --git a/features/step_definitions/report_server_steps.ts b/features/step_definitions/report_server_steps.ts index 0e775dc62..fdf65c3c3 100644 --- a/features/step_definitions/report_server_steps.ts +++ b/features/step_definitions/report_server_steps.ts @@ -1,9 +1,9 @@ +import { URL } from 'node:url' +import assert from 'node:assert' +import { expect } from 'chai' import { Given, Then, DataTable } from '../..' import { World } from '../support/world' -import { expect } from 'chai' -import { URL } from 'node:url' import FakeReportServer from '../../test/fake_report_server' -import assert from 'node:assert' 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 483c1a938..8b7c94451 100644 --- a/features/step_definitions/usage_json_steps.ts +++ b/features/step_definitions/usage_json_steps.ts @@ -1,6 +1,6 @@ -import { DataTable, Then } from '../../' -import { expect } from 'chai' import path from 'node:path' +import { expect } from 'chai' +import { DataTable, Then } from '../../' import { World } from '../support/world' import { IUsage } from '../../src/formatter/helpers/usage_helpers' diff --git a/features/support/formatter_output_helpers.ts b/features/support/formatter_output_helpers.ts index f33da9ff3..6e4f188dc 100644 --- a/features/support/formatter_output_helpers.ts +++ b/features/support/formatter_output_helpers.ts @@ -1,3 +1,4 @@ +import * as messages from '@cucumber/messages' import { doesHaveValue, doesNotHaveValue, @@ -8,7 +9,6 @@ import { IJsonScenario, IJsonStep, } from '../../src/formatter/json_formatter' -import * as messages from '@cucumber/messages' // Converting windows stack trace to posix and removing cwd // C:\\project\\path\\features\\support/code.js diff --git a/features/support/hooks.ts b/features/support/hooks.ts index 3ffb2c03d..d84b6a03f 100644 --- a/features/support/hooks.ts +++ b/features/support/hooks.ts @@ -1,6 +1,6 @@ -import { After, Before, formatterHelpers, ITestCaseHookParameter } from '../../' -import fsExtra from 'fs-extra' import path from 'node:path' +import fsExtra from 'fs-extra' +import { After, Before, formatterHelpers, ITestCaseHookParameter } from '../../' import { doesHaveValue } from '../../src/value_checker' import { World } from './world' import { warnUserAboutEnablingDeveloperMode } from './warn_user_about_enabling_developer_mode' diff --git a/features/support/message_helpers.ts b/features/support/message_helpers.ts index c7133858a..006425753 100644 --- a/features/support/message_helpers.ts +++ b/features/support/message_helpers.ts @@ -1,13 +1,13 @@ -import { getGherkinStepMap } from '../../src/formatter/helpers/gherkin_document_parser' -import { - getPickleStepMap, - getStepKeyword, -} from '../../src/formatter/helpers/pickle_parser' import util from 'node:util' import * as messages from '@cucumber/messages' import { Query } from '@cucumber/query' -import { doesHaveValue, doesNotHaveValue } from '../../src/value_checker' import { getWorstTestStepResult } from '@cucumber/messages' +import { doesHaveValue, doesNotHaveValue } from '../../src/value_checker' +import { + getPickleStepMap, + getStepKeyword, +} from '../../src/formatter/helpers/pickle_parser' +import { getGherkinStepMap } from '../../src/formatter/helpers/gherkin_document_parser' export interface IStepTextAndResult { text: string diff --git a/features/support/world.ts b/features/support/world.ts index 5d1347de8..653b0977f 100644 --- a/features/support/world.ts +++ b/features/support/world.ts @@ -1,17 +1,17 @@ -import { setWorldConstructor } from '../../' import { execFile } from 'node:child_process' -import { expect } from 'chai' -import toString from 'stream-to-string' import { PassThrough, pipeline, Writable } from 'node:stream' -import stripAnsi from 'strip-ansi' import fs from 'node:fs' import path from 'node:path' +import util from 'node:util' +import { expect } from 'chai' +import toString from 'stream-to-string' +import stripAnsi from 'strip-ansi' 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 { doesHaveValue } from '../../src/value_checker' -import util from 'node:util' +import { setWorldConstructor } from '../../' import { IRunEnvironment, loadConfiguration, runCucumber } from '../../lib/api' import { ArgvParser } from '../../lib/configuration' diff --git a/src/api/convert_configuration.ts b/src/api/convert_configuration.ts index 93c6d60db..ebd3988da 100644 --- a/src/api/convert_configuration.ts +++ b/src/api/convert_configuration.ts @@ -4,8 +4,8 @@ import { splitFormatDescriptor, } from '../configuration' import { IPublishConfig } from '../formatter' -import { IRunConfiguration } from './types' import { ILogger } from '../logger' +import { IRunConfiguration } from './types' export async function convertConfiguration( logger: ILogger, diff --git a/src/api/convert_configuration_spec.ts b/src/api/convert_configuration_spec.ts index 156e6ef8c..a47b38266 100644 --- a/src/api/convert_configuration_spec.ts +++ b/src/api/convert_configuration_spec.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha' import { expect } from 'chai' -import { convertConfiguration } from './convert_configuration' import { DEFAULT_CONFIGURATION } from '../configuration' import { FakeLogger } from '../../test/fake_logger' +import { convertConfiguration } from './convert_configuration' describe('convertConfiguration', () => { it('should convert defaults correctly', async () => { diff --git a/src/api/formatters.ts b/src/api/formatters.ts index b33392a57..e4ea6adf8 100644 --- a/src/api/formatters.ts +++ b/src/api/formatters.ts @@ -1,15 +1,15 @@ -import Formatter, { IFormatterStream } from '../formatter' import { EventEmitter } from 'node:events' -import { EventDataCollector } from '../formatter/helpers' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' import { promisify } from 'node:util' import { WriteStream as TtyWriteStream } from 'node:tty' -import FormatterBuilder from '../formatter/builder' -import fs from 'mz/fs' import path from 'node:path' -import { IRunOptionsFormats } from './types' -import { ILogger } from '../logger' +import fs from 'mz/fs' import { mkdirp } from 'mkdirp' +import Formatter, { IFormatterStream } from '../formatter' +import { EventDataCollector } from '../formatter/helpers' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import FormatterBuilder from '../formatter/builder' +import { ILogger } from '../logger' +import { IRunOptionsFormats } from './types' export async function initializeFormatters({ env, diff --git a/src/api/gherkin.ts b/src/api/gherkin.ts index 5b2fe2f71..9636c8e16 100644 --- a/src/api/gherkin.ts +++ b/src/api/gherkin.ts @@ -13,8 +13,8 @@ import { import { Query as GherkinQuery } from '@cucumber/gherkin-utils' import PickleFilter from '../pickle_filter' import { orderPickles } from '../cli/helpers' -import { ISourcesCoordinates } from './types' import { ILogger } from '../logger' +import { ISourcesCoordinates } from './types' interface PickleWithDocument { gherkinDocument: GherkinDocument diff --git a/src/api/load_configuration.ts b/src/api/load_configuration.ts index 4503c3aaa..8a0df59be 100644 --- a/src/api/load_configuration.ts +++ b/src/api/load_configuration.ts @@ -1,8 +1,3 @@ -import { - IRunEnvironment, - IResolvedConfiguration, - ILoadConfigurationOptions, -} from './types' import { locateFile } from '../configuration/locate_file' import { DEFAULT_CONFIGURATION, @@ -10,9 +5,14 @@ import { mergeConfigurations, } from '../configuration' import { validateConfiguration } from '../configuration/validate_configuration' +import { ILogger } from '../logger' import { convertConfiguration } from './convert_configuration' import { mergeEnvironment } from './environment' -import { ILogger } from '../logger' +import { + IRunEnvironment, + IResolvedConfiguration, + ILoadConfigurationOptions, +} from './types' import { ConsoleLogger } from './console_logger' /** diff --git a/src/api/load_sources.ts b/src/api/load_sources.ts index c46ae96c2..b99aa5593 100644 --- a/src/api/load_sources.ts +++ b/src/api/load_sources.ts @@ -1,3 +1,5 @@ +import { IdGenerator } from '@cucumber/messages' +import { ILogger } from '../logger' import { ILoadSourcesResult, IPlannedPickle, @@ -6,11 +8,9 @@ import { ISourcesError, } from './types' import { resolvePaths } from './paths' -import { IdGenerator } from '@cucumber/messages' import { mergeEnvironment } from './environment' import { getFilteredPicklesAndErrors } from './gherkin' import { ConsoleLogger } from './console_logger' -import { ILogger } from '../logger' /** * Load and parse features, produce a filtered and ordered test plan and/or parse errors. diff --git a/src/api/load_sources_spec.ts b/src/api/load_sources_spec.ts index a475ce375..0f93dfefc 100644 --- a/src/api/load_sources_spec.ts +++ b/src/api/load_sources_spec.ts @@ -1,6 +1,6 @@ -import { expect } from 'chai' import path from 'node:path' import { PassThrough } from 'node:stream' +import { expect } from 'chai' import fs from 'mz/fs' import { IdGenerator } from '@cucumber/messages' import { IRunEnvironment } from './types' diff --git a/src/api/load_support.ts b/src/api/load_support.ts index 9120ae4e2..fb443f55d 100644 --- a/src/api/load_support.ts +++ b/src/api/load_support.ts @@ -1,10 +1,10 @@ import { IdGenerator } from '@cucumber/messages' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import { ILogger } from '../logger' import { ILoadSupportOptions, IRunEnvironment } from './types' import { resolvePaths } from './paths' import { getSupportCodeLibrary } from './support' import { mergeEnvironment } from './environment' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' -import { ILogger } from '../logger' import { ConsoleLogger } from './console_logger' /** diff --git a/src/api/load_support_spec.ts b/src/api/load_support_spec.ts index fd9a7ff96..3d9c97b49 100644 --- a/src/api/load_support_spec.ts +++ b/src/api/load_support_spec.ts @@ -1,8 +1,8 @@ -import { IRunEnvironment } from './types' import path from 'node:path' +import { expect } from 'chai' +import { IRunEnvironment } from './types' import { loadSupport } from './load_support' import { loadConfiguration } from './load_configuration' -import { expect } from 'chai' import { setupEnvironment, teardownEnvironment } from './test_helpers' describe('loadSupport', function () { diff --git a/src/api/paths.ts b/src/api/paths.ts index 1e4f1ef5d..2c103cc11 100644 --- a/src/api/paths.ts +++ b/src/api/paths.ts @@ -1,8 +1,8 @@ -import { glob } from 'glob' import path from 'node:path' +import { glob } from 'glob' import fs from 'mz/fs' -import { ISourcesCoordinates, ISupportCodeCoordinates } from './types' import { ILogger } from '../logger' +import { ISourcesCoordinates, ISupportCodeCoordinates } from './types' export async function resolvePaths( logger: ILogger, diff --git a/src/api/paths_spec.ts b/src/api/paths_spec.ts index cfcf9a0b4..3135cc672 100644 --- a/src/api/paths_spec.ts +++ b/src/api/paths_spec.ts @@ -1,12 +1,12 @@ import { promisify } from 'node:util' +import path from 'node:path' import tmp, { DirOptions } from 'tmp' import fsExtra from 'fs-extra' -import path from 'node:path' import { describe, it } from 'mocha' import { expect } from 'chai' -import { resolvePaths } from './paths' import { FakeLogger } from '../../test/fake_logger' import { ILogger } from '../logger' +import { resolvePaths } from './paths' async function buildTestWorkingDirectory(): Promise { const cwd = await promisify(tmp.dir)({ diff --git a/src/api/plugins.ts b/src/api/plugins.ts index a0aa6f1df..c13343273 100644 --- a/src/api/plugins.ts +++ b/src/api/plugins.ts @@ -1,7 +1,7 @@ import { Plugin, PluginManager } from '../plugin' import publishPlugin from '../publish' -import { IRunEnvironment, IRunOptions } from './types' import { ILogger } from '../logger' +import { IRunEnvironment, IRunOptions } from './types' const INTERNAL_PLUGINS: Record = { publish: publishPlugin, diff --git a/src/api/run_cucumber.ts b/src/api/run_cucumber.ts index 46deaed72..47960f536 100644 --- a/src/api/run_cucumber.ts +++ b/src/api/run_cucumber.ts @@ -1,7 +1,8 @@ -import { Envelope, IdGenerator, ParseError } from '@cucumber/messages' import { EventEmitter } from 'node:events' +import { Envelope, IdGenerator, ParseError } from '@cucumber/messages' import { EventDataCollector } from '../formatter/helpers' import { emitMetaMessage, emitSupportCodeMessages } from '../cli/helpers' +import { ILogger } from '../logger' import { IRunOptions, IRunEnvironment, IRunResult } from './types' import { resolvePaths } from './paths' import { makeRuntime } from './runtime' @@ -11,7 +12,6 @@ import { mergeEnvironment } from './environment' import { getFilteredPicklesAndErrors } from './gherkin' import { initializePlugins } from './plugins' import { ConsoleLogger } from './console_logger' -import { ILogger } from '../logger' /** * Execute a Cucumber test run. diff --git a/src/api/runtime.ts b/src/api/runtime.ts index 96352b06a..db5e364d0 100644 --- a/src/api/runtime.ts +++ b/src/api/runtime.ts @@ -1,11 +1,11 @@ -import Runtime, { IRuntime } from '../runtime' import { EventEmitter } from 'node:events' -import { EventDataCollector } from '../formatter/helpers' import { IdGenerator } from '@cucumber/messages' +import Runtime, { IRuntime } from '../runtime' +import { EventDataCollector } from '../formatter/helpers' import { ISupportCodeLibrary } from '../support_code_library_builder/types' import Coordinator from '../runtime/parallel/coordinator' -import { IRunOptionsRuntime } from './types' import { ILogger } from '../logger' +import { IRunOptionsRuntime } from './types' export function makeRuntime({ cwd, diff --git a/src/api/support.ts b/src/api/support.ts index 7f3952710..958b17091 100644 --- a/src/api/support.ts +++ b/src/api/support.ts @@ -1,7 +1,7 @@ +import { pathToFileURL } from 'node:url' import { IdGenerator } from '@cucumber/messages' import { ISupportCodeLibrary } from '../support_code_library_builder/types' import supportCodeLibraryBuilder from '../support_code_library_builder' -import { pathToFileURL } from 'node:url' import tryRequire from '../try_require' export async function getSupportCodeLibrary({ diff --git a/src/api/test_helpers.ts b/src/api/test_helpers.ts index 7357f13f1..de1344699 100644 --- a/src/api/test_helpers.ts +++ b/src/api/test_helpers.ts @@ -1,9 +1,9 @@ -import { IRunEnvironment } from './types' import path from 'node:path' +import { PassThrough } from 'node:stream' import fs from 'mz/fs' import { reindent } from 'reindent-template-literals' -import { PassThrough } from 'node:stream' import { IdGenerator } from '@cucumber/messages' +import { IRunEnvironment } from './types' const newId = IdGenerator.uuid() diff --git a/src/api/types.ts b/src/api/types.ts index 172f771e0..0cb016f4b 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -1,9 +1,9 @@ +import { Writable } from 'node:stream' import { ISupportCodeLibrary } from '../support_code_library_builder/types' import { FormatOptions, IPublishConfig } from '../formatter' import { PickleOrder } from '../models/pickle_order' import { IRuntimeOptions } from '../runtime' import { IConfiguration } from '../configuration' -import { Writable } from 'node:stream' /** * @public diff --git a/src/cli/helpers.ts b/src/cli/helpers.ts index 6488c3415..7a091791d 100644 --- a/src/cli/helpers.ts +++ b/src/cli/helpers.ts @@ -1,13 +1,13 @@ -import shuffle from 'knuth-shuffle-seeded' import { EventEmitter } from 'node:events' -import PickleFilter from '../pickle_filter' -import { EventDataCollector } from '../formatter/helpers' -import { doesHaveValue } from '../value_checker' import { Readable } from 'node:stream' import os from 'node:os' +import shuffle from 'knuth-shuffle-seeded' import * as messages from '@cucumber/messages' import { IdGenerator } from '@cucumber/messages' import detectCiEnvironment from '@cucumber/ci-environment' +import { doesHaveValue } from '../value_checker' +import { EventDataCollector } from '../formatter/helpers' +import PickleFilter from '../pickle_filter' import { ISupportCodeLibrary } from '../support_code_library_builder/types' import TestCaseHookDefinition from '../models/test_case_hook_definition' import TestRunHookDefinition from '../models/test_run_hook_definition' diff --git a/src/cli/helpers_spec.ts b/src/cli/helpers_spec.ts index c2912f03a..82586969f 100644 --- a/src/cli/helpers_spec.ts +++ b/src/cli/helpers_spec.ts @@ -1,28 +1,28 @@ -import { describe, it } from 'mocha' -import { expect } from 'chai' -import { - emitMetaMessage, - emitSupportCodeMessages, - parseGherkinMessageStream, -} from './helpers' import { EventEmitter } from 'node: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 'node:stream' -import StepDefinition from '../models/step_definition' +import { GherkinStreams } from '@cucumber/gherkin-streams' +import { IdGenerator, SourceMediaType } from '@cucumber/messages' +import * as messages from '@cucumber/messages' +import { expect } from 'chai' +import { describe, it } from 'mocha' import { CucumberExpression, ParameterType, RegularExpression, } from '@cucumber/cucumber-expressions' +import { EventDataCollector } from '../formatter/helpers' +import PickleFilter from '../pickle_filter' +import StepDefinition from '../models/step_definition' import { ISupportCodeLibrary } from '../support_code_library_builder/types' import TestCaseHookDefinition from '../models/test_case_hook_definition' import TestRunHookDefinition from '../models/test_run_hook_definition' import { PickleOrder } from '../models/pickle_order' import { SourcedParameterTypeRegistry } from '../support_code_library_builder/sourced_parameter_type_registry' +import { + emitMetaMessage, + emitSupportCodeMessages, + parseGherkinMessageStream, +} from './helpers' const noopFunction = (): void => { // no code diff --git a/src/cli/index.ts b/src/cli/index.ts index e090e4228..b352f2e5c 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,9 +1,9 @@ +import debug from 'debug' import { ArgvParser } from '../configuration' import { IFormatterStream } from '../formatter' import { loadConfiguration, runCucumber } from '../api' import { getKeywords, getLanguages } from './i18n' import { validateInstall } from './install_validator' -import debug from 'debug' export interface ICliRunResult { shouldExitImmediately: boolean diff --git a/src/cli/run.ts b/src/cli/run.ts index f529f615b..6b7f07c43 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -1,9 +1,9 @@ /* eslint-disable no-console */ /* This is one rare place where we're fine to use process/console directly, * but other code abstracts those to remain composable and testable. */ -import Cli, { ICliRunResult } from './' import VError from 'verror' import { validateNodeEngineVersion } from './validate_node_engine_version' +import Cli, { ICliRunResult } from './' function logErrorMessageAndExit(message: string): void { console.error(message) diff --git a/src/configuration/from_file.ts b/src/configuration/from_file.ts index e0d371867..d52346fcc 100644 --- a/src/configuration/from_file.ts +++ b/src/configuration/from_file.ts @@ -1,15 +1,15 @@ -import stringArgv from 'string-argv' import fs from 'node:fs' import path from 'node:path' -import YAML from 'yaml' -import readPkgUp from 'read-pkg-up' import { promisify } from 'node:util' import { pathToFileURL } from 'node:url' +import stringArgv from 'string-argv' +import YAML from 'yaml' +import readPkgUp from 'read-pkg-up' +import { ILogger } from '../logger' import { IConfiguration } from './types' import { mergeConfigurations } from './merge_configurations' import ArgvParser from './argv_parser' import { checkSchema } from './check_schema' -import { ILogger } from '../logger' export async function fromFile( logger: ILogger, diff --git a/src/configuration/from_file_spec.ts b/src/configuration/from_file_spec.ts index 47e12df3f..7d27fd21c 100644 --- a/src/configuration/from_file_spec.ts +++ b/src/configuration/from_file_spec.ts @@ -1,10 +1,10 @@ -import { expect } from 'chai' import { promisify } from 'node:util' import fs from 'node:fs' -import tmp, { DirOptions } from 'tmp' import path from 'node:path' -import { fromFile } from './from_file' +import tmp, { DirOptions } from 'tmp' +import { expect } from 'chai' import { FakeLogger } from '../../test/fake_logger' +import { fromFile } from './from_file' async function setup( file: string = 'cucumber.json', diff --git a/src/configuration/locate_file.ts b/src/configuration/locate_file.ts index 7c5305e87..03e1738c6 100644 --- a/src/configuration/locate_file.ts +++ b/src/configuration/locate_file.ts @@ -1,5 +1,5 @@ -import fs from 'mz/fs' import path from 'node:path' +import fs from 'mz/fs' const DEFAULT_FILENAMES = [ 'cucumber.js', diff --git a/src/configuration/merge_configurations.ts b/src/configuration/merge_configurations.ts index 13e86e79f..be53e666a 100644 --- a/src/configuration/merge_configurations.ts +++ b/src/configuration/merge_configurations.ts @@ -1,5 +1,5 @@ -import { IConfiguration } from './types' import mergeWith from 'lodash.mergewith' +import { IConfiguration } from './types' const ADDITIVE_ARRAYS = [ 'format', diff --git a/src/configuration/split_format_descriptor_spec.ts b/src/configuration/split_format_descriptor_spec.ts index e447ddc80..14308402b 100644 --- a/src/configuration/split_format_descriptor_spec.ts +++ b/src/configuration/split_format_descriptor_spec.ts @@ -1,7 +1,7 @@ import { describe, it } from 'mocha' import { expect } from 'chai' -import { splitFormatDescriptor } from './split_format_descriptor' import { FakeLogger } from '../../test/fake_logger' +import { splitFormatDescriptor } from './split_format_descriptor' describe('splitFormatDescriptor', () => { const examples = [ diff --git a/src/configuration/validate_configuration.ts b/src/configuration/validate_configuration.ts index f75a2fd07..437332acb 100644 --- a/src/configuration/validate_configuration.ts +++ b/src/configuration/validate_configuration.ts @@ -1,5 +1,5 @@ -import { IConfiguration } from './types' import { ILogger } from '../logger' +import { IConfiguration } from './types' export function validateConfiguration( configuration: IConfiguration, diff --git a/src/filter_stack_trace.ts b/src/filter_stack_trace.ts index f72e04535..779903769 100644 --- a/src/filter_stack_trace.ts +++ b/src/filter_stack_trace.ts @@ -1,6 +1,6 @@ import path from 'node:path' -import { valueOrDefault } from './value_checker' import { StackFrame } from 'error-stack-parser' +import { valueOrDefault } from './value_checker' const projectRootPath = path.join(__dirname, '..') const projectChildDirs = ['src', 'lib', 'node_modules'] diff --git a/src/formatter/builder.ts b/src/formatter/builder.ts index e06edf823..98c54423e 100644 --- a/src/formatter/builder.ts +++ b/src/formatter/builder.ts @@ -1,20 +1,20 @@ -import getColorFns from './get_color_fns' -import JavascriptSnippetSyntax from './step_definition_snippet_builder/javascript_snippet_syntax' import path from 'node:path' -import StepDefinitionSnippetBuilder from './step_definition_snippet_builder' +import { EventEmitter } from 'node:events' +import { Writable as WritableStream } from 'node:stream' +import { pathToFileURL } from 'node:url' +import { doesHaveValue, doesNotHaveValue } from '../value_checker' import { ISupportCodeLibrary } from '../support_code_library_builder/types' +import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax' +import EventDataCollector from './helpers/event_data_collector' +import StepDefinitionSnippetBuilder from './step_definition_snippet_builder' +import JavascriptSnippetSyntax from './step_definition_snippet_builder/javascript_snippet_syntax' +import getColorFns from './get_color_fns' +import Formatters from './helpers/formatters' import Formatter, { FormatOptions, IFormatterCleanupFn, IFormatterLogFn, } from '.' -import { doesHaveValue, doesNotHaveValue } from '../value_checker' -import { EventEmitter } from 'node:events' -import EventDataCollector from './helpers/event_data_collector' -import { Writable as WritableStream } from 'node:stream' -import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax' -import { pathToFileURL } from 'node:url' -import Formatters from './helpers/formatters' interface IGetStepDefinitionSnippetBuilderOptions { cwd: string diff --git a/src/formatter/builder_spec.ts b/src/formatter/builder_spec.ts index d86655313..d4878ea84 100644 --- a/src/formatter/builder_spec.ts +++ b/src/formatter/builder_spec.ts @@ -1,7 +1,7 @@ -import { expect } from 'chai' -import FormatterBuilder from './builder' import { pathToFileURL } from 'node:url' import path from 'node:path' +import { expect } from 'chai' +import FormatterBuilder from './builder' describe('custom class loading', () => { const varieties = [ diff --git a/src/formatter/get_color_fns.ts b/src/formatter/get_color_fns.ts index b60befa79..436195f18 100644 --- a/src/formatter/get_color_fns.ts +++ b/src/formatter/get_color_fns.ts @@ -1,7 +1,7 @@ +import { Writable } from 'node:stream' import chalk from 'chalk' import { ColorInfo, supportsColor } from 'supports-color' import { TestStepResultStatus } from '@cucumber/messages' -import { Writable } from 'node:stream' import { doesNotHaveValue } from '../value_checker' export type IColorFn = (text: string) => string diff --git a/src/formatter/helpers/event_data_collector.ts b/src/formatter/helpers/event_data_collector.ts index 1397c15fb..3f858c920 100644 --- a/src/formatter/helpers/event_data_collector.ts +++ b/src/formatter/helpers/event_data_collector.ts @@ -1,6 +1,6 @@ +import { EventEmitter } from 'node:events' import * as messages from '@cucumber/messages' import { doesHaveValue, doesNotHaveValue } from '../../value_checker' -import { EventEmitter } from 'node:events' interface ITestCaseAttemptData { attempt: number diff --git a/src/formatter/helpers/gherkin_document_parser_spec.ts b/src/formatter/helpers/gherkin_document_parser_spec.ts index 8bea18ee7..dd62a89cb 100644 --- a/src/formatter/helpers/gherkin_document_parser_spec.ts +++ b/src/formatter/helpers/gherkin_document_parser_spec.ts @@ -1,18 +1,19 @@ import { describe, it } from 'mocha' import { expect } from 'chai' +import { reindent } from 'reindent-template-literals' +import * as messages from '@cucumber/messages' +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' describe('GherkinDocumentParser', () => { describe('getGherkinStepMap', () => { diff --git a/src/formatter/helpers/issue_helpers.ts b/src/formatter/helpers/issue_helpers.ts index 2279b8bdd..54cb13a5c 100644 --- a/src/formatter/helpers/issue_helpers.ts +++ b/src/formatter/helpers/issue_helpers.ts @@ -1,9 +1,9 @@ import indentString from 'indent-string' -import { formatTestCaseAttempt } from './test_case_attempt_formatter' import * as messages from '@cucumber/messages' import { IColorFns } from '../get_color_fns' import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder' import { ISupportCodeLibrary } from '../../support_code_library_builder/types' +import { formatTestCaseAttempt } from './test_case_attempt_formatter' import { ITestCaseAttempt } from './event_data_collector' export function isFailure( diff --git a/src/formatter/helpers/issue_helpers_spec.ts b/src/formatter/helpers/issue_helpers_spec.ts index 130f08e6d..7ee4660e3 100644 --- a/src/formatter/helpers/issue_helpers_spec.ts +++ b/src/formatter/helpers/issue_helpers_spec.ts @@ -1,13 +1,13 @@ +import { PassThrough } from 'node:stream' 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 { reindent } from 'reindent-template-literals' +import { getTestCaseAttempts } from '../../../test/formatter_helpers' +import getColorFns from '../get_color_fns' import { getBaseSupportCodeLibrary } from '../../../test/fixtures/steps' import FormatterBuilder from '../builder' -import { PassThrough } from 'node:stream' +import { formatIssue } from './issue_helpers' async function testFormatIssue( sourceData: string, diff --git a/src/formatter/helpers/pickle_parser.ts b/src/formatter/helpers/pickle_parser.ts index 166ee3144..fc2a6c7d2 100644 --- a/src/formatter/helpers/pickle_parser.ts +++ b/src/formatter/helpers/pickle_parser.ts @@ -1,5 +1,5 @@ -import { getGherkinScenarioLocationMap } from './gherkin_document_parser' import * as messages from '@cucumber/messages' +import { getGherkinScenarioLocationMap } from './gherkin_document_parser' export interface IGetPickleLocationRequest { gherkinDocument: messages.GherkinDocument diff --git a/src/formatter/helpers/step_argument_formatter.ts b/src/formatter/helpers/step_argument_formatter.ts index 7381056cc..92e5e1638 100644 --- a/src/formatter/helpers/step_argument_formatter.ts +++ b/src/formatter/helpers/step_argument_formatter.ts @@ -1,6 +1,6 @@ import Table from 'cli-table3' -import { parseStepArgument } from '../../step_arguments' import * as messages from '@cucumber/messages' +import { parseStepArgument } from '../../step_arguments' 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 7414103fd..fc67810e5 100644 --- a/src/formatter/helpers/summary_helpers.ts +++ b/src/formatter/helpers/summary_helpers.ts @@ -1,8 +1,8 @@ -import { IColorFns } from '../get_color_fns' -import { ITestCaseAttempt } from './event_data_collector' import * as messages from '@cucumber/messages' -import { doesHaveValue } from '../../value_checker' import { Interval } from 'luxon' +import { IColorFns } from '../get_color_fns' +import { doesHaveValue } from '../../value_checker' +import { ITestCaseAttempt } from './event_data_collector' 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 d60162b47..007227a4f 100644 --- a/src/formatter/helpers/summary_helpers_spec.ts +++ b/src/formatter/helpers/summary_helpers_spec.ts @@ -1,17 +1,17 @@ +import { PassThrough } from 'node:stream' import { afterEach, beforeEach, describe, it } from 'mocha' import { expect } from 'chai' +import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' +import * as messages from '@cucumber/messages' import getColorFns from '../get_color_fns' -import { formatSummary } from './summary_helpers' import { getTestCaseAttempts } from '../../../test/formatter_helpers' import { getBaseSupportCodeLibrary } from '../../../test/fixtures/steps' -import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' import timeMethods, { durationBetweenTimestamps } from '../../time' import { buildSupportCodeLibrary } from '../../../test/runtime_helpers' import { IRuntimeOptions } from '../../runtime' import { ISupportCodeLibrary } from '../../support_code_library_builder/types' import { doesNotHaveValue } from '../../value_checker' -import * as messages from '@cucumber/messages' -import { PassThrough } from 'node:stream' +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 7a4045d7f..9d87d59c1 100644 --- a/src/formatter/helpers/test_case_attempt_formatter.ts +++ b/src/formatter/helpers/test_case_attempt_formatter.ts @@ -1,17 +1,17 @@ import indentString from 'indent-string' import * as messages from '@cucumber/messages' import figures from 'figures' +import { IColorFns } from '../get_color_fns' +import { doesHaveValue, valueOrDefault } from '../../value_checker' +import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder' +import { ISupportCodeLibrary } from '../../support_code_library_builder/types' import { formatLocation } from './location_helpers' 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 3f92285fa..aa15c3aac 100644 --- a/src/formatter/helpers/test_case_attempt_parser.ts +++ b/src/formatter/helpers/test_case_attempt_parser.ts @@ -1,17 +1,17 @@ +import * as messages from '@cucumber/messages' +import { TestStepResult } from '@cucumber/messages' +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 { getStepKeywordType, KeywordType } from './keyword_type' import { getGherkinScenarioLocationMap, getGherkinStepMap, } from './gherkin_document_parser' 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 765fd3782..dba486da3 100644 --- a/src/formatter/helpers/test_case_attempt_parser_spec.ts +++ b/src/formatter/helpers/test_case_attempt_parser_spec.ts @@ -1,12 +1,12 @@ 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 { reindent } from 'reindent-template-literals' +import { getBaseSupportCodeLibrary } from '../../../test/fixtures/steps' +import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder' import { getTestCaseAttempts } from '../../../test/formatter_helpers' +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 aea8bc40a..5b0ccb052 100644 --- a/src/formatter/helpers/usage_helpers/index.ts +++ b/src/formatter/helpers/usage_helpers/index.ts @@ -1,6 +1,6 @@ +import * as messages from '@cucumber/messages' 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' diff --git a/src/formatter/helpers/usage_helpers/index_spec.ts b/src/formatter/helpers/usage_helpers/index_spec.ts index d8d1f7db5..da34b4bf4 100644 --- a/src/formatter/helpers/usage_helpers/index_spec.ts +++ b/src/formatter/helpers/usage_helpers/index_spec.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha' import { expect } from 'chai' -import { getUsage } from './' 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 72e6b5cc6..edd697d36 100644 --- a/src/formatter/html_formatter.ts +++ b/src/formatter/html_formatter.ts @@ -1,9 +1,9 @@ -import Formatter, { IFormatterOptions } from '.' +import { finished } from 'node:stream' +import { promisify } from 'node:util' import * as messages from '@cucumber/messages' import resolvePkg from 'resolve-pkg' import CucumberHtmlStream from '@cucumber/html-formatter' -import { finished } from 'node:stream' -import { promisify } from 'node:util' +import Formatter, { IFormatterOptions } from '.' export default class HtmlFormatter extends Formatter { private readonly _htmlStream: CucumberHtmlStream diff --git a/src/formatter/index.ts b/src/formatter/index.ts index 88202d0f4..e8d668877 100644 --- a/src/formatter/index.ts +++ b/src/formatter/index.ts @@ -1,10 +1,10 @@ -import { IColorFns } from './get_color_fns' -import { EventDataCollector } from './helpers' -import StepDefinitionSnippetBuilder from './step_definition_snippet_builder' import { Writable } from 'node:stream' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' import { EventEmitter } from 'node:events' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' import { valueOrDefault } from '../value_checker' +import { IColorFns } from './get_color_fns' +import { EventDataCollector } from './helpers' +import StepDefinitionSnippetBuilder from './step_definition_snippet_builder' import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax' export interface FormatRerunOptions { diff --git a/src/formatter/json_formatter.ts b/src/formatter/json_formatter.ts index 8544ee794..157d85305 100644 --- a/src/formatter/json_formatter.ts +++ b/src/formatter/json_formatter.ts @@ -1,14 +1,14 @@ -import Formatter, { IFormatterOptions } from './' -import { formatLocation, GherkinDocumentParser, PickleParser } from './helpers' import * as messages from '@cucumber/messages' +import { doesHaveValue, doesNotHaveValue } from '../value_checker' +import { parseStepArgument } from '../step_arguments' +import { formatLocation, GherkinDocumentParser, PickleParser } from './helpers' 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' import { durationToNanoseconds } from './helpers/duration_helpers' +import Formatter, { IFormatterOptions } from './' const { getGherkinStepMap, getGherkinScenarioMap } = GherkinDocumentParser diff --git a/src/formatter/json_formatter_spec.ts b/src/formatter/json_formatter_spec.ts index 83f9d7e72..d21acddd4 100644 --- a/src/formatter/json_formatter_spec.ts +++ b/src/formatter/json_formatter_spec.ts @@ -1,11 +1,11 @@ import { afterEach, beforeEach, describe, it } from 'mocha' import { expect } from 'chai' +import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' import { testFormatter } from '../../test/formatter_helpers' import { getJsonFormatterSupportCodeLibrary, getJsonFormatterSupportCodeLibraryWithHooks, } from '../../test/fixtures/json_formatter_steps' -import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' import timeMethods from '../time' import { IJsonFeature, IJsonScenario } from '../../lib/formatter/json_formatter' diff --git a/src/formatter/junit_formatter.ts b/src/formatter/junit_formatter.ts index c982bc1b1..03722198d 100644 --- a/src/formatter/junit_formatter.ts +++ b/src/formatter/junit_formatter.ts @@ -1,5 +1,4 @@ import xmlbuilder from 'xmlbuilder' -import Formatter, { IFormatterOptions } from './' import * as messages from '@cucumber/messages' import { Attachment, @@ -11,14 +10,15 @@ import { TestStepResult, TestStepResultStatus, } from '@cucumber/messages' -import { ITestCaseAttempt } from './helpers/event_data_collector' import { doesHaveValue } from '../value_checker' +import { valueOrDefault } from '../value_checker' +import { ITestCaseAttempt } from './helpers/event_data_collector' import { getGherkinExampleRuleMap, getGherkinStepMap, } from './helpers/gherkin_document_parser' import { getPickleStepMap, getStepKeyword } from './helpers/pickle_parser' -import { valueOrDefault } from '../value_checker' +import Formatter, { IFormatterOptions } from './' interface IJUnitTestSuite { name: string diff --git a/src/formatter/message_formatter.ts b/src/formatter/message_formatter.ts index 15f47b0e0..1390261e1 100644 --- a/src/formatter/message_formatter.ts +++ b/src/formatter/message_formatter.ts @@ -1,5 +1,5 @@ -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' diff --git a/src/formatter/progress_bar_formatter.ts b/src/formatter/progress_bar_formatter.ts index aeb4284df..bb9c0f554 100644 --- a/src/formatter/progress_bar_formatter.ts +++ b/src/formatter/progress_bar_formatter.ts @@ -1,11 +1,11 @@ -import { formatIssue, formatSummary, isIssue } from './helpers' -import Formatter, { IFormatterOptions } from './' -import ProgressBar from 'progress' import { WriteStream as TtyWriteStream } from 'node:tty' +import ProgressBar from 'progress' import * as messages from '@cucumber/messages' import { doesHaveValue, valueOrDefault } from '../value_checker' -import { formatUndefinedParameterType } from './helpers/issue_helpers' import { durationBetweenTimestamps } from '../time' +import { formatUndefinedParameterType } from './helpers/issue_helpers' +import { formatIssue, formatSummary, isIssue } from './helpers' +import Formatter, { IFormatterOptions } from './' // 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 b2afd20d4..3f41c39f7 100644 --- a/src/formatter/progress_bar_formatter_spec.ts +++ b/src/formatter/progress_bar_formatter_spec.ts @@ -1,26 +1,26 @@ +import { EventEmitter } from 'node:events' +import { PassThrough } from 'node:stream' +import { promisify } from 'node:util' import { afterEach, beforeEach, describe, it } from 'mocha' import { expect } from 'chai' import sinon from 'sinon' -import { EventEmitter } from 'node:events' -import { EventDataCollector } from './helpers' +import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' +import * as messages from '@cucumber/messages' +import ProgressBar from 'progress' 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 { doesHaveValue, doesNotHaveValue } from '../value_checker' -import { PassThrough } from 'node:stream' -import ProgressBar from 'progress' -import { promisify } from 'node:util' +import ProgressBarFormatter from './progress_bar_formatter' +import FormatterBuilder from './builder' +import { EventDataCollector } from './helpers' interface ITestProgressBarFormatterOptions { runtimeOptions?: Partial diff --git a/src/formatter/progress_formatter.ts b/src/formatter/progress_formatter.ts index cc6198c6c..340495099 100644 --- a/src/formatter/progress_formatter.ts +++ b/src/formatter/progress_formatter.ts @@ -1,7 +1,7 @@ -import SummaryFormatter from './summary_formatter' +import * as messages from '@cucumber/messages' import { doesHaveValue } from '../value_checker' +import SummaryFormatter from './summary_formatter' import { IFormatterOptions } from './index' -import * as messages from '@cucumber/messages' 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..38d87b0bd 100644 --- a/src/formatter/progress_formatter_spec.ts +++ b/src/formatter/progress_formatter_spec.ts @@ -1,10 +1,10 @@ import { afterEach, beforeEach, describe, it } from 'mocha' import { expect } from 'chai' -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 { testFormatter } from '../../test/formatter_helpers' +import { getBaseSupportCodeLibrary } from '../../test/fixtures/steps' import timeMethods from '../time' describe('ProgressFormatter', () => { diff --git a/src/formatter/rerun_formatter.ts b/src/formatter/rerun_formatter.ts index 54b62d0b4..2370757df 100644 --- a/src/formatter/rerun_formatter.ts +++ b/src/formatter/rerun_formatter.ts @@ -1,11 +1,11 @@ -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 { getGherkinScenarioLocationMap } from './helpers/gherkin_document_parser' +import Formatter, { IFormatterOptions } from './' const DEFAULT_SEPARATOR = '\n' diff --git a/src/formatter/snippets_formatter.ts b/src/formatter/snippets_formatter.ts index acce1cb72..0c03727f0 100644 --- a/src/formatter/snippets_formatter.ts +++ b/src/formatter/snippets_formatter.ts @@ -1,7 +1,7 @@ -import Formatter, { IFormatterOptions } from './' -import { parseTestCaseAttempt } from './helpers' -import { doesHaveValue } from '../value_checker' import * as messages from '@cucumber/messages' +import { doesHaveValue } from '../value_checker' +import { parseTestCaseAttempt } from './helpers' +import Formatter, { IFormatterOptions } from './' 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..adb16a647 100644 --- a/src/formatter/step_definition_snippet_builder/index.ts +++ b/src/formatter/step_definition_snippet_builder/index.ts @@ -1,12 +1,12 @@ -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 { KeywordType } from '../helpers' +import { parseStepArgument } from '../../step_arguments' import { doesHaveValue } from '../../value_checker' +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..2b54dc826 100644 --- a/src/formatter/step_definition_snippet_builder/index_spec.ts +++ b/src/formatter/step_definition_snippet_builder/index_spec.ts @@ -1,11 +1,11 @@ import { describe, it } from 'mocha' import { expect } from 'chai' -import { KeywordType } from '../helpers' -import StepDefinitionSnippetBuilder, { IBuildRequest } from './' import sinon from 'sinon' import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions' -import { ISnippetSyntaxBuildOptions } from './snippet_syntax' +import { KeywordType } from '../helpers' import { getPickleStepWithText } from '../../../test/gherkin_helpers' +import { ISnippetSyntaxBuildOptions } from './snippet_syntax' +import StepDefinitionSnippetBuilder, { IBuildRequest } from './' 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 cba92c094..8563adfd1 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,14 +1,14 @@ 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 { 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() diff --git a/src/formatter/summary_formatter.ts b/src/formatter/summary_formatter.ts index eb7e9db7f..0d4d58b11 100644 --- a/src/formatter/summary_formatter.ts +++ b/src/formatter/summary_formatter.ts @@ -1,10 +1,10 @@ -import { formatIssue, formatSummary, isFailure, isWarning } from './helpers' -import Formatter, { IFormatterOptions } from './' -import { doesHaveValue } from '../value_checker' import * as messages from '@cucumber/messages' +import { doesHaveValue } from '../value_checker' +import { durationBetweenTimestamps } from '../time' +import { formatIssue, formatSummary, isFailure, isWarning } from './helpers' import { ITestCaseAttempt } from './helpers/event_data_collector' import { formatUndefinedParameterTypes } from './helpers/issue_helpers' -import { durationBetweenTimestamps } from '../time' +import Formatter, { IFormatterOptions } from './' interface ILogIssuesRequest { issues: ITestCaseAttempt[] diff --git a/src/formatter/usage_formatter.ts b/src/formatter/usage_formatter.ts index 1dbf82fa2..a366c2c03 100644 --- a/src/formatter/usage_formatter.ts +++ b/src/formatter/usage_formatter.ts @@ -1,8 +1,8 @@ -import { formatLocation, getUsage } from './helpers' -import Formatter, { IFormatterOptions } from './' import Table from 'cli-table3' -import { doesHaveValue } from '../value_checker' import * as messages from '@cucumber/messages' +import { doesHaveValue } from '../value_checker' +import { formatLocation, getUsage } from './helpers' +import Formatter, { IFormatterOptions } from './' 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..b90c562b8 100644 --- a/src/formatter/usage_formatter_spec.ts +++ b/src/formatter/usage_formatter_spec.ts @@ -1,10 +1,10 @@ import { afterEach, beforeEach, describe, it } from 'mocha' import { expect } from 'chai' import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' +import { reindent } from 'reindent-template-literals' import timeMethods from '../time' import { getUsageSupportCodeLibrary } from '../../test/fixtures/usage_steps' import { testFormatter } from '../../test/formatter_helpers' -import { reindent } from 'reindent-template-literals' describe('UsageFormatter', () => { let clock: InstalledClock diff --git a/src/formatter/usage_json_formatter.ts b/src/formatter/usage_json_formatter.ts index 84f4b654c..cf40ad708 100644 --- a/src/formatter/usage_json_formatter.ts +++ b/src/formatter/usage_json_formatter.ts @@ -1,7 +1,7 @@ +import * as messages from '@cucumber/messages' +import { doesHaveValue } from '../value_checker' import { getUsage } from './helpers' import Formatter, { IFormatterOptions } from './' -import { doesHaveValue } from '../value_checker' -import * as messages from '@cucumber/messages' import IEnvelope = messages.Envelope export default class UsageJsonFormatter extends Formatter { diff --git a/src/index.ts b/src/index.ts index bfcabcdb3..1e79e222f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,5 @@ +import { deprecate } from 'node:util' +import * as messages from '@cucumber/messages' import { default as _Cli } from './cli' import * as cliHelpers from './cli/helpers' import * as formatterHelpers from './formatter/helpers' @@ -5,8 +7,6 @@ import { default as _PickleFilter } from './pickle_filter' import * as parallelCanAssignHelpers from './support_code_library_builder/parallel_can_assign_helpers' import { default as _Runtime } from './runtime' import supportCodeLibraryBuilder from './support_code_library_builder' -import * as messages from '@cucumber/messages' -import { deprecate } from 'node:util' // Top level export { default as supportCodeLibraryBuilder } from './support_code_library_builder' diff --git a/src/models/data_table_spec.ts b/src/models/data_table_spec.ts index 8be0c3ee7..ea81cd0fe 100644 --- a/src/models/data_table_spec.ts +++ b/src/models/data_table_spec.ts @@ -1,7 +1,7 @@ import { describe, it } from 'mocha' import { expect } from 'chai' -import DataTable from './data_table' import * as messages from '@cucumber/messages' +import DataTable from './data_table' const id = 'id' const location: messages.Location = { line: 0 } diff --git a/src/models/definition.ts b/src/models/definition.ts index 30b7d873a..90d75dc30 100644 --- a/src/models/definition.ts +++ b/src/models/definition.ts @@ -1,6 +1,6 @@ import * as messages from '@cucumber/messages' -import { ITestCaseHookParameter } from '../support_code_library_builder/types' import { Expression } from '@cucumber/cucumber-expressions' +import { ITestCaseHookParameter } from '../support_code_library_builder/types' import { GherkinStepKeyword } from './gherkin_step_keyword' export interface IGetInvocationDataRequest { diff --git a/src/models/step_definition.ts b/src/models/step_definition.ts index 0e5f207fd..dcf304ede 100644 --- a/src/models/step_definition.ts +++ b/src/models/step_definition.ts @@ -1,3 +1,6 @@ +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 +8,6 @@ import Definition, { IGetInvocationDataResponse, IStepDefinitionParameters, } from './definition' -import { parseStepArgument } from '../step_arguments' -import { Expression } from '@cucumber/cucumber-expressions' -import { doesHaveValue } from '../value_checker' import { GherkinStepKeyword } from './gherkin_step_keyword' export default class StepDefinition extends Definition implements IDefinition { diff --git a/src/models/test_case_hook_definition.ts b/src/models/test_case_hook_definition.ts index 737eb5ada..52baa131a 100644 --- a/src/models/test_case_hook_definition.ts +++ b/src/models/test_case_hook_definition.ts @@ -1,3 +1,4 @@ +import * as messages from '@cucumber/messages' import { PickleTagFilter } from '../pickle_filter' import Definition, { IDefinition, @@ -6,7 +7,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..59367eaba 100644 --- a/src/models/test_case_hook_definition_spec.ts +++ b/src/models/test_case_hook_definition_spec.ts @@ -1,7 +1,7 @@ import { describe, it } from 'mocha' import { expect } from 'chai' -import TestCaseHookDefinition from './test_case_hook_definition' 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..dd9afc5e0 100644 --- a/src/models/test_step_hook_definition.ts +++ b/src/models/test_step_hook_definition.ts @@ -1,3 +1,4 @@ +import * as messages from '@cucumber/messages' import { PickleTagFilter } from '../pickle_filter' import Definition, { IDefinition, @@ -6,7 +7,6 @@ import Definition, { IDefinitionParameters, 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..4127dc8bc 100644 --- a/src/models/test_step_hook_definition_spec.ts +++ b/src/models/test_step_hook_definition_spec.ts @@ -1,7 +1,7 @@ import { describe, it } from 'mocha' import { expect } from 'chai' -import TestStepHookDefinition from './test_step_hook_definition' 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 051797d51..7b49fac0c 100644 --- a/src/pickle_filter.ts +++ b/src/pickle_filter.ts @@ -1,8 +1,8 @@ import path from 'node:path' import parse from '@cucumber/tag-expressions' +import * as messages from '@cucumber/messages' 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 4f9863aa5..137421a9c 100644 --- a/src/pickle_filter_spec.ts +++ b/src/pickle_filter_spec.ts @@ -1,8 +1,8 @@ +import path from 'node:path' import { beforeEach, describe, it } from 'mocha' import { expect } from 'chai' -import path from 'node:path' -import PickleFilter from './pickle_filter' import { parse } from '../test/gherkin_helpers' +import PickleFilter from './pickle_filter' describe('PickleFilter', () => { const cwd = '/project' diff --git a/src/plugin/plugin_manager.ts b/src/plugin/plugin_manager.ts index 903a6e68e..d1f230f82 100644 --- a/src/plugin/plugin_manager.ts +++ b/src/plugin/plugin_manager.ts @@ -1,6 +1,6 @@ -import { Plugin, PluginCleanup, PluginEvents } from './types' import { IRunEnvironment, IRunOptions } from '../api' import { ILogger } from '../logger' +import { Plugin, PluginCleanup, PluginEvents } from './types' type HandlerRegistry = { [K in keyof PluginEvents]: Array<(value: PluginEvents[K]) => void> diff --git a/src/plugin/types.ts b/src/plugin/types.ts index 9cacd3b2b..4dd673521 100644 --- a/src/plugin/types.ts +++ b/src/plugin/types.ts @@ -1,5 +1,5 @@ -import { IRunEnvironment, IRunOptions } from '../api' import { Envelope } from '@cucumber/messages' +import { IRunEnvironment, IRunOptions } from '../api' import { ILogger } from '../logger' export interface PluginEvents { diff --git a/src/publish/http_stream.ts b/src/publish/http_stream.ts index 3c076013c..d8c4fd204 100644 --- a/src/publish/http_stream.ts +++ b/src/publish/http_stream.ts @@ -1,8 +1,8 @@ import { pipeline, Transform, Writable } from 'node:stream' -import tmp from 'tmp' import fs from 'node:fs' import http from 'node:http' import https from 'node:https' +import tmp from 'tmp' import { doesHaveValue } from '../value_checker' type HttpMethod = 'GET' | 'POST' | 'PUT' diff --git a/src/publish/publish_plugin.ts b/src/publish/publish_plugin.ts index 3e1d9bc86..185109f85 100644 --- a/src/publish/publish_plugin.ts +++ b/src/publish/publish_plugin.ts @@ -1,9 +1,9 @@ -import { Plugin } from '../plugin' -import HttpStream from './http_stream' import { Writable } from 'node:stream' import { supportsColor } from 'supports-color' import hasAnsi from 'has-ansi' import stripAnsi from 'strip-ansi' +import { Plugin } from '../plugin' +import HttpStream from './http_stream' const DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports' diff --git a/src/runtime/assemble_test_cases.ts b/src/runtime/assemble_test_cases.ts index fb7ad8919..be4b80aa4 100644 --- a/src/runtime/assemble_test_cases.ts +++ b/src/runtime/assemble_test_cases.ts @@ -1,8 +1,8 @@ import { EventEmitter } from 'node:events' import * as messages from '@cucumber/messages' import { IdGenerator } from '@cucumber/messages' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' import { Group } from '@cucumber/cucumber-expressions' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' 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 16abfc7d7..99a8326db 100644 --- a/src/runtime/assemble_test_cases_spec.ts +++ b/src/runtime/assemble_test_cases_spec.ts @@ -1,14 +1,14 @@ +import { EventEmitter } from 'node:events' import { IdGenerator } from '@cucumber/messages' import * as messages from '@cucumber/messages' -import { ISupportCodeLibrary } from '../support_code_library_builder/types' -import { EventEmitter } from 'node:events' -import { assembleTestCases, IAssembledTestCases } from './assemble_test_cases' import { afterEach, beforeEach, describe, it } from 'mocha' import FakeTimers, { InstalledClock } from '@sinonjs/fake-timers' +import { expect } from 'chai' import timeMethods from '../time' import { buildSupportCodeLibrary } from '../../test/runtime_helpers' import { parse } from '../../test/gherkin_helpers' -import { expect } from 'chai' +import { ISupportCodeLibrary } from '../support_code_library_builder/types' +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 38cf9eb82..eb8f4ed4e 100644 --- a/src/runtime/attachment_manager/index.ts +++ b/src/runtime/attachment_manager/index.ts @@ -1,5 +1,5 @@ -import isStream from 'is-stream' import { Readable } from 'node:stream' +import isStream from 'is-stream' import * as messages from '@cucumber/messages' import { doesHaveValue, doesNotHaveValue } from '../../value_checker' diff --git a/src/runtime/attachment_manager/index_spec.ts b/src/runtime/attachment_manager/index_spec.ts index e4d745035..f20ea0e7a 100644 --- a/src/runtime/attachment_manager/index_spec.ts +++ b/src/runtime/attachment_manager/index_spec.ts @@ -1,7 +1,7 @@ +import stream, { Readable } from 'node:stream' import { describe, it } from 'mocha' import { expect } from 'chai' import AttachmentManager, { IAttachment } from './' -import stream, { Readable } from 'node:stream' describe('AttachmentManager', () => { describe('create()', () => { diff --git a/src/runtime/format_error_spec.ts b/src/runtime/format_error_spec.ts index 75caafd6f..f093e19ea 100644 --- a/src/runtime/format_error_spec.ts +++ b/src/runtime/format_error_spec.ts @@ -1,5 +1,5 @@ -import { expect } from 'chai' import assert from 'node:assert' +import { expect } from 'chai' import { formatError } from './format_error' describe('formatError', () => { diff --git a/src/runtime/helpers.ts b/src/runtime/helpers.ts index 2b5c00643..770811ffe 100644 --- a/src/runtime/helpers.ts +++ b/src/runtime/helpers.ts @@ -1,9 +1,9 @@ -import { formatLocation } from '../formatter/helpers/location_helpers' import Table from 'cli-table3' import indentString from 'indent-string' +import * as messages from '@cucumber/messages' +import { formatLocation } from '../formatter/helpers/location_helpers' import { PickleTagFilter } from '../pickle_filter' import StepDefinition from '../models/step_definition' -import * as messages from '@cucumber/messages' import { IRuntimeOptions } from '.' export function getAmbiguousStepException( diff --git a/src/runtime/helpers_spec.ts b/src/runtime/helpers_spec.ts index f85c4d157..c3b26c55a 100644 --- a/src/runtime/helpers_spec.ts +++ b/src/runtime/helpers_spec.ts @@ -1,9 +1,9 @@ import { describe, it } from 'mocha' import { expect } from 'chai' -import { getAmbiguousStepException, retriesForPickle } from './helpers' import { getPickleWithTags } from '../../test/gherkin_helpers' import StepDefinition from '../models/step_definition' import { buildOptions } from '../../test/runtime_helpers' +import { getAmbiguousStepException, retriesForPickle } from './helpers' describe('Helpers', () => { describe('getAmbiguousStepException', () => { diff --git a/src/runtime/index.ts b/src/runtime/index.ts index d014ae6d5..35138a835 100644 --- a/src/runtime/index.ts +++ b/src/runtime/index.ts @@ -1,6 +1,6 @@ +import { EventEmitter } from 'node:events' import * as messages from '@cucumber/messages' import { IdGenerator } from '@cucumber/messages' -import { EventEmitter } from 'node:events' import { EventDataCollector } from '../formatter/helpers' import { ISupportCodeLibrary } from '../support_code_library_builder/types' import { assembleTestCases } from './assemble_test_cases' diff --git a/src/runtime/parallel/coordinator.ts b/src/runtime/parallel/coordinator.ts index b203d49bd..f52e715bc 100644 --- a/src/runtime/parallel/coordinator.ts +++ b/src/runtime/parallel/coordinator.ts @@ -1,17 +1,17 @@ import { ChildProcess, fork } from 'node:child_process' import path from 'node:path' -import { retriesForPickle, shouldCauseFailure } from '../helpers' -import * as messages from '@cucumber/messages' import { EventEmitter } from 'node:events' +import * as messages from '@cucumber/messages' +import { IdGenerator } from '@cucumber/messages' +import { retriesForPickle, shouldCauseFailure } from '../helpers' import { EventDataCollector } from '../../formatter/helpers' import { IRuntime, IRuntimeOptions } from '..' import { ISupportCodeLibrary } from '../../support_code_library_builder/types' -import { ICoordinatorReport, IWorkerCommand } from './command_types' import { doesHaveValue } from '../../value_checker' import { IStopwatch, create } from '../stopwatch' import { assembleTestCases, IAssembledTestCases } from '../assemble_test_cases' -import { IdGenerator } from '@cucumber/messages' import { ILogger } from '../../logger' +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..0c52a956a 100644 --- a/src/runtime/parallel/run_worker.ts +++ b/src/runtime/parallel/run_worker.ts @@ -1,6 +1,6 @@ -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 490e872ea..7b596a430 100644 --- a/src/runtime/parallel/worker.ts +++ b/src/runtime/parallel/worker.ts @@ -1,20 +1,20 @@ -import * as messages from '@cucumber/messages' -import { IdGenerator } from '@cucumber/messages' import { EventEmitter } from 'node:events' import { pathToFileURL } from 'node:url' +import * as messages from '@cucumber/messages' +import { IdGenerator } from '@cucumber/messages' import supportCodeLibraryBuilder from '../../support_code_library_builder' import { ISupportCodeLibrary } from '../../support_code_library_builder/types' import { doesHaveValue } from '../../value_checker' import { makeRunTestRunHooks, RunsTestRunHooks } from '../run_test_run_hooks' import { create } from '../stopwatch' import TestCaseRunner from '../test_case_runner' +import tryRequire from '../../try_require' import { ICoordinatorReport, IWorkerCommand, IWorkerCommandInitialize, IWorkerCommandRun, } from './command_types' -import tryRequire from '../../try_require' const { uuid } = IdGenerator diff --git a/src/runtime/run_test_run_hooks.ts b/src/runtime/run_test_run_hooks.ts index dd699aee4..04dc72f9e 100644 --- a/src/runtime/run_test_run_hooks.ts +++ b/src/runtime/run_test_run_hooks.ts @@ -1,5 +1,5 @@ -import UserCodeRunner from '../user_code_runner' import VError from 'verror' +import UserCodeRunner from '../user_code_runner' import { formatLocation } from '../formatter/helpers' import { doesHaveValue, valueOrDefault } from '../value_checker' import TestRunHookDefinition from '../models/test_run_hook_definition' diff --git a/src/runtime/step_runner.ts b/src/runtime/step_runner.ts index ae7bdcb4f..8fe882475 100644 --- a/src/runtime/step_runner.ts +++ b/src/runtime/step_runner.ts @@ -1,6 +1,5 @@ -import { create } from './stopwatch' -import UserCodeRunner from '../user_code_runner' import * as messages from '@cucumber/messages' +import UserCodeRunner from '../user_code_runner' import { ITestCaseHookParameter } from '../support_code_library_builder/types' import { IDefinition, IGetInvocationDataResponse } from '../models/definition' import { @@ -8,6 +7,7 @@ import { doesNotHaveValue, valueOrDefault, } from '../value_checker' +import { create } from './stopwatch' import { formatError } from './format_error' export interface IRunOptions { diff --git a/src/runtime/stopwatch_spec.ts b/src/runtime/stopwatch_spec.ts index 6bdbca792..017f44bd4 100644 --- a/src/runtime/stopwatch_spec.ts +++ b/src/runtime/stopwatch_spec.ts @@ -1,7 +1,7 @@ import { describe, it } from 'mocha' -import { create } from './stopwatch' import { expect } from 'chai' import { TimeConversion } from '@cucumber/messages' +import { create } from './stopwatch' describe('stopwatch', () => { it('returns a duration between the start and stop', async () => { diff --git a/src/runtime/test_case_runner.ts b/src/runtime/test_case_runner.ts index 4391812cd..7fb83d1de 100644 --- a/src/runtime/test_case_runner.ts +++ b/src/runtime/test_case_runner.ts @@ -1,9 +1,6 @@ -import { getAmbiguousStepException } from './helpers' -import AttachmentManager from './attachment_manager' -import StepRunner from './step_runner' +import { EventEmitter } from 'node:events' import * as messages from '@cucumber/messages' import { getWorstTestStepResult, IdGenerator } from '@cucumber/messages' -import { EventEmitter } from 'node:events' import { ISupportCodeLibrary, ITestCaseHookParameter, @@ -13,8 +10,11 @@ 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 { IStopwatch } from './stopwatch' import StepDefinition from '../models/step_definition' +import { IStopwatch } from './stopwatch' +import StepRunner from './step_runner' +import AttachmentManager from './attachment_manager' +import { getAmbiguousStepException } from './helpers' export interface INewTestCaseRunnerOptions { eventBroadcaster: EventEmitter diff --git a/src/runtime/test_case_runner_spec.ts b/src/runtime/test_case_runner_spec.ts index 019f4cf6e..e4b7485d1 100644 --- a/src/runtime/test_case_runner_spec.ts +++ b/src/runtime/test_case_runner_spec.ts @@ -1,17 +1,17 @@ -import { afterEach, beforeEach, describe, it } from 'mocha' -import { expect } from 'chai' -import sinon from 'sinon' -import TestCaseRunner from './test_case_runner' import { EventEmitter } from 'node:events' +import sinon from 'sinon' +import { expect } from 'chai' +import { afterEach, beforeEach, describe, it } from 'mocha' 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 { buildSupportCodeLibrary } from '../../test/runtime_helpers' +import { parse } from '../../test/gherkin_helpers' import timeMethods from '../time' import { getBaseSupportCodeLibrary } from '../../test/fixtures/steps' import { ISupportCodeLibrary } from '../support_code_library_builder/types' import { valueOrDefault } from '../value_checker' +import TestCaseRunner from './test_case_runner' import { create } from './stopwatch' import { assembleTestCases } from './assemble_test_cases' import IEnvelope = messages.Envelope 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 c6028b179..1dfed1723 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,6 +1,6 @@ import assert from 'node:assert' -import { getDefinitionLineAndUri } from './get_definition_line_and_uri' import path from 'node:path' +import { getDefinitionLineAndUri } from './get_definition_line_and_uri' describe(getDefinitionLineAndUri.name, () => { it('correctly gets the filename of the caller', () => { diff --git a/src/support_code_library_builder/index.ts b/src/support_code_library_builder/index.ts index 001348dff..04229190f 100644 --- a/src/support_code_library_builder/index.ts +++ b/src/support_code_library_builder/index.ts @@ -1,20 +1,20 @@ -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 arity from 'util-arity' +import { + CucumberExpression, + RegularExpression, +} from '@cucumber/cucumber-expressions' 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 { doesHaveValue, doesNotHaveValue } from '../value_checker' +import { ICanonicalSupportCodeIds } from '../runtime/parallel/command_types' +import { GherkinStepKeyword } from '../models/gherkin_step_keyword' import validateArguments from './validate_arguments' -import arity from 'util-arity' -import { - CucumberExpression, - RegularExpression, -} from '@cucumber/cucumber-expressions' -import { doesHaveValue, doesNotHaveValue } from '../value_checker' import { DefineStepPattern, IDefineStepOptions, @@ -31,8 +31,8 @@ import { IDefineStep, } from './types' import World from './world' -import { ICanonicalSupportCodeIds } from '../runtime/parallel/command_types' -import { GherkinStepKeyword } from '../models/gherkin_step_keyword' +import { getDefinitionLineAndUri } from './get_definition_line_and_uri' +import { buildParameterType } from './build_parameter_type' import { SourcedParameterTypeRegistry } from './sourced_parameter_type_registry' interface IStepDefinitionConfig { diff --git a/src/support_code_library_builder/index_spec.ts b/src/support_code_library_builder/index_spec.ts index 82c2a7d8a..6ab75771b 100644 --- a/src/support_code_library_builder/index_spec.ts +++ b/src/support_code_library_builder/index_spec.ts @@ -2,9 +2,9 @@ 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 { getPickleWithTags } from '../../test/gherkin_helpers' +import supportCodeLibraryBuilder from './' const { uuid } = IdGenerator diff --git a/src/support_code_library_builder/parallel_can_assign_helpers_spec.ts b/src/support_code_library_builder/parallel_can_assign_helpers_spec.ts index f6d819b49..3b1994c7f 100644 --- a/src/support_code_library_builder/parallel_can_assign_helpers_spec.ts +++ b/src/support_code_library_builder/parallel_can_assign_helpers_spec.ts @@ -1,6 +1,6 @@ -import { atMostOnePicklePerTag } from './parallel_can_assign_helpers' import * as messages from '@cucumber/messages' import { expect } from 'chai' +import { atMostOnePicklePerTag } from './parallel_can_assign_helpers' function pickleWithTags(tagNames: string[]): messages.Pickle { return { diff --git a/src/user_code_runner.ts b/src/user_code_runner.ts index 88d9e11f7..5fec11612 100644 --- a/src/user_code_runner.ts +++ b/src/user_code_runner.ts @@ -1,6 +1,6 @@ +import util from 'node:util' import { wrapPromiseWithTimeout } from './time' import UncaughtExceptionManager from './uncaught_exception_manager' -import util from 'node: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..5a5bece6f 100644 --- a/src/user_code_runner_spec.ts +++ b/src/user_code_runner_spec.ts @@ -1,7 +1,7 @@ import { describe, it } from 'mocha' import { expect } from 'chai' -import UserCodeRunner, { IRunRequest, IRunResponse } from './user_code_runner' import semver from 'semver' +import UserCodeRunner, { IRunRequest, IRunResponse } from './user_code_runner' async function testUserCodeRunner( opts: Partial diff --git a/test/fake_logger.ts b/test/fake_logger.ts index b85805b53..1c5a0fd34 100644 --- a/test/fake_logger.ts +++ b/test/fake_logger.ts @@ -1,5 +1,5 @@ -import { ILogger } from '../src/logger' import sinon from 'sinon' +import { ILogger } from '../src/logger' export class FakeLogger implements ILogger { debug = sinon.fake() diff --git a/test/fake_report_server.ts b/test/fake_report_server.ts index 4af344a3f..1be38d1df 100644 --- a/test/fake_report_server.ts +++ b/test/fake_report_server.ts @@ -1,7 +1,7 @@ import { Server } from 'node:net' -import express from 'express' import { pipeline, Writable } from 'node:stream' import http from 'node:http' +import express from 'express' 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 c03ed9343..a8d709c6c 100644 --- a/test/fixtures/json_formatter_steps.ts +++ b/test/fixtures/json_formatter_steps.ts @@ -1,8 +1,8 @@ // Tests depend on the lines the steps are defined on +import { InstalledClock } from '@sinonjs/fake-timers' import { buildSupportCodeLibrary } from '../runtime_helpers' import { ISupportCodeLibrary } from '../../src/support_code_library_builder/types' -import { InstalledClock } from '@sinonjs/fake-timers' import { World } from '../../src' export function getJsonFormatterSupportCodeLibrary( diff --git a/test/fixtures/usage_steps.ts b/test/fixtures/usage_steps.ts index 7d37e91d2..28078b2cf 100644 --- a/test/fixtures/usage_steps.ts +++ b/test/fixtures/usage_steps.ts @@ -1,8 +1,8 @@ // Tests depend on the lines the steps are defined on +import { InstalledClock } from '@sinonjs/fake-timers' import { buildSupportCodeLibrary } from '../runtime_helpers' import { ISupportCodeLibrary } from '../../src/support_code_library_builder/types' -import { InstalledClock } from '@sinonjs/fake-timers' export function getUsageSupportCodeLibrary( clock: InstalledClock diff --git a/test/formatter_helpers.ts b/test/formatter_helpers.ts index 1fe37cfe4..f769ada5f 100644 --- a/test/formatter_helpers.ts +++ b/test/formatter_helpers.ts @@ -1,18 +1,18 @@ -import { buildOptions, buildSupportCodeLibrary } from './runtime_helpers' -import { generateEvents } from './gherkin_helpers' -import Runtime, { IRuntimeOptions } from '../src/runtime' import { EventEmitter } from 'node:events' -import { EventDataCollector } from '../src/formatter/helpers' -import FormatterBuilder from '../src/formatter/builder' +import { PassThrough } from 'node:stream' +import { promisify } from 'node:util' import { IdGenerator } from '@cucumber/messages' import * as messages from '@cucumber/messages' +import Runtime, { IRuntimeOptions } from '../src/runtime' +import { EventDataCollector } from '../src/formatter/helpers' +import FormatterBuilder from '../src/formatter/builder' 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 { PassThrough } from 'node:stream' import { emitSupportCodeMessages } from '../src/cli/helpers' -import { promisify } from 'node:util' import { FormatOptions } from '../src/formatter' +import { generateEvents } from './gherkin_helpers' +import { buildOptions, buildSupportCodeLibrary } from './runtime_helpers' const { uuid } = IdGenerator diff --git a/test/gherkin_helpers.ts b/test/gherkin_helpers.ts index b15806b9e..1e544f98f 100644 --- a/test/gherkin_helpers.ts +++ b/test/gherkin_helpers.ts @@ -1,9 +1,9 @@ +import { EventEmitter } from 'node:events' 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 { EventEmitter } from 'node:events' +import { doesHaveValue } from '../src/value_checker' export interface IParsedSource { pickles: messages.Pickle[] diff --git a/test/runtime_helpers.ts b/test/runtime_helpers.ts index 90ba04816..9d7d13e49 100644 --- a/test/runtime_helpers.ts +++ b/test/runtime_helpers.ts @@ -1,5 +1,5 @@ -import { SupportCodeLibraryBuilder } from '../src/support_code_library_builder' import { IdGenerator } from '@cucumber/messages' +import { SupportCodeLibraryBuilder } from '../src/support_code_library_builder' import { IRuntimeOptions } from '../src/runtime' import { IDefineSupportCodeMethods,