@cucumber/cucumber 11.1.1 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/lib/api/convert_configuration.d.ts +1 -2
- package/lib/api/convert_configuration.js +1 -2
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/formatters.d.ts +1 -3
- package/lib/api/formatters.js +2 -3
- package/lib/api/formatters.js.map +1 -1
- package/lib/api/gherkin.js +1 -2
- package/lib/api/gherkin.js.map +1 -1
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js.map +1 -1
- package/lib/api/load_configuration.d.ts +2 -1
- package/lib/api/load_configuration.js +3 -4
- package/lib/api/load_configuration.js.map +1 -1
- package/lib/api/load_sources.d.ts +2 -1
- package/lib/api/load_sources.js +4 -5
- package/lib/api/load_sources.js.map +1 -1
- package/lib/api/load_support.d.ts +2 -1
- package/lib/api/load_support.js +4 -5
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/plugins.d.ts +5 -5
- package/lib/api/plugins.js +12 -13
- package/lib/api/plugins.js.map +1 -1
- package/lib/api/run_cucumber.d.ts +2 -1
- package/lib/api/run_cucumber.js +4 -5
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/support.d.ts +1 -1
- package/lib/api/support.js +1 -2
- package/lib/api/support.js.map +1 -1
- package/lib/api/test_helpers.d.ts +1 -1
- package/lib/api/test_helpers.js +2 -3
- package/lib/api/test_helpers.js.map +1 -1
- package/lib/api/types.d.ts +0 -35
- package/lib/api/types.js.map +1 -1
- package/lib/assemble/assemble_test_cases.d.ts +1 -7
- package/lib/assemble/assemble_test_cases.js +3 -3
- package/lib/assemble/assemble_test_cases.js.map +1 -1
- package/lib/cli/helpers.d.ts +1 -3
- package/lib/cli/helpers.js +61 -33
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +2 -3
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +0 -1
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/install_validator.js +1 -2
- package/lib/cli/install_validator.js.map +1 -1
- package/lib/cli/run.js +1 -1
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.js +1 -2
- package/lib/cli/validate_node_engine_version.js.map +1 -1
- package/lib/configuration/argv_parser.js.map +1 -1
- package/lib/configuration/check_schema.js +18 -9
- package/lib/configuration/check_schema.js.map +1 -1
- package/lib/configuration/from_file.d.ts +1 -1
- package/lib/configuration/from_file.js +3 -4
- package/lib/configuration/from_file.js.map +1 -1
- package/lib/configuration/helpers.js +1 -2
- package/lib/configuration/helpers.js.map +1 -1
- package/lib/configuration/locate_file.js +1 -2
- package/lib/configuration/locate_file.js.map +1 -1
- package/lib/configuration/merge_configurations.js +1 -2
- package/lib/configuration/merge_configurations.js.map +1 -1
- package/lib/configuration/parse_configuration.d.ts +1 -1
- package/lib/configuration/parse_configuration.js +1 -2
- package/lib/configuration/parse_configuration.js.map +1 -1
- package/lib/configuration/split_format_descriptor.d.ts +1 -1
- package/lib/configuration/split_format_descriptor.js +1 -2
- package/lib/configuration/split_format_descriptor.js.map +1 -1
- package/lib/configuration/validate_configuration.d.ts +1 -1
- package/lib/configuration/validate_configuration.js +1 -2
- package/lib/configuration/validate_configuration.js.map +1 -1
- package/lib/environment/console_logger.d.ts +11 -0
- package/lib/{api → environment}/console_logger.js +6 -6
- package/lib/environment/console_logger.js.map +1 -0
- package/lib/environment/index.d.ts +2 -0
- package/lib/environment/index.js +19 -0
- package/lib/environment/index.js.map +1 -0
- package/lib/environment/make_environment.d.ts +2 -0
- package/lib/{api/environment.js → environment/make_environment.js} +3 -4
- package/lib/environment/make_environment.js.map +1 -0
- package/lib/environment/types.d.ts +41 -0
- package/lib/{logger.js → environment/types.js} +1 -1
- package/lib/environment/types.js.map +1 -0
- package/lib/filter_stack_trace.js +2 -3
- package/lib/filter_stack_trace.js.map +1 -1
- package/lib/formatter/builder.d.ts +1 -5
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/builtin/html.js +1 -4
- package/lib/formatter/builtin/html.js.map +1 -1
- package/lib/formatter/builtin/index.d.ts +1 -1
- package/lib/formatter/create_stream.d.ts +1 -2
- package/lib/formatter/create_stream.js +1 -2
- package/lib/formatter/create_stream.js.map +1 -1
- package/lib/formatter/find_class_or_plugin.js +1 -2
- package/lib/formatter/find_class_or_plugin.js.map +1 -1
- package/lib/formatter/get_color_fns.d.ts +0 -2
- package/lib/formatter/get_color_fns.js +1 -1
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/duration_helpers.js +2 -3
- package/lib/formatter/helpers/duration_helpers.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +0 -1
- package/lib/formatter/helpers/event_data_collector.js +17 -7
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/gherkin_document_parser.js +4 -5
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/index.js +17 -7
- package/lib/formatter/helpers/index.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.js +6 -7
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +3 -3
- package/lib/formatter/helpers/keyword_type.js.map +1 -1
- package/lib/formatter/helpers/location_helpers.js +1 -2
- package/lib/formatter/helpers/location_helpers.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js +4 -5
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js +1 -2
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.js +18 -9
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js +18 -9
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js +18 -9
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js +18 -9
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/import_code.js +1 -2
- package/lib/formatter/import_code.js.map +1 -1
- package/lib/formatter/index.d.ts +0 -2
- package/lib/formatter/json_formatter.js +17 -7
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.js +17 -7
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/rerun_formatter.js +17 -7
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/resolve_implementation.js +1 -2
- package/lib/formatter/resolve_implementation.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +17 -7
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.js +17 -7
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +17 -7
- package/lib/index.js.map +1 -1
- package/lib/models/data_table.js.map +1 -1
- package/lib/models/step_definition.js.map +1 -1
- package/lib/paths/paths.d.ts +1 -1
- package/lib/paths/paths.js +1 -2
- package/lib/paths/paths.js.map +1 -1
- package/lib/pickle_filter.js.map +1 -1
- package/lib/plugin/plugin_manager.d.ts +5 -4
- package/lib/plugin/plugin_manager.js +14 -6
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/plugin/types.d.ts +4 -3
- package/lib/plugin/types.js.map +1 -1
- package/lib/publish/publish_plugin.js +46 -16
- package/lib/publish/publish_plugin.js.map +1 -1
- package/lib/runtime/attachment_manager/index.d.ts +0 -2
- package/lib/runtime/attachment_manager/index.js +17 -7
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/coordinator.d.ts +0 -1
- package/lib/runtime/coordinator.js +4 -6
- package/lib/runtime/coordinator.js.map +1 -1
- package/lib/runtime/format_error.js +1 -2
- package/lib/runtime/format_error.js.map +1 -1
- package/lib/runtime/helpers.js +20 -11
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/make_runtime.d.ts +3 -3
- package/lib/runtime/make_runtime.js +1 -2
- package/lib/runtime/make_runtime.js.map +1 -1
- package/lib/runtime/parallel/adapter.d.ts +2 -4
- package/lib/runtime/parallel/adapter.js.map +1 -1
- package/lib/runtime/parallel/run_worker.js.map +1 -1
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/run_test_run_hooks.js.map +1 -1
- package/lib/runtime/scope/make_proxy.js +1 -2
- package/lib/runtime/scope/make_proxy.js.map +1 -1
- package/lib/runtime/scope/test_case_scope.js +2 -2
- package/lib/runtime/scope/test_case_scope.js.map +1 -1
- package/lib/runtime/scope/test_run_scope.js +2 -2
- package/lib/runtime/scope/test_run_scope.js.map +1 -1
- package/lib/runtime/serial/adapter.d.ts +0 -1
- package/lib/runtime/serial/adapter.js.map +1 -1
- package/lib/runtime/step_runner.js +24 -13
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +0 -1
- package/lib/runtime/test_case_runner.js +17 -7
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/runtime/worker.d.ts +0 -1
- package/lib/runtime/worker.js.map +1 -1
- package/lib/step_arguments.js +1 -2
- package/lib/step_arguments.js.map +1 -1
- package/lib/support_code_library_builder/build_parameter_type.js +1 -2
- package/lib/support_code_library_builder/build_parameter_type.js.map +1 -1
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +1 -2
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -1
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js +1 -2
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -1
- package/lib/support_code_library_builder/validate_arguments.js +1 -1
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
- package/lib/time.d.ts +0 -2
- package/lib/time.js +19 -10
- package/lib/time.js.map +1 -1
- package/lib/try_require.js +1 -1
- package/lib/try_require.js.map +1 -1
- package/lib/tsconfig.node.tsbuildinfo +1 -0
- package/lib/uncaught_exception_manager.d.ts +0 -1
- package/lib/user_code_runner.js.map +1 -1
- package/lib/value_checker.js +3 -4
- package/lib/value_checker.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +53 -55
- package/lib/api/console_logger.d.ts +0 -12
- package/lib/api/console_logger.js.map +0 -1
- package/lib/api/environment.d.ts +0 -7
- package/lib/api/environment.js.map +0 -1
- package/lib/logger.d.ts +0 -5
- package/lib/logger.js.map +0 -1
- package/lib/publish/http_stream.d.ts +0 -30
- package/lib/publish/http_stream.js +0 -117
- package/lib/publish/http_stream.js.map +0 -1
package/lib/api/test_helpers.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.setupEnvironment = setupEnvironment;
|
|
7
|
+
exports.teardownEnvironment = teardownEnvironment;
|
|
7
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
9
|
const node_stream_1 = require("node:stream");
|
|
9
10
|
const fs_1 = __importDefault(require("mz/fs"));
|
|
@@ -24,7 +25,6 @@ async function setupEnvironment() {
|
|
|
24
25
|
const stdout = new node_stream_1.PassThrough();
|
|
25
26
|
return { cwd, stdout };
|
|
26
27
|
}
|
|
27
|
-
exports.setupEnvironment = setupEnvironment;
|
|
28
28
|
async function teardownEnvironment(environment) {
|
|
29
29
|
return new Promise((resolve) => {
|
|
30
30
|
fs_1.default.rm(environment.cwd, { recursive: true }, resolve);
|
|
@@ -32,5 +32,4 @@ async function teardownEnvironment(environment) {
|
|
|
32
32
|
environment.stdout.end();
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
exports.teardownEnvironment = teardownEnvironment;
|
|
36
35
|
//# sourceMappingURL=test_helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_helpers.js","sourceRoot":"","sources":["../../src/api/test_helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test_helpers.js","sourceRoot":"","sources":["../../src/api/test_helpers.ts"],"names":[],"mappings":";;;;;AASA,4CAsBC;AAED,kDAMC;AAvCD,0DAA4B;AAC5B,6CAAyC;AACzC,+CAAsB;AACtB,2EAAqD;AACrD,iDAAgD;AAGhD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;AAEzB,KAAK,UAAU,gBAAgB;IACpC,MAAM,GAAG,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,KAAK,EAAE,EAAE,CAAC,CAAA;IACrE,MAAM,YAAE,CAAC,KAAK,CAAC,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC/D,MAAM,YAAE,CAAC,SAAS,CAChB,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,cAAc,CAAC,EAC1C,IAAA,qCAAQ,EAAC;;;0BAGa,CAAC,CACxB,CAAA;IACD,MAAM,YAAE,CAAC,SAAS,CAChB,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,EACtC,IAAA,qCAAQ,EAAC;;yCAE4B,CAAC,CACvC,CAAA;IACD,MAAM,YAAE,CAAC,SAAS,CAChB,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAC9B,wHAAwH,CACzH,CAAA;IACD,MAAM,MAAM,GAAG,IAAI,yBAAW,EAAE,CAAA;IAChC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA;AACxB,CAAC;AAEM,KAAK,UAAU,mBAAmB,CAAC,WAA4B;IACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,YAAE,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;IAC1B,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import path from 'node:path'\nimport { PassThrough } from 'node:stream'\nimport fs from 'mz/fs'\nimport { reindent } from 'reindent-template-literals'\nimport { IdGenerator } from '@cucumber/messages'\nimport { IRunEnvironment } from '../environment'\n\nconst newId = IdGenerator.uuid()\n\nexport async function setupEnvironment(): Promise<Partial<IRunEnvironment>> {\n const cwd = path.join(__dirname, '..', '..', 'tmp', `api_${newId()}`)\n await fs.mkdir(path.join(cwd, 'features'), { recursive: true })\n await fs.writeFile(\n path.join(cwd, 'features', 'test.feature'),\n reindent(`Feature: test fixture\n Scenario: one\n Given a step\n Then another step`)\n )\n await fs.writeFile(\n path.join(cwd, 'features', 'steps.ts'),\n reindent(`import { Given, Then } from '../../../src'\n Given('a step', function () {})\n Then('another step', function () {})`)\n )\n await fs.writeFile(\n path.join(cwd, 'cucumber.mjs'),\n `export default {paths: ['features/test.feature'], requireModule: ['ts-node/register'], require: ['features/steps.ts']}`\n )\n const stdout = new PassThrough()\n return { cwd, stdout }\n}\n\nexport async function teardownEnvironment(environment: IRunEnvironment) {\n return new Promise((resolve) => {\n fs.rm(environment.cwd, { recursive: true }, resolve)\n }).then(() => {\n environment.stdout.end()\n })\n}\n"]}
|
package/lib/api/types.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { Writable } from 'node:stream';
|
|
4
1
|
import { JsonObject } from 'type-fest';
|
|
5
2
|
import { IPublishConfig } from '../publish';
|
|
6
3
|
import { IConfiguration } from '../configuration';
|
|
@@ -280,38 +277,6 @@ export interface IRunOptions {
|
|
|
280
277
|
runtime: IRunOptionsRuntime;
|
|
281
278
|
formats: IRunOptionsFormats;
|
|
282
279
|
}
|
|
283
|
-
/**
|
|
284
|
-
* Contextual data about the project environment
|
|
285
|
-
* @public
|
|
286
|
-
*/
|
|
287
|
-
export interface IRunEnvironment {
|
|
288
|
-
/**
|
|
289
|
-
* Working directory for the project
|
|
290
|
-
* @default process.cwd()
|
|
291
|
-
*/
|
|
292
|
-
cwd?: string;
|
|
293
|
-
/**
|
|
294
|
-
* Writable stream where the test run's main formatter output is written
|
|
295
|
-
* @default process.stdout
|
|
296
|
-
*/
|
|
297
|
-
stdout?: Writable;
|
|
298
|
-
/**
|
|
299
|
-
* Writable stream where the test run's warning/error output is written
|
|
300
|
-
* @default process.stderr
|
|
301
|
-
*/
|
|
302
|
-
stderr?: Writable;
|
|
303
|
-
/**
|
|
304
|
-
* Environment variables
|
|
305
|
-
* @default process.env
|
|
306
|
-
*/
|
|
307
|
-
env?: NodeJS.ProcessEnv;
|
|
308
|
-
/**
|
|
309
|
-
* Whether debug logging should be emitted to {@link IRunEnvironment.stderr}
|
|
310
|
-
* @default false
|
|
311
|
-
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md}
|
|
312
|
-
*/
|
|
313
|
-
debug?: boolean;
|
|
314
|
-
}
|
|
315
280
|
/**
|
|
316
281
|
* Response from {@link runCucumber}
|
|
317
282
|
* @public
|
package/lib/api/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonObject } from 'type-fest'\nimport { IPublishConfig } from '../publish'\nimport { IConfiguration } from '../configuration'\nimport { IPickleOrder } from '../filter'\n\n/**\n * Options for {@link loadConfiguration}\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from, or `false` to skip\n * @default `cucumber.(json|yaml|yml|js|cjs|mjs)`\n */\n file?: string | false\n /**\n * Zero or more profile names from which to source configuration in the file\n * @remarks\n * If omitted or empty, the `default` profile will be used.\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be merged over the top of whatever is\n * loaded from the configuration file/profiles\n * @example\n * \\{\n * failFast: true,\n * parallel: 2\n * \\}\n * @example [\"--fail-fast\", \"--parallel\", \"2\"]\n * @example \"--fail-fast --parallel 2\"\n * @remarks\n * This can also be provided as an array or single string of argv-style\n * arguments.\n */\n provided?: Partial<IConfiguration> | string[] | string\n}\n\n/**\n * Response from {@link loadConfiguration}\n * @public\n */\nexport interface IResolvedConfiguration {\n /**\n * The final flat configuration object resolved from the configuration\n * file/profiles plus any extra provided\n */\n useConfiguration: IConfiguration\n /**\n * The format that can be passed into {@link runCucumber}\n */\n runConfiguration: IRunConfiguration\n}\n\n/**\n * Options relating to sources (i.e. feature files) - where to load them from,\n * how to interpret, filter and order them\n * @public\n */\nexport interface ISourcesCoordinates {\n /**\n * Default Gherkin dialect\n * @remarks\n * Used if no dialect is specified in the feature file itself.\n */\n defaultDialect: string\n /**\n * Paths and/or glob expressions to feature files\n */\n paths: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n */\n names: string[]\n /**\n * Tag expression to filter which scenarios should be run\n */\n tagExpression: string\n /**\n * Run in the order defined, or in a random order\n */\n order: IPickleOrder\n}\n\n/**\n * A pickle that has been successfully compiled from a source\n * @public\n */\nexport interface IPlannedPickle {\n /**\n * Name of the pickle (after parameter resolution)\n */\n name: string\n uri: string\n location: {\n line: number\n column?: number\n }\n}\n\n/**\n * An error encountered when parsing a source\n * @public\n */\nexport interface ISourcesError {\n uri: string\n location: {\n line: number\n column?: number\n }\n /**\n * Error message explaining what went wrong with the parse\n */\n message: string\n}\n\n/**\n * Response from {@link loadSources}\n * @public\n */\nexport interface ILoadSourcesResult {\n /**\n * Pickles that have been successfully compiled, in the order they would be\n * run in\n */\n plan: IPlannedPickle[]\n /**\n * Any errors encountered when parsing sources\n */\n errors: ISourcesError[]\n}\n\n/**\n * Options relating to user code (aka support code) - where to load it from and\n * how to preprocess it\n * @public\n */\nexport interface ISupportCodeCoordinates {\n /**\n * Names of transpilation modules to load, via `require()`\n */\n requireModules: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `require()`\n */\n requirePaths: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `import()`\n */\n importPaths: string[]\n /**\n * Specifiers of loaders to register, via `register()`\n */\n loaders: string[]\n}\n\n/**\n * Options for {@link loadSupport}\n * @public\n * @remarks\n * A subset of {@link IRunConfiguration}\n */\nexport interface ILoadSupportOptions {\n /**\n * @remarks\n * This is needed because the default support path locations are derived from\n * feature file locations.\n */\n sources: ISourcesCoordinates\n support: Partial<ISupportCodeCoordinates>\n}\n\n/**\n * Options relating to behaviour when actually running tests\n * @public\n */\nexport interface IRunOptionsRuntime {\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n */\n dryRun: boolean\n /**\n * Stop running tests when a test fails\n */\n failFast: boolean\n /**\n * Filter out stack frames from Cucumber's code when formatting stack traces\n */\n filterStacktraces: boolean\n /**\n * Run tests in parallel with the given number of worker processes\n */\n parallel: number\n /**\n * Retry failing tests up to the given number of times\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n */\n strict: boolean\n /**\n * Parameters to be passed to the World\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n\n/**\n * Options relating to formatters - which ones to use, where to write their\n * output, how they should behave\n * @public\n */\nexport interface IRunOptionsFormats {\n /**\n * Name/path of the formatter to use for `stdout` output\n */\n stdout: string\n /**\n * Zero or more mappings of file output path (key) to name/path of the\n * formatter to use (value)\n * @example\n * \\{\n * \"./reports/cucumber.html\": \"html\",\n * \"./reports/custom.txt\": \"./custom-formatter.js\"\n * \\}\n */\n files: Record<string, string>\n /**\n * Options for report publication, or `false` to disable publication\n */\n publish: IPublishConfig | false\n /**\n * Options to be provided to formatters\n * @remarks\n * The value must be a JSON-serializable object.\n */\n options: JsonObject\n}\n\n/**\n * Structured configuration object suitable for passing to {@link runCucumber}\n * @public\n */\nexport interface IRunConfiguration {\n sources: ISourcesCoordinates\n support: Partial<ISupportCodeCoordinates>\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * A collection of user-defined code and setup (\"support code\") that can be\n * used for a test run\n * @public\n * @remarks\n * This is mostly a marker interface. The actual instance is a complex object\n * that you shouldn't interact with directly, but some functions return and/or\n * accept it as a means of optimising a test workflow.\n */\nexport interface ISupportCodeLibrary {\n readonly originalCoordinates: ISupportCodeCoordinates\n}\n\n/**\n * Either an actual {@link ISupportCodeLibrary | support code library}, or the\n * {@link ISupportCodeCoordinates | coordinates} required to create and\n * populate one\n * @public\n * @remarks\n * This alias exists because {@link runCucumber} will accept an existing\n * support code library in its options and thus avoid trying to load it again,\n * improving performance and avoiding cache issues for use cases where multiple\n * test runs happen within the same process. Note this is only useful in serial\n * mode, as parallel workers will each load the support code themselves anyway.\n */\nexport type ISupportCodeCoordinatesOrLibrary =\n | Partial<ISupportCodeCoordinates>\n | ISupportCodeLibrary\n\n/**\n * Options for {@link runCucumber}\n * @public\n */\nexport interface IRunOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinatesOrLibrary\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * Response from {@link runCucumber}\n * @public\n */\nexport interface IRunResult {\n /**\n * Whether the test run was overall successful\n * @remarks\n * The exact meaning can vary based on the `strict` configuration option.\n */\n success: boolean\n /**\n * The support code library that was used in the test run\n * @remarks\n * This can be reused in subsequent {@link runCucumber} calls,\n * see {@link ISupportCodeCoordinatesOrLibrary}\n */\n support: ISupportCodeLibrary\n}\n"]}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { EventEmitter } from 'node:events';
|
|
3
2
|
import { IdGenerator } from '@cucumber/messages';
|
|
4
3
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
5
4
|
import { AssembledTestCase, SourcedPickle } from './types';
|
|
6
|
-
export declare function assembleTestCases(
|
|
7
|
-
eventBroadcaster: EventEmitter;
|
|
8
|
-
newId: IdGenerator.NewId;
|
|
9
|
-
sourcedPickles: ReadonlyArray<SourcedPickle>;
|
|
10
|
-
supportCodeLibrary: SupportCodeLibrary;
|
|
11
|
-
}): Promise<ReadonlyArray<AssembledTestCase>>;
|
|
5
|
+
export declare function assembleTestCases(testRunStartedId: string, eventBroadcaster: EventEmitter, newId: IdGenerator.NewId, sourcedPickles: ReadonlyArray<SourcedPickle>, supportCodeLibrary: SupportCodeLibrary): Promise<ReadonlyArray<AssembledTestCase>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assembleTestCases =
|
|
3
|
+
exports.assembleTestCases = assembleTestCases;
|
|
4
4
|
const value_checker_1 = require("../value_checker");
|
|
5
|
-
async function assembleTestCases(
|
|
5
|
+
async function assembleTestCases(testRunStartedId, eventBroadcaster, newId, sourcedPickles, supportCodeLibrary) {
|
|
6
6
|
return sourcedPickles.map(({ gherkinDocument, pickle }) => {
|
|
7
7
|
const testCaseId = newId();
|
|
8
8
|
const fromBeforeHooks = makeBeforeHookSteps({
|
|
@@ -21,6 +21,7 @@ async function assembleTestCases({ eventBroadcaster, newId, sourcedPickles, supp
|
|
|
21
21
|
newId,
|
|
22
22
|
});
|
|
23
23
|
const testCase = {
|
|
24
|
+
testRunStartedId,
|
|
24
25
|
pickleId: pickle.id,
|
|
25
26
|
id: testCaseId,
|
|
26
27
|
testSteps: [
|
|
@@ -37,7 +38,6 @@ async function assembleTestCases({ eventBroadcaster, newId, sourcedPickles, supp
|
|
|
37
38
|
};
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
exports.assembleTestCases = assembleTestCases;
|
|
41
41
|
function makeAfterHookSteps({ supportCodeLibrary, pickle, newId, }) {
|
|
42
42
|
return supportCodeLibrary.afterTestCaseHookDefinitions
|
|
43
43
|
.slice(0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble_test_cases.js","sourceRoot":"","sources":["../../src/assemble/assemble_test_cases.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assemble_test_cases.js","sourceRoot":"","sources":["../../src/assemble/assemble_test_cases.ts"],"names":[],"mappings":";;AAcA,8CAyCC;AA5CD,oDAAgD;AAGzC,KAAK,UAAU,iBAAiB,CACrC,gBAAwB,EACxB,gBAA8B,EAC9B,KAAwB,EACxB,cAA4C,EAC5C,kBAAsC;IAEtC,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,EAAE;QACxD,MAAM,UAAU,GAAG,KAAK,EAAE,CAAA;QAC1B,MAAM,eAAe,GAAe,mBAAmB,CAAC;YACtD,kBAAkB;YAClB,MAAM;YACN,KAAK;SACN,CAAC,CAAA;QACF,MAAM,mBAAmB,GAAe,SAAS,CAAC;YAChD,MAAM;YACN,kBAAkB;YAClB,KAAK;SACN,CAAC,CAAA;QACF,MAAM,cAAc,GAAe,kBAAkB,CAAC;YACpD,kBA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port {\n Envelope,\n IdGenerator,\n Pickle,\n TestCase,\n TestStep,\n Group as MessagesGroup,\n} from '@cucumber/messages'\nimport { Group } from '@cucumber/cucumber-expressions'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { doesHaveValue } from '../value_checker'\nimport { AssembledTestCase, SourcedPickle } from './types'\n\nexport async function assembleTestCases(\n testRunStartedId: string,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId,\n sourcedPickles: ReadonlyArray<SourcedPickle>,\n supportCodeLibrary: SupportCodeLibrary\n): Promise<ReadonlyArray<AssembledTestCase>> {\n return sourcedPickles.map(({ gherkinDocument, pickle }) => {\n const testCaseId = newId()\n const fromBeforeHooks: TestStep[] = makeBeforeHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n })\n const fromStepDefinitions: TestStep[] = makeSteps({\n pickle,\n supportCodeLibrary,\n newId,\n })\n const fromAfterHooks: TestStep[] = makeAfterHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n })\n const testCase: TestCase = {\n testRunStartedId,\n pickleId: pickle.id,\n id: testCaseId,\n testSteps: [\n ...fromBeforeHooks,\n ...fromStepDefinitions,\n ...fromAfterHooks,\n ],\n }\n eventBroadcaster.emit('envelope', { testCase } satisfies Envelope)\n return {\n gherkinDocument,\n pickle,\n testCase,\n }\n })\n}\n\nfunction makeAfterHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n}: {\n supportCodeLibrary: SupportCodeLibrary\n pickle: Pickle\n newId: IdGenerator.NewId\n}): TestStep[] {\n return supportCodeLibrary.afterTestCaseHookDefinitions\n .slice(0)\n .reverse()\n .filter((hookDefinition) => hookDefinition.appliesToTestCase(pickle))\n .map((hookDefinition) => ({\n id: newId(),\n hookId: hookDefinition.id,\n }))\n}\n\nfunction makeBeforeHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n}: {\n supportCodeLibrary: SupportCodeLibrary\n pickle: Pickle\n newId: IdGenerator.NewId\n}): TestStep[] {\n return supportCodeLibrary.beforeTestCaseHookDefinitions\n .filter((hookDefinition) => hookDefinition.appliesToTestCase(pickle))\n .map((hookDefinition) => ({\n id: newId(),\n hookId: hookDefinition.id,\n }))\n}\n\nfunction makeSteps({\n pickle,\n supportCodeLibrary,\n newId,\n}: {\n pickle: Pickle\n supportCodeLibrary: SupportCodeLibrary\n newId: () => string\n}): TestStep[] {\n return pickle.steps.map((pickleStep) => {\n const stepDefinitions = supportCodeLibrary.stepDefinitions.filter(\n (stepDefinition) => stepDefinition.matchesStepName(pickleStep.text)\n )\n return {\n id: newId(),\n pickleStepId: pickleStep.id,\n stepDefinitionIds: stepDefinitions.map(\n (stepDefinition) => stepDefinition.id\n ),\n stepMatchArgumentsLists: stepDefinitions.map((stepDefinition) => {\n const result = stepDefinition.expression.match(pickleStep.text)\n return {\n stepMatchArguments: result.map((arg) => {\n return {\n group: mapArgumentGroup(arg.group),\n parameterTypeName: arg.parameterType.name,\n }\n }),\n }\n }),\n }\n })\n}\n\nfunction mapArgumentGroup(group: Group): MessagesGroup {\n return {\n start: group.start,\n value: group.value,\n children: doesHaveValue(group.children)\n ? group.children.map((child) => mapArgumentGroup(child))\n : undefined,\n }\n}\n"]}
|
package/lib/cli/helpers.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { EventEmitter } from 'node:events';
|
|
4
2
|
import { IdGenerator } from '@cucumber/messages';
|
|
5
3
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
6
|
-
import { ILogger } from '../
|
|
4
|
+
import { ILogger } from '../environment';
|
|
7
5
|
import { IPickleOrder } from '../filter';
|
|
8
6
|
export declare function orderPickles<T = string>(pickleIds: T[], order: IPickleOrder, logger: ILogger): void;
|
|
9
7
|
export declare function emitMetaMessage(eventBroadcaster: EventEmitter, env: NodeJS.ProcessEnv): Promise<void>;
|
package/lib/cli/helpers.js
CHANGED
|
@@ -15,21 +15,34 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
39
|
+
exports.orderPickles = orderPickles;
|
|
40
|
+
exports.emitMetaMessage = emitMetaMessage;
|
|
41
|
+
exports.emitSupportCodeMessages = emitSupportCodeMessages;
|
|
30
42
|
const node_os_1 = __importDefault(require("node:os"));
|
|
31
43
|
const knuth_shuffle_seeded_1 = __importDefault(require("knuth-shuffle-seeded"));
|
|
32
44
|
const messages = __importStar(require("@cucumber/messages"));
|
|
45
|
+
const messages_1 = require("@cucumber/messages");
|
|
33
46
|
const ci_environment_1 = __importDefault(require("@cucumber/ci-environment"));
|
|
34
47
|
const version_1 = require("../version");
|
|
35
48
|
// Orders the pickleIds in place - morphs input
|
|
@@ -52,7 +65,6 @@ function orderPickles(pickleIds, order, logger) {
|
|
|
52
65
|
throw new Error('Unrecognized order type. Should be `defined` or `random`');
|
|
53
66
|
}
|
|
54
67
|
}
|
|
55
|
-
exports.orderPickles = orderPickles;
|
|
56
68
|
function splitOrder(order) {
|
|
57
69
|
if (!order.includes(':')) {
|
|
58
70
|
return [order, ''];
|
|
@@ -83,7 +95,6 @@ async function emitMetaMessage(eventBroadcaster, env) {
|
|
|
83
95
|
meta,
|
|
84
96
|
});
|
|
85
97
|
}
|
|
86
|
-
exports.emitMetaMessage = emitMetaMessage;
|
|
87
98
|
const makeSourceReference = (source) => ({
|
|
88
99
|
uri: source.uri,
|
|
89
100
|
location: {
|
|
@@ -137,32 +148,50 @@ function emitStepDefinitions(supportCodeLibrary, eventBroadcaster) {
|
|
|
137
148
|
}
|
|
138
149
|
function emitTestCaseHooks(supportCodeLibrary, eventBroadcaster) {
|
|
139
150
|
;
|
|
140
|
-
[
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
[
|
|
152
|
+
[
|
|
153
|
+
supportCodeLibrary.beforeTestCaseHookDefinitions,
|
|
154
|
+
messages_1.HookType.BEFORE_TEST_CASE,
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
supportCodeLibrary.afterTestCaseHookDefinitions,
|
|
158
|
+
messages_1.HookType.AFTER_TEST_CASE,
|
|
159
|
+
],
|
|
160
|
+
].forEach(([hooks, type]) => {
|
|
161
|
+
hooks.forEach((hook) => {
|
|
162
|
+
eventBroadcaster.emit('envelope', {
|
|
163
|
+
hook: {
|
|
164
|
+
id: hook.id,
|
|
165
|
+
type,
|
|
166
|
+
name: hook.name,
|
|
167
|
+
tagExpression: hook.tagExpression,
|
|
168
|
+
sourceReference: makeSourceReference(hook),
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
});
|
|
152
172
|
});
|
|
153
173
|
}
|
|
154
174
|
function emitTestRunHooks(supportCodeLibrary, eventBroadcaster) {
|
|
155
175
|
;
|
|
156
|
-
[
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
176
|
+
[
|
|
177
|
+
[
|
|
178
|
+
supportCodeLibrary.beforeTestRunHookDefinitions,
|
|
179
|
+
messages_1.HookType.BEFORE_TEST_RUN,
|
|
180
|
+
],
|
|
181
|
+
[
|
|
182
|
+
supportCodeLibrary.afterTestRunHookDefinitions,
|
|
183
|
+
messages_1.HookType.AFTER_TEST_RUN,
|
|
184
|
+
],
|
|
185
|
+
].forEach(([hooks, type]) => {
|
|
186
|
+
hooks.forEach((hook) => {
|
|
187
|
+
eventBroadcaster.emit('envelope', {
|
|
188
|
+
hook: {
|
|
189
|
+
id: hook.id,
|
|
190
|
+
type,
|
|
191
|
+
sourceReference: makeSourceReference(hook),
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
});
|
|
166
195
|
});
|
|
167
196
|
}
|
|
168
197
|
function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }) {
|
|
@@ -172,5 +201,4 @@ function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId,
|
|
|
172
201
|
emitTestCaseHooks(supportCodeLibrary, eventBroadcaster);
|
|
173
202
|
emitTestRunHooks(supportCodeLibrary, eventBroadcaster);
|
|
174
203
|
}
|
|
175
|
-
exports.emitSupportCodeMessages = emitSupportCodeMessages;
|
|
176
204
|
//# sourceMappingURL=helpers.js.map
|
package/lib/cli/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;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;aAC7D;SACF,CAAA;QACD,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAS,gBAAgB,CACvB,kBAAsC,EACtC,gBAA8B;IAE9B,CAAC;IAAA,EAAE;SACA,MAAM,CACL,kBAAkB,CAAC,4BAA4B,EAC/C,kBAAkB,CAAC,2BAA2B,CAC/C;SACA,OAAO,CAAC,CAAC,qBAA4C,EAAE,EAAE;QACxD,MAAM,QAAQ,GAAsB;YAClC,IAAI,EAAE;gBACJ,EAAE,EAAE,qBAAqB,CAAC,EAAE;gBAC5B,eAAe,EAAE,mBAAmB,CAAC,qBAAqB,CAAC;aAC5D;SACF,CAAA;QACD,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAgB,uBAAuB,CAAC,EACtC,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,GAKN;IACC,kBAAkB,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC/D,2BAA2B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACjE,mBAAmB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACzD,iBAAiB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport os from 'node:os'\nimport shuffle from 'knuth-shuffle-seeded'\nimport * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport detectCiEnvironment from '@cucumber/ci-environment'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { version } from '../version'\nimport { ILogger } from '../logger'\nimport { ILineAndUri } from '../types'\nimport { IPickleOrder } from '../filter'\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickles<T = string>(\n pickleIds: T[],\n order: IPickleOrder,\n logger: ILogger\n): void {\n const [type, seed] = splitOrder(order)\n switch (type) {\n case 'defined':\n break\n case 'random':\n if (seed === '') {\n const newSeed = Math.floor(Math.random() * 1000 * 1000).toString()\n logger.warn(`Random order using seed: ${newSeed}`)\n shuffle(pickleIds, newSeed)\n } else {\n shuffle(pickleIds, seed)\n }\n break\n default:\n throw new Error(\n 'Unrecognized order type. Should be `defined` or `random`'\n )\n }\n}\n\nfunction splitOrder(order: string) {\n if (!order.includes(':')) {\n return [order, '']\n }\n return order.split(':')\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter,\n env: NodeJS.ProcessEnv\n): Promise<void> {\n const meta: messages.Meta = {\n protocolVersion: messages.version,\n implementation: {\n version,\n name: 'cucumber-js',\n },\n cpu: {\n name: os.arch(),\n },\n os: {\n name: os.platform(),\n version: os.release(),\n },\n runtime: {\n name: 'node.js',\n version: process.versions.node,\n },\n ci: detectCiEnvironment(env),\n }\n eventBroadcaster.emit('envelope', {\n meta,\n })\n}\n\nconst makeSourceReference = (source: ILineAndUri) => ({\n uri: source.uri,\n location: {\n line: source.line,\n },\n})\n\nfunction emitParameterTypes(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (parameterType.builtin) {\n continue\n }\n const source =\n supportCodeLibrary.parameterTypeRegistry.lookupSource(parameterType)\n const envelope: messages.Envelope = {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n sourceReference: makeSourceReference(source),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: makeSourceReference(stepDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n supportCodeLibrary.afterTestCaseHookDefinitions\n )\n .forEach((testCaseHookDefinition: TestCaseHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testCaseHookDefinition.id,\n name: testCaseHookDefinition.name,\n tagExpression: testCaseHookDefinition.tagExpression,\n sourceReference: makeSourceReference(testCaseHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestRunHookDefinitions,\n supportCodeLibrary.afterTestRunHookDefinitions\n )\n .forEach((testRunHookDefinition: TestRunHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testRunHookDefinition.id,\n sourceReference: makeSourceReference(testRunHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: SupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,oCAuBC;AASD,0CA0BC;AA2HD,0DAcC;AA/MD,sDAAwB;AACxB,gFAA0C;AAC1C,6DAA8C;AAC9C,iDAAoE;AACpE,8EAA0D;AAE1D,wCAAoC;AAKpC,+CAA+C;AAC/C,SAAgB,YAAY,CAC1B,SAAc,EACd,KAAmB,EACnB,MAAe;IAEf,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IACtC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,MAAK;QACP,KAAK,QAAQ;YACX,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAA;gBAClE,MAAM,CAAC,IAAI,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAA;gBAClD,IAAA,8BAAO,EAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YAC7B,CAAC;iBAAM,CAAC;gBACN,IAAA,8BAAO,EAAC,SAAS,EAAE,IAAI,CAAC,CAAA;YAC1B,CAAC;YACD,M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ACX,IAAI;oBACJ,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC;iBAC3C;aACiB,CAAC,CAAA;QACvB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAgB,uBAAuB,CAAC,EACtC,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,GAKN;IACC,kBAAkB,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC/D,2BAA2B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACjE,mBAAmB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACzD,iBAAiB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport os from 'node:os'\nimport shuffle from 'knuth-shuffle-seeded'\nimport * as messages from '@cucumber/messages'\nimport { Envelope, HookType, IdGenerator } from '@cucumber/messages'\nimport detectCiEnvironment from '@cucumber/ci-environment'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { version } from '../version'\nimport { ILogger } from '../environment'\nimport { ILineAndUri } from '../types'\nimport { IPickleOrder } from '../filter'\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickles<T = string>(\n pickleIds: T[],\n order: IPickleOrder,\n logger: ILogger\n): void {\n const [type, seed] = splitOrder(order)\n switch (type) {\n case 'defined':\n break\n case 'random':\n if (seed === '') {\n const newSeed = Math.floor(Math.random() * 1000 * 1000).toString()\n logger.warn(`Random order using seed: ${newSeed}`)\n shuffle(pickleIds, newSeed)\n } else {\n shuffle(pickleIds, seed)\n }\n break\n default:\n throw new Error(\n 'Unrecognized order type. Should be `defined` or `random`'\n )\n }\n}\n\nfunction splitOrder(order: string) {\n if (!order.includes(':')) {\n return [order, '']\n }\n return order.split(':')\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter,\n env: NodeJS.ProcessEnv\n): Promise<void> {\n const meta: messages.Meta = {\n protocolVersion: messages.version,\n implementation: {\n version,\n name: 'cucumber-js',\n },\n cpu: {\n name: os.arch(),\n },\n os: {\n name: os.platform(),\n version: os.release(),\n },\n runtime: {\n name: 'node.js',\n version: process.versions.node,\n },\n ci: detectCiEnvironment(env),\n }\n eventBroadcaster.emit('envelope', {\n meta,\n })\n}\n\nconst makeSourceReference = (source: ILineAndUri) => ({\n uri: source.uri,\n location: {\n line: source.line,\n },\n})\n\nfunction emitParameterTypes(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (parameterType.builtin) {\n continue\n }\n const source =\n supportCodeLibrary.parameterTypeRegistry.lookupSource(parameterType)\n const envelope: messages.Envelope = {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n sourceReference: makeSourceReference(source),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: makeSourceReference(stepDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[\n [\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n HookType.BEFORE_TEST_CASE,\n ] as const,\n [\n supportCodeLibrary.afterTestCaseHookDefinitions,\n HookType.AFTER_TEST_CASE,\n ] as const,\n ].forEach(([hooks, type]) => {\n hooks.forEach((hook) => {\n eventBroadcaster.emit('envelope', {\n hook: {\n id: hook.id,\n type,\n name: hook.name,\n tagExpression: hook.tagExpression,\n sourceReference: makeSourceReference(hook),\n },\n } satisfies Envelope)\n })\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[\n [\n supportCodeLibrary.beforeTestRunHookDefinitions,\n HookType.BEFORE_TEST_RUN,\n ] as const,\n [\n supportCodeLibrary.afterTestRunHookDefinitions,\n HookType.AFTER_TEST_RUN,\n ] as const,\n ].forEach(([hooks, type]) => {\n hooks.forEach((hook) => {\n eventBroadcaster.emit('envelope', {\n hook: {\n id: hook.id,\n type,\n sourceReference: makeSourceReference(hook),\n },\n } satisfies Envelope)\n })\n })\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: SupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n"]}
|
package/lib/cli/i18n.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getLanguages = getLanguages;
|
|
7
|
+
exports.getKeywords = getKeywords;
|
|
7
8
|
const gherkin_1 = require("@cucumber/gherkin");
|
|
8
9
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
9
10
|
const capital_case_1 = require("capital-case");
|
|
@@ -57,7 +58,6 @@ function getLanguages() {
|
|
|
57
58
|
]);
|
|
58
59
|
return getAsTable(['ISO 639-1', 'ENGLISH NAME', 'NATIVE NAME'], rows);
|
|
59
60
|
}
|
|
60
|
-
exports.getLanguages = getLanguages;
|
|
61
61
|
function getKeywords(isoCode) {
|
|
62
62
|
const language = gherkin_1.dialects[isoCode];
|
|
63
63
|
const rows = keywords.map((keyword) => {
|
|
@@ -66,5 +66,4 @@ function getKeywords(isoCode) {
|
|
|
66
66
|
});
|
|
67
67
|
return getAsTable(['ENGLISH KEYWORD', 'NATIVE KEYWORDS'], rows);
|
|
68
68
|
}
|
|
69
|
-
exports.getKeywords = getKeywords;
|
|
70
69
|
//# sourceMappingURL=i18n.js.map
|
package/lib/cli/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/cli/i18n.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/cli/i18n.ts"],"names":[],"mappings":";;;;;AAgDA,oCAOC;AAED,kCAOC;AAhED,+CAA4C;AAC5C,4DAA8B;AAC9B,+CAA0C;AAE1C,MAAM,QAAQ,GAAG;IACf,SAAS;IACT,MAAM;IACN,YAAY;IACZ,UAAU;IACV,iBAAiB;IACjB,UAAU;IACV,OAAO;IACP,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;CACG,CAAA;AAEV,SAAS,UAAU,CAAC,MA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QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC/D,OAAO,CAAC,IAAA,0BAAW,EAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;IACF,OAAO,UAAU,CAAC,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,EAAE,IAAI,CAAC,CAAA;AACjE,CAAC","sourcesContent":["import { dialects } from '@cucumber/gherkin'\nimport Table from 'cli-table3'\nimport { capitalCase } from 'capital-case'\n\nconst keywords = [\n 'feature',\n 'rule',\n 'background',\n 'scenario',\n 'scenarioOutline',\n 'examples',\n 'given',\n 'when',\n 'then',\n 'and',\n 'but',\n] as const\n\nfunction getAsTable(header: string[], rows: string[][]): string {\n const table = new Table({\n chars: {\n bottom: '',\n 'bottom-left': '',\n 'bottom-mid': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n middle: ' | ',\n right: '',\n 'right-mid': '',\n top: '',\n 'top-left': '',\n 'top-mid': '',\n 'top-right': '',\n },\n style: {\n border: [],\n 'padding-left': 0,\n 'padding-right': 0,\n },\n })\n table.push(header)\n table.push(...rows)\n return table.toString()\n}\n\nexport function getLanguages(): string {\n const rows = Object.keys(dialects).map((isoCode) => [\n isoCode,\n dialects[isoCode].name,\n dialects[isoCode].native,\n ])\n return getAsTable(['ISO 639-1', 'ENGLISH NAME', 'NATIVE NAME'], rows)\n}\n\nexport function getKeywords(isoCode: string): string {\n const language = dialects[isoCode]\n const rows = keywords.map((keyword) => {\n const words = language[keyword].map((s) => `\"${s}\"`).join(', ')\n return [capitalCase(keyword), words]\n })\n return getAsTable(['ENGLISH KEYWORD', 'NATIVE KEYWORDS'], rows)\n}\n"]}
|
package/lib/cli/index.d.ts
CHANGED
package/lib/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,oDAA6C;AAE7C,gCAAuD;AACvD,iCAAkD;AAClD,2DAAqD;AAOrD,MAAqB,GAAG;IACL,IAAI,CAAU;IACd,GAAG,CAAQ;IACX,MAAM,CAAkB;IACxB,MAAM,CAAkB;IACxB,GAAG,CAAmB;IAEvC,YAAY,EACV,IAAI,EACJ,GAAG,EACH,MAAM,EACN,MAAM,GAAG,OAAO,CAAC,MAAM,EACvB,GAAG,GAOJ;QACC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,KAAK,CAAC,GAAG;QACP,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;QAC9C,IAAI,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,oDAA6C;AAE7C,gCAAuD;AACvD,iCAAkD;AAClD,2DAAqD;AAOrD,MAAqB,GAAG;IACL,IAAI,CAAU;IACd,GAAG,CAAQ;IACX,MAAM,CAAkB;IACxB,MAAM,CAAkB;IACxB,GAAG,CAAmB;IAEvC,YAAY,EACV,IAAI,EACJ,GAAG,EACH,MAAM,EACN,MAAM,GAAG,OAAO,CAAC,MAAM,EACvB,GAAG,GAOJ;QACC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;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,iBAAW,EAAC,gBAAgB,EAAE,WAAW,CAAC,CAAA;QACpE,OAAO;YACL,qBAAqB,EAAE,aAAa,CAAC,SAAS;YAC9C,OAAO;SACR,CAAA;IACH,CAAC;CACF;AAxED,sBAwEC","sourcesContent":["import debug from 'debug'\nimport { ArgvParser } from '../configuration'\nimport { IFormatterStream } from '../formatter'\nimport { loadConfiguration, runCucumber } from '../api'\nimport { getKeywords, getLanguages } from './i18n'\nimport { validateInstall } from './install_validator'\n\nexport interface ICliRunResult {\n shouldExitImmediately: boolean\n success: boolean\n}\n\nexport default class Cli {\n private readonly argv: string[]\n private readonly cwd: string\n private readonly stdout: IFormatterStream\n private readonly stderr: IFormatterStream\n private readonly env: NodeJS.ProcessEnv\n\n constructor({\n argv,\n cwd,\n stdout,\n stderr = process.stderr,\n env,\n }: {\n argv: string[]\n cwd: string\n stdout: IFormatterStream\n stderr?: IFormatterStream\n env: NodeJS.ProcessEnv\n }) {\n this.argv = argv\n this.cwd = cwd\n this.stdout = stdout\n this.stderr = stderr\n this.env = env\n }\n\n async run(): Promise<ICliRunResult> {\n const debugEnabled = debug.enabled('cucumber')\n if (debugEnabled) {\n await validateInstall()\n }\n const { options, configuration: argvConfiguration } = ArgvParser.parse(\n this.argv\n )\n if (options.i18nLanguages) {\n this.stdout.write(getLanguages())\n return {\n shouldExitImmediately: true,\n success: true,\n }\n }\n if (options.i18nKeywords) {\n this.stdout.write(getKeywords(options.i18nKeywords))\n return {\n shouldExitImmediately: true,\n success: true,\n }\n }\n\n const environment = {\n cwd: this.cwd,\n stdout: this.stdout,\n stderr: this.stderr,\n env: this.env,\n debug: debugEnabled,\n }\n const { useConfiguration: configuration, runConfiguration } =\n await loadConfiguration(\n {\n file: options.config,\n profiles: options.profile,\n provided: argvConfiguration,\n },\n environment\n )\n const { success } = await runCucumber(runConfiguration, environment)\n return {\n shouldExitImmediately: configuration.forceExit,\n success,\n }\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateInstall =
|
|
6
|
+
exports.validateInstall = validateInstall;
|
|
7
7
|
/* eslint-disable no-console */
|
|
8
8
|
const is_installed_globally_1 = __importDefault(require("is-installed-globally"));
|
|
9
9
|
async function validateInstall() {
|
|
@@ -14,5 +14,4 @@ async function validateInstall() {
|
|
|
14
14
|
See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations
|
|
15
15
|
`);
|
|
16
16
|
}
|
|
17
|
-
exports.validateInstall = validateInstall;
|
|
18
17
|
//# sourceMappingURL=install_validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install_validator.js","sourceRoot":"","sources":["../../src/cli/install_validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install_validator.js","sourceRoot":"","sources":["../../src/cli/install_validator.ts"],"names":[],"mappings":";;;;;AAGA,0CASC;AAZD,+BAA+B;AAC/B,kFAAuD;AAEhD,KAAK,UAAU,eAAe;IACnC,IAAI,+BAAmB;QACrB,OAAO,CAAC,IAAI,CACV;;;;OAIC,CACF,CAAA;AACL,CAAC","sourcesContent":["/* eslint-disable no-console */\nimport isInstalledGlobally from 'is-installed-globally'\n\nexport async function validateInstall(): Promise<void> {\n if (isInstalledGlobally)\n console.warn(\n `\n It looks like you're running Cucumber from a global installation.\n If so, you'll likely see issues - you need to have Cucumber installed as a local dependency in your project.\n See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations\n `\n )\n}\n"]}
|
package/lib/cli/run.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = run;
|
|
6
7
|
/* eslint-disable no-console */
|
|
7
8
|
/* This is one rare place where we're fine to use process/console directly,
|
|
8
9
|
* but other code abstracts those to remain composable and testable. */
|
|
@@ -39,5 +40,4 @@ async function run() {
|
|
|
39
40
|
process.exitCode = exitCode;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
exports.default = run;
|
|
43
43
|
//# sourceMappingURL=run.js.map
|
package/lib/cli/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":";;;;;AAWA,sBA+BC;AA1CD,+BAA+B;AAC/B;uEACuE;AACvE,iFAA0E;AAC1E,0CAAuC;AAEvC,SAAS,sBAAsB,CAAC,OAAe;IAC7C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACtB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC;AAEc,KAAK,UAAU,GAAG;IAC/B,IAAA,wDAAyB,EACvB,OAAO,CAAC,OAAO,EACf,CAAC,KAAK,EAAE,EAAE;QACR,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,EACD,OAAO,CAAC,IAAI,CACb,CAAA;IAED,MAAM,GAAG,GAAG,IAAI,UAAG,CAAC;QAClB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CAAA;IAEF,IAAI,MAAqB,CAAA;IACzB,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,EAAE,CAAA;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,sBAAsB,CAAC,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACvC,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACxB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC7B,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable no-console */\n/* This is one rare place where we're fine to use process/console directly,\n * but other code abstracts those to remain composable and testable. */\nimport { validateNodeEngineVersion } from './validate_node_engine_version'\nimport Cli, { ICliRunResult } from './'\n\nfunction logErrorMessageAndExit(message: string): void {\n console.error(message)\n process.exit(1)\n}\n\nexport default async function run(): Promise<void> {\n validateNodeEngineVersion(\n process.version,\n (error) => {\n console.error(error)\n process.exit(1)\n },\n console.warn\n )\n\n const cli = new Cli({\n argv: process.argv,\n cwd: process.cwd(),\n stdout: process.stdout,\n stderr: process.stderr,\n env: process.env,\n })\n\n let result: ICliRunResult\n try {\n result = await cli.run()\n } catch (error) {\n logErrorMessageAndExit(error)\n }\n\n const exitCode = result.success ? 0 : 1\n if (result.shouldExitImmediately) {\n process.exit(exitCode)\n } else {\n process.exitCode = exitCode\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateNodeEngineVersion =
|
|
6
|
+
exports.validateNodeEngineVersion = validateNodeEngineVersion;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const semver_1 = __importDefault(require("semver"));
|
|
@@ -20,5 +20,4 @@ function validateNodeEngineVersion(currentVersion, onError, onWarning, readPacka
|
|
|
20
20
|
onWarning(`This Node.js version (${currentVersion}) has not been tested with this version of Cucumber; it should work normally, but please raise an issue if you see anything unexpected.`);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
exports.validateNodeEngineVersion = validateNodeEngineVersion;
|
|
24
23
|
//# sourceMappingURL=validate_node_engine_version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_node_engine_version.js","sourceRoot":"","sources":["../../src/cli/validate_node_engine_version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate_node_engine_version.js","sourceRoot":"","sources":["../../src/cli/validate_node_engine_version.ts"],"names":[],"mappings":";;;;;AAgBA,8DAiBC;AAjCD,sDAAwB;AACxB,0DAA4B;AAC5B,oDAA2B;AAO3B,MAAM,qBAAqB,GAAsB,GAAG,EAAE,CACpD,IAAI,CAAC,KAAK,CACR,iBAAE;KACC,YAAY,CAAC,mBAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;KACjE,QAAQ,EAAE,CACd,CAAA;AAEH,SAAgB,yBAAyB,CACvC,cAAsB,EACtB,OAAkC,EAClC,SAAoC,EACpC,kBAAqC,qBAAqB;IAE1D,MAAM,gBAAgB,GAAG,eAAe,EAAE,CAAC,OAAO,CAAC,IAAI,CAAA;IACvD,MAAM,cAAc,GAAG,eAAe,EAAE,CAAC,aAAa,CAAC,IAAI,CAAA;IAC3D,IAAI,CAAC,gBAAM,CAAC,SAAS,CAAC,cAAc,EAAE,gBAAgB,CAAC,EAAE,CAAC;QACxD,OAAO,CACL,6CAA6C,gBAAgB,6BAA6B,cAAc,EAAE,CAC3G,CAAA;IACH,CAAC;SAAM,IAAI,CAAC,gBAAM,CAAC,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC;QAC7D,SAAS,CACP,yBAAyB,cAAc,yIAAyI,CACjL,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport semver from 'semver'\n\ntype PackageJSON = {\n engines: { node: string }\n enginesTested: { node: string }\n}\n\nconst readActualPackageJSON: () => PackageJSON = () =>\n JSON.parse(\n fs\n .readFileSync(path.resolve(__dirname, '..', '..', 'package.json'))\n .toString()\n )\n\nexport function validateNodeEngineVersion(\n currentVersion: string,\n onError: (message: string) => void,\n onWarning: (message: string) => void,\n readPackageJSON: () => PackageJSON = readActualPackageJSON\n): void {\n const requiredVersions = readPackageJSON().engines.node\n const testedVersions = readPackageJSON().enginesTested.node\n if (!semver.satisfies(currentVersion, requiredVersions)) {\n onError(\n `Cucumber can only run on Node.js versions ${requiredVersions}. This Node.js version is ${currentVersion}`\n )\n } else if (!semver.satisfies(currentVersion, testedVersions)) {\n onWarning(\n `This Node.js version (${currentVersion}) has not been tested with this version of Cucumber; it should work normally, but please raise an issue if you see anything unexpected.`\n )\n }\n}\n"]}
|