@dev-blinq/cucumber-js 1.0.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/LICENSE +22 -0
- package/README.md +124 -0
- package/api/index.d.ts +6 -0
- package/bin/cucumber-js +3 -0
- package/bin/cucumber.js +3 -0
- package/lib/api/console_logger.d.ts +12 -0
- package/lib/api/console_logger.js +24 -0
- package/lib/api/console_logger.js.map +1 -0
- package/lib/api/convert_configuration.d.ts +4 -0
- package/lib/api/convert_configuration.js +65 -0
- package/lib/api/convert_configuration.js.map +1 -0
- package/lib/api/environment.d.ts +2 -0
- package/lib/api/environment.js +14 -0
- package/lib/api/environment.js.map +1 -0
- package/lib/api/formatters.d.ts +20 -0
- package/lib/api/formatters.js +61 -0
- package/lib/api/formatters.js.map +1 -0
- package/lib/api/gherkin.d.ts +21 -0
- package/lib/api/gherkin.js +65 -0
- package/lib/api/gherkin.js.map +1 -0
- package/lib/api/index.d.ts +12 -0
- package/lib/api/index.js +28 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/load_configuration.d.ts +9 -0
- package/lib/api/load_configuration.js +41 -0
- package/lib/api/load_configuration.js.map +1 -0
- package/lib/api/load_sources.d.ts +9 -0
- package/lib/api/load_sources.js +53 -0
- package/lib/api/load_sources.js.map +1 -0
- package/lib/api/load_support.d.ts +10 -0
- package/lib/api/load_support.js +30 -0
- package/lib/api/load_support.js.map +1 -0
- package/lib/api/paths.d.ts +8 -0
- package/lib/api/paths.js +102 -0
- package/lib/api/paths.js.map +1 -0
- package/lib/api/plugins.d.ts +4 -0
- package/lib/api/plugins.js +19 -0
- package/lib/api/plugins.js.map +1 -0
- package/lib/api/run_cucumber.d.ts +11 -0
- package/lib/api/run_cucumber.js +115 -0
- package/lib/api/run_cucumber.js.map +1 -0
- package/lib/api/runtime.d.ts +21 -0
- package/lib/api/runtime.js +36 -0
- package/lib/api/runtime.js.map +1 -0
- package/lib/api/support.d.ts +9 -0
- package/lib/api/support.js +26 -0
- package/lib/api/support.js.map +1 -0
- package/lib/api/test_helpers.d.ts +3 -0
- package/lib/api/test_helpers.js +36 -0
- package/lib/api/test_helpers.js.map +1 -0
- package/lib/api/types.d.ts +175 -0
- package/lib/api/types.js +3 -0
- package/lib/api/types.js.map +1 -0
- package/lib/api/wrapper.mjs +6 -0
- package/lib/cli/helpers.d.ts +37 -0
- package/lib/cli/helpers.js +203 -0
- package/lib/cli/helpers.js.map +1 -0
- package/lib/cli/i18n.d.ts +2 -0
- package/lib/cli/i18n.js +70 -0
- package/lib/cli/i18n.js.map +1 -0
- package/lib/cli/index.d.ts +21 -0
- package/lib/cli/index.js +59 -0
- package/lib/cli/index.js.map +1 -0
- package/lib/cli/install_validator.d.ts +1 -0
- package/lib/cli/install_validator.js +18 -0
- package/lib/cli/install_validator.js.map +1 -0
- package/lib/cli/run.d.ts +1 -0
- package/lib/cli/run.js +44 -0
- package/lib/cli/run.js.map +1 -0
- package/lib/cli/validate_node_engine_version.d.ts +10 -0
- package/lib/cli/validate_node_engine_version.js +24 -0
- package/lib/cli/validate_node_engine_version.js.map +1 -0
- package/lib/configuration/argv_parser.d.ts +20 -0
- package/lib/configuration/argv_parser.js +102 -0
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/check_schema.d.ts +2 -0
- package/lib/configuration/check_schema.js +60 -0
- package/lib/configuration/check_schema.js.map +1 -0
- package/lib/configuration/default_configuration.d.ts +2 -0
- package/lib/configuration/default_configuration.js +27 -0
- package/lib/configuration/default_configuration.js.map +1 -0
- package/lib/configuration/from_file.d.ts +3 -0
- package/lib/configuration/from_file.js +85 -0
- package/lib/configuration/from_file.js.map +1 -0
- package/lib/configuration/helpers.d.ts +1 -0
- package/lib/configuration/helpers.js +11 -0
- package/lib/configuration/helpers.js.map +1 -0
- package/lib/configuration/index.d.ts +7 -0
- package/lib/configuration/index.js +29 -0
- package/lib/configuration/index.js.map +1 -0
- package/lib/configuration/locate_file.d.ts +1 -0
- package/lib/configuration/locate_file.js +21 -0
- package/lib/configuration/locate_file.js.map +1 -0
- package/lib/configuration/merge_configurations.d.ts +2 -0
- package/lib/configuration/merge_configurations.js +48 -0
- package/lib/configuration/merge_configurations.js.map +1 -0
- package/lib/configuration/option_splitter.d.ts +3 -0
- package/lib/configuration/option_splitter.js +23 -0
- package/lib/configuration/option_splitter.js.map +1 -0
- package/lib/configuration/types.d.ts +28 -0
- package/lib/configuration/types.js +3 -0
- package/lib/configuration/types.js.map +1 -0
- package/lib/configuration/validate_configuration.d.ts +3 -0
- package/lib/configuration/validate_configuration.js +13 -0
- package/lib/configuration/validate_configuration.js.map +1 -0
- package/lib/filter_stack_trace.d.ts +3 -0
- package/lib/filter_stack_trace.js +38 -0
- package/lib/filter_stack_trace.js.map +1 -0
- package/lib/formatter/builder.d.ts +37 -0
- package/lib/formatter/builder.js +101 -0
- package/lib/formatter/builder.js.map +1 -0
- package/lib/formatter/fixtures/typescript.d.ts +2 -0
- package/lib/formatter/fixtures/typescript.js +6 -0
- package/lib/formatter/fixtures/typescript.js.map +1 -0
- package/lib/formatter/get_color_fns.d.ts +15 -0
- package/lib/formatter/get_color_fns.js +56 -0
- package/lib/formatter/get_color_fns.js.map +1 -0
- package/lib/formatter/helpers/duration_helpers.d.ts +2 -0
- package/lib/formatter/helpers/duration_helpers.js +9 -0
- package/lib/formatter/helpers/duration_helpers.js.map +1 -0
- package/lib/formatter/helpers/event_data_collector.d.ts +30 -0
- package/lib/formatter/helpers/event_data_collector.js +126 -0
- package/lib/formatter/helpers/event_data_collector.js.map +1 -0
- package/lib/formatter/helpers/formatters.d.ts +6 -0
- package/lib/formatter/helpers/formatters.js +43 -0
- package/lib/formatter/helpers/formatters.js.map +1 -0
- package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -0
- package/lib/formatter/helpers/gherkin_document_parser.js +66 -0
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -0
- package/lib/formatter/helpers/index.d.ts +10 -0
- package/lib/formatter/helpers/index.js +52 -0
- package/lib/formatter/helpers/index.js.map +1 -0
- package/lib/formatter/helpers/issue_helpers.d.ts +19 -0
- package/lib/formatter/helpers/issue_helpers.js +59 -0
- package/lib/formatter/helpers/issue_helpers.js.map +1 -0
- package/lib/formatter/helpers/keyword_type.d.ts +11 -0
- package/lib/formatter/helpers/keyword_type.js +32 -0
- package/lib/formatter/helpers/keyword_type.js.map +1 -0
- package/lib/formatter/helpers/location_helpers.d.ts +2 -0
- package/lib/formatter/helpers/location_helpers.js +17 -0
- package/lib/formatter/helpers/location_helpers.js.map +1 -0
- package/lib/formatter/helpers/pickle_parser.d.ts +17 -0
- package/lib/formatter/helpers/pickle_parser.js +28 -0
- package/lib/formatter/helpers/pickle_parser.js.map +1 -0
- package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -0
- package/lib/formatter/helpers/step_argument_formatter.js +48 -0
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -0
- package/lib/formatter/helpers/summary_helpers.d.ts +9 -0
- package/lib/formatter/helpers/summary_helpers.js +96 -0
- package/lib/formatter/helpers/summary_helpers.js.map +1 -0
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +12 -0
- package/lib/formatter/helpers/test_case_attempt_formatter.js +114 -0
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -0
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +32 -0
- package/lib/formatter/helpers/test_case_attempt_parser.js +135 -0
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -0
- package/lib/formatter/helpers/usage_helpers/index.d.ts +23 -0
- package/lib/formatter/helpers/usage_helpers/index.js +111 -0
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -0
- package/lib/formatter/html_formatter.d.ts +7 -0
- package/lib/formatter/html_formatter.js +30 -0
- package/lib/formatter/html_formatter.js.map +1 -0
- package/lib/formatter/index.d.ts +53 -0
- package/lib/formatter/index.js +21 -0
- package/lib/formatter/index.js.map +1 -0
- package/lib/formatter/json_formatter.d.ts +78 -0
- package/lib/formatter/json_formatter.js +230 -0
- package/lib/formatter/json_formatter.js.map +1 -0
- package/lib/formatter/junit_formatter.d.ts +17 -0
- package/lib/formatter/junit_formatter.js +181 -0
- package/lib/formatter/junit_formatter.js.map +1 -0
- package/lib/formatter/message_formatter.d.ts +5 -0
- package/lib/formatter/message_formatter.js +15 -0
- package/lib/formatter/message_formatter.js.map +1 -0
- package/lib/formatter/progress_bar_formatter.d.ts +18 -0
- package/lib/formatter/progress_bar_formatter.js +99 -0
- package/lib/formatter/progress_bar_formatter.js.map +1 -0
- package/lib/formatter/progress_formatter.d.ts +9 -0
- package/lib/formatter/progress_formatter.js +59 -0
- package/lib/formatter/progress_formatter.js.map +1 -0
- package/lib/formatter/rerun_formatter.d.ts +13 -0
- package/lib/formatter/rerun_formatter.js +80 -0
- package/lib/formatter/rerun_formatter.js.map +1 -0
- package/lib/formatter/snippets_formatter.d.ts +6 -0
- package/lib/formatter/snippets_formatter.js +61 -0
- package/lib/formatter/snippets_formatter.js.map +1 -0
- package/lib/formatter/step_definition_snippet_builder/index.d.ts +20 -0
- package/lib/formatter/step_definition_snippet_builder/index.js +46 -0
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.d.ts +7 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +46 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -0
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +16 -0
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +11 -0
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -0
- package/lib/formatter/summary_formatter.d.ts +14 -0
- package/lib/formatter/summary_formatter.js +68 -0
- package/lib/formatter/summary_formatter.js.map +1 -0
- package/lib/formatter/usage_formatter.d.ts +6 -0
- package/lib/formatter/usage_formatter.js +98 -0
- package/lib/formatter/usage_formatter.js.map +1 -0
- package/lib/formatter/usage_json_formatter.d.ts +7 -0
- package/lib/formatter/usage_json_formatter.js +34 -0
- package/lib/formatter/usage_json_formatter.js.map +1 -0
- package/lib/importer.js +13 -0
- package/lib/index.d.ts +58 -0
- package/lib/index.js +109 -0
- package/lib/index.js.map +1 -0
- package/lib/logger.d.ts +5 -0
- package/lib/logger.js +3 -0
- package/lib/logger.js.map +1 -0
- package/lib/models/data_table.d.ts +10 -0
- package/lib/models/data_table.js +46 -0
- package/lib/models/data_table.js.map +1 -0
- package/lib/models/definition.d.ts +55 -0
- package/lib/models/definition.js +22 -0
- package/lib/models/definition.js.map +1 -0
- package/lib/models/gherkin_step_keyword.d.ts +1 -0
- package/lib/models/gherkin_step_keyword.js +3 -0
- package/lib/models/gherkin_step_keyword.js.map +1 -0
- package/lib/models/pickle_order.d.ts +1 -0
- package/lib/models/pickle_order.js +3 -0
- package/lib/models/pickle_order.js.map +1 -0
- package/lib/models/step_definition.d.ts +11 -0
- package/lib/models/step_definition.js +37 -0
- package/lib/models/step_definition.js.map +1 -0
- package/lib/models/test_case_hook_definition.d.ts +10 -0
- package/lib/models/test_case_hook_definition.js +27 -0
- package/lib/models/test_case_hook_definition.js.map +1 -0
- package/lib/models/test_run_hook_definition.d.ts +3 -0
- package/lib/models/test_run_hook_definition.js +10 -0
- package/lib/models/test_run_hook_definition.js.map +1 -0
- package/lib/models/test_step_hook_definition.d.ts +9 -0
- package/lib/models/test_step_hook_definition.js +26 -0
- package/lib/models/test_step_hook_definition.js.map +1 -0
- package/lib/pickle_filter.d.ts +42 -0
- package/lib/pickle_filter.js +99 -0
- package/lib/pickle_filter.js.map +1 -0
- package/lib/plugin/index.d.ts +2 -0
- package/lib/plugin/index.js +19 -0
- package/lib/plugin/index.js.map +1 -0
- package/lib/plugin/plugin_manager.d.ts +13 -0
- package/lib/plugin/plugin_manager.js +36 -0
- package/lib/plugin/plugin_manager.js.map +1 -0
- package/lib/plugin/types.d.ts +14 -0
- package/lib/plugin/types.js +3 -0
- package/lib/plugin/types.js.map +1 -0
- package/lib/publish/http_stream.d.ts +30 -0
- package/lib/publish/http_stream.js +112 -0
- package/lib/publish/http_stream.js.map +1 -0
- package/lib/publish/index.d.ts +2 -0
- package/lib/publish/index.js +5 -0
- package/lib/publish/index.js.map +1 -0
- package/lib/publish/publish_plugin.d.ts +2 -0
- package/lib/publish/publish_plugin.js +48 -0
- package/lib/publish/publish_plugin.js.map +1 -0
- package/lib/runtime/assemble_test_cases.d.ts +13 -0
- package/lib/runtime/assemble_test_cases.js +88 -0
- package/lib/runtime/assemble_test_cases.js.map +1 -0
- package/lib/runtime/attachment_manager/index.d.ts +33 -0
- package/lib/runtime/attachment_manager/index.js +119 -0
- package/lib/runtime/attachment_manager/index.js.map +1 -0
- package/lib/runtime/format_error.d.ts +2 -0
- package/lib/runtime/format_error.js +36 -0
- package/lib/runtime/format_error.js.map +1 -0
- package/lib/runtime/helpers.d.ts +6 -0
- package/lib/runtime/helpers.js +101 -0
- package/lib/runtime/helpers.js.map +1 -0
- package/lib/runtime/index.d.ts +40 -0
- package/lib/runtime/index.js +76 -0
- package/lib/runtime/index.js.map +1 -0
- package/lib/runtime/parallel/command_types.d.ts +32 -0
- package/lib/runtime/parallel/command_types.js +3 -0
- package/lib/runtime/parallel/command_types.js.map +1 -0
- package/lib/runtime/parallel/coordinator.d.ts +72 -0
- package/lib/runtime/parallel/coordinator.js +222 -0
- package/lib/runtime/parallel/coordinator.js.map +1 -0
- package/lib/runtime/parallel/run_worker.d.ts +1 -0
- package/lib/runtime/parallel/run_worker.js +29 -0
- package/lib/runtime/parallel/run_worker.js.map +1 -0
- package/lib/runtime/parallel/worker.d.ts +26 -0
- package/lib/runtime/parallel/worker.js +87 -0
- package/lib/runtime/parallel/worker.js.map +1 -0
- package/lib/runtime/run_test_run_hooks.d.ts +3 -0
- package/lib/runtime/run_test_run_hooks.js +28 -0
- package/lib/runtime/run_test_run_hooks.js.map +1 -0
- package/lib/runtime/step_runner.d.ts +16 -0
- package/lib/runtime/step_runner.js +88 -0
- package/lib/runtime/step_runner.js.map +1 -0
- package/lib/runtime/stopwatch.d.ts +12 -0
- package/lib/runtime/stopwatch.js +34 -0
- package/lib/runtime/stopwatch.js.map +1 -0
- package/lib/runtime/test_case_runner.d.ts +54 -0
- package/lib/runtime/test_case_runner.js +268 -0
- package/lib/runtime/test_case_runner.js.map +1 -0
- package/lib/step_arguments.d.ts +6 -0
- package/lib/step_arguments.js +19 -0
- package/lib/step_arguments.js.map +1 -0
- package/lib/support_code_library_builder/build_parameter_type.d.ts +3 -0
- package/lib/support_code_library_builder/build_parameter_type.js +13 -0
- package/lib/support_code_library_builder/build_parameter_type.js.map +1 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +29 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -0
- package/lib/support_code_library_builder/index.d.ts +74 -0
- package/lib/support_code_library_builder/index.js +304 -0
- package/lib/support_code_library_builder/index.js.map +1 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js +16 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -0
- package/lib/support_code_library_builder/sourced_parameter_type_registry.d.ts +7 -0
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js +19 -0
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js.map +1 -0
- package/lib/support_code_library_builder/types.d.ts +88 -0
- package/lib/support_code_library_builder/types.js +3 -0
- package/lib/support_code_library_builder/types.js.map +1 -0
- package/lib/support_code_library_builder/validate_arguments.d.ts +12 -0
- package/lib/support_code_library_builder/validate_arguments.js +73 -0
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -0
- package/lib/support_code_library_builder/world.d.ts +18 -0
- package/lib/support_code_library_builder/world.js +11 -0
- package/lib/support_code_library_builder/world.js.map +1 -0
- package/lib/time.d.ts +18 -0
- package/lib/time.js +61 -0
- package/lib/time.js.map +1 -0
- package/lib/try_require.d.ts +7 -0
- package/lib/try_require.js +26 -0
- package/lib/try_require.js.map +1 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.js +3 -0
- package/lib/types/index.js.map +1 -0
- package/lib/uncaught_exception_manager.d.ts +7 -0
- package/lib/uncaught_exception_manager.js +12 -0
- package/lib/uncaught_exception_manager.js.map +1 -0
- package/lib/user_code_runner.d.ts +14 -0
- package/lib/user_code_runner.js +82 -0
- package/lib/user_code_runner.js.map +1 -0
- package/lib/value_checker.d.ts +3 -0
- package/lib/value_checker.js +19 -0
- package/lib/value_checker.js.map +1 -0
- package/lib/version.d.ts +1 -0
- package/lib/version.js +6 -0
- package/lib/version.js.map +1 -0
- package/lib/wrapper.mjs +44 -0
- package/package.json +189 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
4
|
+
import { FormatOptions, IPublishConfig } from '../formatter';
|
|
5
|
+
import { PickleOrder } from '../models/pickle_order';
|
|
6
|
+
import { IRuntimeOptions } from '../runtime';
|
|
7
|
+
import { IConfiguration } from '../configuration';
|
|
8
|
+
import { Writable } from 'stream';
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export interface ILoadConfigurationOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Path to load configuration file from (defaults to `cucumber.(js|cjs|mjs|json)` if omitted).
|
|
15
|
+
*/
|
|
16
|
+
file?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Zero or more profile names from which to source configuration (if omitted or empty, the `default` profile will be used).
|
|
19
|
+
*/
|
|
20
|
+
profiles?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Ad-hoc configuration options to be applied over the top of whatever is loaded from the configuration file/profiles.
|
|
23
|
+
*/
|
|
24
|
+
provided?: Partial<IConfiguration>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export interface IResolvedConfiguration {
|
|
30
|
+
/**
|
|
31
|
+
* The final flat configuration object resolved from the configuration file/profiles plus any extra provided.
|
|
32
|
+
*/
|
|
33
|
+
useConfiguration: IConfiguration;
|
|
34
|
+
/**
|
|
35
|
+
* The format that can be passed into `runCucumber`.
|
|
36
|
+
*/
|
|
37
|
+
runConfiguration: IRunConfiguration;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export interface ISourcesCoordinates {
|
|
43
|
+
defaultDialect: string;
|
|
44
|
+
paths: string[];
|
|
45
|
+
names: string[];
|
|
46
|
+
tagExpression: string;
|
|
47
|
+
order: PickleOrder;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export interface IPlannedPickle {
|
|
53
|
+
name: string;
|
|
54
|
+
uri: string;
|
|
55
|
+
location: {
|
|
56
|
+
line: number;
|
|
57
|
+
column?: number;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
export interface ISourcesError {
|
|
64
|
+
uri: string;
|
|
65
|
+
location: {
|
|
66
|
+
line: number;
|
|
67
|
+
column?: number;
|
|
68
|
+
};
|
|
69
|
+
message: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export interface ILoadSourcesResult {
|
|
75
|
+
plan: IPlannedPickle[];
|
|
76
|
+
errors: ISourcesError[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export interface ISupportCodeCoordinates {
|
|
82
|
+
requireModules: string[];
|
|
83
|
+
requirePaths: string[];
|
|
84
|
+
importPaths: string[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
export interface ILoadSupportOptions {
|
|
90
|
+
sources: ISourcesCoordinates;
|
|
91
|
+
support: ISupportCodeCoordinates;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
export interface IRunOptionsRuntime extends IRuntimeOptions {
|
|
97
|
+
parallel: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
export interface IRunOptionsFormats {
|
|
103
|
+
stdout: string;
|
|
104
|
+
files: Record<string, string>;
|
|
105
|
+
publish: IPublishConfig | false;
|
|
106
|
+
options: FormatOptions;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
export interface IRunConfiguration {
|
|
112
|
+
sources: ISourcesCoordinates;
|
|
113
|
+
support: ISupportCodeCoordinates;
|
|
114
|
+
runtime: IRunOptionsRuntime;
|
|
115
|
+
formats: IRunOptionsFormats;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
export type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
|
|
121
|
+
/**
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
export type { ISupportCodeLibrary };
|
|
125
|
+
/**
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
export interface IRunOptions {
|
|
129
|
+
sources: ISourcesCoordinates;
|
|
130
|
+
support: ISupportCodeCoordinatesOrLibrary;
|
|
131
|
+
runtime: IRunOptionsRuntime;
|
|
132
|
+
formats: IRunOptionsFormats;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Contextual data about the project environment.
|
|
136
|
+
*
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
export interface IRunEnvironment {
|
|
140
|
+
/**
|
|
141
|
+
* Working directory for the project (defaults to `process.cwd()` if omitted).
|
|
142
|
+
*/
|
|
143
|
+
cwd?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Writable stream where the test run's main output is written (defaults to `process.stdout` if omitted).
|
|
146
|
+
*/
|
|
147
|
+
stdout?: Writable;
|
|
148
|
+
/**
|
|
149
|
+
* Writable stream where the test run's warning/error output is written (defaults to `process.stderr` if omitted).
|
|
150
|
+
*/
|
|
151
|
+
stderr?: Writable;
|
|
152
|
+
/**
|
|
153
|
+
* Environment variables (defaults to `process.env` if omitted).
|
|
154
|
+
*/
|
|
155
|
+
env?: NodeJS.ProcessEnv;
|
|
156
|
+
/**
|
|
157
|
+
* Whether debug logging is enabled.
|
|
158
|
+
*/
|
|
159
|
+
debug?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Result of a Cucumber test run.
|
|
163
|
+
*
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
export interface IRunResult {
|
|
167
|
+
/**
|
|
168
|
+
* Whether the test run was overall successful i.e. no failed scenarios. The exact meaning can vary based on the `strict` configuration option.
|
|
169
|
+
*/
|
|
170
|
+
success: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* The support code library that was used in the test run; can be reused in subsequent `runCucumber` calls.
|
|
173
|
+
*/
|
|
174
|
+
support: ISupportCodeLibrary;
|
|
175
|
+
}
|
package/lib/api/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { FormatOptions, IPublishConfig } from '../formatter'\nimport { PickleOrder } from '../models/pickle_order'\nimport { IRuntimeOptions } from '../runtime'\nimport { IConfiguration } from '../configuration'\nimport { Writable } from 'stream'\n\n/**\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from (defaults to `cucumber.(js|cjs|mjs|json)` if omitted).\n */\n file?: string\n /**\n * Zero or more profile names from which to source configuration (if omitted or empty, the `default` profile will be used).\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be applied over the top of whatever is loaded from the configuration file/profiles.\n */\n provided?: Partial<IConfiguration>\n}\n\n/**\n * @public\n */\nexport interface IResolvedConfiguration {\n /**\n * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.\n */\n useConfiguration: IConfiguration\n /**\n * The format that can be passed into `runCucumber`.\n */\n runConfiguration: IRunConfiguration\n}\n\n/**\n * @public\n */\nexport interface ISourcesCoordinates {\n defaultDialect: string\n paths: string[]\n names: string[]\n tagExpression: string\n order: PickleOrder\n}\n\n/**\n * @public\n */\nexport interface IPlannedPickle {\n name: string\n uri: string\n location: {\n line: number\n column?: number\n }\n}\n\n/**\n * @public\n */\nexport interface ISourcesError {\n uri: string\n location: {\n line: number\n column?: number\n }\n message: string\n}\n\n/**\n * @public\n */\nexport interface ILoadSourcesResult {\n plan: IPlannedPickle[]\n errors: ISourcesError[]\n}\n\n/**\n * @public\n */\nexport interface ISupportCodeCoordinates {\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n}\n\n/**\n * @public\n */\nexport interface ILoadSupportOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates\n}\n\n/**\n * @public\n */\nexport interface IRunOptionsRuntime extends IRuntimeOptions {\n parallel: number\n}\n\n/**\n * @public\n */\nexport interface IRunOptionsFormats {\n stdout: string\n files: Record<string, string>\n publish: IPublishConfig | false\n options: FormatOptions\n}\n\n/**\n * @public\n */\nexport interface IRunConfiguration {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * @public\n */\nexport type ISupportCodeCoordinatesOrLibrary =\n | ISupportCodeCoordinates\n | ISupportCodeLibrary\n\n/**\n * @public\n */\nexport type { ISupportCodeLibrary }\n\n/**\n * @public\n */\nexport interface IRunOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinatesOrLibrary\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * Contextual data about the project environment.\n *\n * @public\n */\nexport interface IRunEnvironment {\n /**\n * Working directory for the project (defaults to `process.cwd()` if omitted).\n */\n cwd?: string\n /**\n * Writable stream where the test run's main output is written (defaults to `process.stdout` if omitted).\n */\n stdout?: Writable\n /**\n * Writable stream where the test run's warning/error output is written (defaults to `process.stderr` if omitted).\n */\n stderr?: Writable\n /**\n * Environment variables (defaults to `process.env` if omitted).\n */\n env?: NodeJS.ProcessEnv\n /**\n * Whether debug logging is enabled.\n */\n debug?: boolean\n}\n\n/**\n * Result of a Cucumber test run.\n *\n * @public\n */\nexport interface IRunResult {\n /**\n * Whether the test run was overall successful i.e. no failed scenarios. 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; can be reused in subsequent `runCucumber` calls.\n */\n support: ISupportCodeLibrary\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { EventEmitter } from 'events';
|
|
5
|
+
import PickleFilter from '../pickle_filter';
|
|
6
|
+
import { EventDataCollector } from '../formatter/helpers';
|
|
7
|
+
import { Readable } from 'stream';
|
|
8
|
+
import { IdGenerator } from '@cucumber/messages';
|
|
9
|
+
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
10
|
+
import { PickleOrder } from '../models/pickle_order';
|
|
11
|
+
import { ILogger } from '../logger';
|
|
12
|
+
interface IParseGherkinMessageStreamRequest {
|
|
13
|
+
cwd?: string;
|
|
14
|
+
eventBroadcaster: EventEmitter;
|
|
15
|
+
eventDataCollector: EventDataCollector;
|
|
16
|
+
gherkinMessageStream: Readable;
|
|
17
|
+
order: string;
|
|
18
|
+
pickleFilter: PickleFilter;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids
|
|
22
|
+
*
|
|
23
|
+
* @param eventBroadcaster
|
|
24
|
+
* @param eventDataCollector
|
|
25
|
+
* @param gherkinMessageStream
|
|
26
|
+
* @param order
|
|
27
|
+
* @param pickleFilter
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseGherkinMessageStream({ eventBroadcaster, eventDataCollector, gherkinMessageStream, order, pickleFilter, }: IParseGherkinMessageStreamRequest): Promise<string[]>;
|
|
30
|
+
export declare function orderPickles<T = string>(pickleIds: T[], order: PickleOrder, logger: ILogger): void;
|
|
31
|
+
export declare function emitMetaMessage(eventBroadcaster: EventEmitter, env: NodeJS.ProcessEnv): Promise<void>;
|
|
32
|
+
export declare function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }: {
|
|
33
|
+
eventBroadcaster: EventEmitter;
|
|
34
|
+
supportCodeLibrary: ISupportCodeLibrary;
|
|
35
|
+
newId: IdGenerator.NewId;
|
|
36
|
+
}): void;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.emitSupportCodeMessages = exports.emitMetaMessage = exports.orderPickles = exports.parseGherkinMessageStream = void 0;
|
|
30
|
+
const knuth_shuffle_seeded_1 = __importDefault(require("knuth-shuffle-seeded"));
|
|
31
|
+
const value_checker_1 = require("../value_checker");
|
|
32
|
+
const configuration_1 = require("../configuration");
|
|
33
|
+
const os_1 = __importDefault(require("os"));
|
|
34
|
+
const messages = __importStar(require("@cucumber/messages"));
|
|
35
|
+
const ci_environment_1 = __importDefault(require("@cucumber/ci-environment"));
|
|
36
|
+
const version_1 = require("../version");
|
|
37
|
+
/**
|
|
38
|
+
* Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids
|
|
39
|
+
*
|
|
40
|
+
* @param eventBroadcaster
|
|
41
|
+
* @param eventDataCollector
|
|
42
|
+
* @param gherkinMessageStream
|
|
43
|
+
* @param order
|
|
44
|
+
* @param pickleFilter
|
|
45
|
+
*/
|
|
46
|
+
async function parseGherkinMessageStream({ eventBroadcaster, eventDataCollector, gherkinMessageStream, order, pickleFilter, }) {
|
|
47
|
+
return await new Promise((resolve, reject) => {
|
|
48
|
+
const result = [];
|
|
49
|
+
gherkinMessageStream.on('data', (envelope) => {
|
|
50
|
+
eventBroadcaster.emit('envelope', envelope);
|
|
51
|
+
if ((0, value_checker_1.doesHaveValue)(envelope.pickle)) {
|
|
52
|
+
const pickle = envelope.pickle;
|
|
53
|
+
const pickleId = pickle.id;
|
|
54
|
+
const gherkinDocument = eventDataCollector.getGherkinDocument(pickle.uri);
|
|
55
|
+
if (pickleFilter.matches({ gherkinDocument, pickle })) {
|
|
56
|
+
result.push(pickleId);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
gherkinMessageStream.on('end', () => {
|
|
61
|
+
orderPickles(result, order, console);
|
|
62
|
+
resolve(result);
|
|
63
|
+
});
|
|
64
|
+
gherkinMessageStream.on('error', reject);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
exports.parseGherkinMessageStream = parseGherkinMessageStream;
|
|
68
|
+
// Orders the pickleIds in place - morphs input
|
|
69
|
+
function orderPickles(pickleIds, order, logger) {
|
|
70
|
+
const [type, seed] = configuration_1.OptionSplitter.split(order);
|
|
71
|
+
switch (type) {
|
|
72
|
+
case 'defined':
|
|
73
|
+
break;
|
|
74
|
+
case 'random':
|
|
75
|
+
if (seed === '') {
|
|
76
|
+
const newSeed = Math.floor(Math.random() * 1000 * 1000).toString();
|
|
77
|
+
logger.warn(`Random order using seed: ${newSeed}`);
|
|
78
|
+
(0, knuth_shuffle_seeded_1.default)(pickleIds, newSeed);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
(0, knuth_shuffle_seeded_1.default)(pickleIds, seed);
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
throw new Error('Unrecgonized order type. Should be `defined` or `random`');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.orderPickles = orderPickles;
|
|
89
|
+
async function emitMetaMessage(eventBroadcaster, env) {
|
|
90
|
+
const meta = {
|
|
91
|
+
protocolVersion: messages.version,
|
|
92
|
+
implementation: {
|
|
93
|
+
version: version_1.version,
|
|
94
|
+
name: 'cucumber-js',
|
|
95
|
+
},
|
|
96
|
+
cpu: {
|
|
97
|
+
name: os_1.default.arch(),
|
|
98
|
+
},
|
|
99
|
+
os: {
|
|
100
|
+
name: os_1.default.platform(),
|
|
101
|
+
version: os_1.default.release(),
|
|
102
|
+
},
|
|
103
|
+
runtime: {
|
|
104
|
+
name: 'node.js',
|
|
105
|
+
version: process.versions.node,
|
|
106
|
+
},
|
|
107
|
+
ci: (0, ci_environment_1.default)(env),
|
|
108
|
+
};
|
|
109
|
+
eventBroadcaster.emit('envelope', {
|
|
110
|
+
meta,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
exports.emitMetaMessage = emitMetaMessage;
|
|
114
|
+
const makeSourceReference = (source) => ({
|
|
115
|
+
uri: source.uri,
|
|
116
|
+
location: {
|
|
117
|
+
line: source.line,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
function emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId) {
|
|
121
|
+
for (const parameterType of supportCodeLibrary.parameterTypeRegistry
|
|
122
|
+
.parameterTypes) {
|
|
123
|
+
if (parameterType.builtin) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const source = supportCodeLibrary.parameterTypeRegistry.lookupSource(parameterType);
|
|
127
|
+
const envelope = {
|
|
128
|
+
parameterType: {
|
|
129
|
+
id: newId(),
|
|
130
|
+
name: parameterType.name,
|
|
131
|
+
preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,
|
|
132
|
+
regularExpressions: parameterType.regexpStrings,
|
|
133
|
+
useForSnippets: parameterType.useForSnippets,
|
|
134
|
+
sourceReference: makeSourceReference(source),
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
eventBroadcaster.emit('envelope', envelope);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster) {
|
|
141
|
+
for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {
|
|
142
|
+
const envelope = {
|
|
143
|
+
undefinedParameterType,
|
|
144
|
+
};
|
|
145
|
+
eventBroadcaster.emit('envelope', envelope);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function emitStepDefinitions(supportCodeLibrary, eventBroadcaster) {
|
|
149
|
+
supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {
|
|
150
|
+
const envelope = {
|
|
151
|
+
stepDefinition: {
|
|
152
|
+
id: stepDefinition.id,
|
|
153
|
+
pattern: {
|
|
154
|
+
source: stepDefinition.pattern.toString(),
|
|
155
|
+
type: typeof stepDefinition.pattern === 'string'
|
|
156
|
+
? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION
|
|
157
|
+
: messages.StepDefinitionPatternType.REGULAR_EXPRESSION,
|
|
158
|
+
},
|
|
159
|
+
sourceReference: makeSourceReference(stepDefinition),
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
eventBroadcaster.emit('envelope', envelope);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function emitTestCaseHooks(supportCodeLibrary, eventBroadcaster) {
|
|
166
|
+
;
|
|
167
|
+
[]
|
|
168
|
+
.concat(supportCodeLibrary.beforeTestCaseHookDefinitions, supportCodeLibrary.afterTestCaseHookDefinitions)
|
|
169
|
+
.forEach((testCaseHookDefinition) => {
|
|
170
|
+
const envelope = {
|
|
171
|
+
hook: {
|
|
172
|
+
id: testCaseHookDefinition.id,
|
|
173
|
+
name: testCaseHookDefinition.name,
|
|
174
|
+
tagExpression: testCaseHookDefinition.tagExpression,
|
|
175
|
+
sourceReference: makeSourceReference(testCaseHookDefinition),
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
eventBroadcaster.emit('envelope', envelope);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function emitTestRunHooks(supportCodeLibrary, eventBroadcaster) {
|
|
182
|
+
;
|
|
183
|
+
[]
|
|
184
|
+
.concat(supportCodeLibrary.beforeTestRunHookDefinitions, supportCodeLibrary.afterTestRunHookDefinitions)
|
|
185
|
+
.forEach((testRunHookDefinition) => {
|
|
186
|
+
const envelope = {
|
|
187
|
+
hook: {
|
|
188
|
+
id: testRunHookDefinition.id,
|
|
189
|
+
sourceReference: makeSourceReference(testRunHookDefinition),
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
eventBroadcaster.emit('envelope', envelope);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }) {
|
|
196
|
+
emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId);
|
|
197
|
+
emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster);
|
|
198
|
+
emitStepDefinitions(supportCodeLibrary, eventBroadcaster);
|
|
199
|
+
emitTestCaseHooks(supportCodeLibrary, eventBroadcaster);
|
|
200
|
+
emitTestRunHooks(supportCodeLibrary, eventBroadcaster);
|
|
201
|
+
}
|
|
202
|
+
exports.emitSupportCodeMessages = emitSupportCodeMessages;
|
|
203
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAA0C;AAI1C,oDAAgD;AAChD,oDAAiD;AAEjD,4CAAmB;AACnB,6DAA8C;AAE9C,8EAA0D;AAK1D,wCAAoC;AAapC;;;;;;;;GAQG;AACI,KAAK,UAAU,yBAAyB,CAAC,EAC9C,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,EACL,YAAY,GACsB;IAClC,OAAO,MAAM,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,QAA2B,EAAE,EAAE;YAC9D,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;YAC3C,IAAI,I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BAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import shuffle from 'knuth-shuffle-seeded'\nimport { EventEmitter } from 'events'\nimport PickleFilter from '../pickle_filter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { doesHaveValue } from '../value_checker'\nimport { OptionSplitter } from '../configuration'\nimport { Readable } from 'stream'\nimport os from 'os'\nimport * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport detectCiEnvironment from '@cucumber/ci-environment'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { PickleOrder } from '../models/pickle_order'\nimport { version } from '../version'\nimport { ILogger } from '../logger'\nimport { ILineAndUri } from '../types'\n\ninterface IParseGherkinMessageStreamRequest {\n cwd?: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n gherkinMessageStream: Readable\n order: string\n pickleFilter: PickleFilter\n}\n\n/**\n * Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids\n *\n * @param eventBroadcaster\n * @param eventDataCollector\n * @param gherkinMessageStream\n * @param order\n * @param pickleFilter\n */\nexport async function parseGherkinMessageStream({\n eventBroadcaster,\n eventDataCollector,\n gherkinMessageStream,\n order,\n pickleFilter,\n}: IParseGherkinMessageStreamRequest): Promise<string[]> {\n return await new Promise<string[]>((resolve, reject) => {\n const result: string[] = []\n gherkinMessageStream.on('data', (envelope: messages.Envelope) => {\n eventBroadcaster.emit('envelope', envelope)\n if (doesHaveValue(envelope.pickle)) {\n const pickle = envelope.pickle\n const pickleId = pickle.id\n const gherkinDocument = eventDataCollector.getGherkinDocument(\n pickle.uri\n )\n if (pickleFilter.matches({ gherkinDocument, pickle })) {\n result.push(pickleId)\n }\n }\n })\n gherkinMessageStream.on('end', () => {\n orderPickles(result, order, console)\n resolve(result)\n })\n gherkinMessageStream.on('error', reject)\n })\n}\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickles<T = string>(\n pickleIds: T[],\n order: PickleOrder,\n logger: ILogger\n): void {\n const [type, seed] = OptionSplitter.split(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 'Unrecgonized order type. Should be `defined` or `random`'\n )\n }\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: ISupportCodeLibrary,\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: ISupportCodeLibrary,\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: ISupportCodeLibrary,\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: ISupportCodeLibrary,\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: ISupportCodeLibrary,\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: ISupportCodeLibrary\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
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getKeywords = exports.getLanguages = void 0;
|
|
7
|
+
const gherkin_1 = require("@cucumber/gherkin");
|
|
8
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
9
|
+
const capital_case_1 = require("capital-case");
|
|
10
|
+
const keywords = [
|
|
11
|
+
'feature',
|
|
12
|
+
'rule',
|
|
13
|
+
'background',
|
|
14
|
+
'scenario',
|
|
15
|
+
'scenarioOutline',
|
|
16
|
+
'examples',
|
|
17
|
+
'given',
|
|
18
|
+
'when',
|
|
19
|
+
'then',
|
|
20
|
+
'and',
|
|
21
|
+
'but',
|
|
22
|
+
];
|
|
23
|
+
function getAsTable(header, rows) {
|
|
24
|
+
const table = new cli_table3_1.default({
|
|
25
|
+
chars: {
|
|
26
|
+
bottom: '',
|
|
27
|
+
'bottom-left': '',
|
|
28
|
+
'bottom-mid': '',
|
|
29
|
+
'bottom-right': '',
|
|
30
|
+
left: '',
|
|
31
|
+
'left-mid': '',
|
|
32
|
+
mid: '',
|
|
33
|
+
'mid-mid': '',
|
|
34
|
+
middle: ' | ',
|
|
35
|
+
right: '',
|
|
36
|
+
'right-mid': '',
|
|
37
|
+
top: '',
|
|
38
|
+
'top-left': '',
|
|
39
|
+
'top-mid': '',
|
|
40
|
+
'top-right': '',
|
|
41
|
+
},
|
|
42
|
+
style: {
|
|
43
|
+
border: [],
|
|
44
|
+
'padding-left': 0,
|
|
45
|
+
'padding-right': 0,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
table.push(header);
|
|
49
|
+
table.push(...rows);
|
|
50
|
+
return table.toString();
|
|
51
|
+
}
|
|
52
|
+
function getLanguages() {
|
|
53
|
+
const rows = Object.keys(gherkin_1.dialects).map((isoCode) => [
|
|
54
|
+
isoCode,
|
|
55
|
+
gherkin_1.dialects[isoCode].name,
|
|
56
|
+
gherkin_1.dialects[isoCode].native,
|
|
57
|
+
]);
|
|
58
|
+
return getAsTable(['ISO 639-1', 'ENGLISH NAME', 'NATIVE NAME'], rows);
|
|
59
|
+
}
|
|
60
|
+
exports.getLanguages = getLanguages;
|
|
61
|
+
function getKeywords(isoCode) {
|
|
62
|
+
const language = gherkin_1.dialects[isoCode];
|
|
63
|
+
const rows = keywords.map((keyword) => {
|
|
64
|
+
const words = language[keyword].map((s) => `"${s}"`).join(', ');
|
|
65
|
+
return [(0, capital_case_1.capitalCase)(keyword), words];
|
|
66
|
+
});
|
|
67
|
+
return getAsTable(['ENGLISH KEYWORD', 'NATIVE KEYWORDS'], rows);
|
|
68
|
+
}
|
|
69
|
+
exports.getKeywords = getKeywords;
|
|
70
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/cli/i18n.ts"],"names":[],"mappings":";;;;;;AAAA,+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,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pC,MAAM,KAAK,GAAG,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;AAPD,kCAOC","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"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IFormatterStream } from '../formatter';
|
|
3
|
+
export interface ICliRunResult {
|
|
4
|
+
shouldExitImmediately: boolean;
|
|
5
|
+
success: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default class Cli {
|
|
8
|
+
private readonly argv;
|
|
9
|
+
private readonly cwd;
|
|
10
|
+
private readonly stdout;
|
|
11
|
+
private readonly stderr;
|
|
12
|
+
private readonly env;
|
|
13
|
+
constructor({ argv, cwd, stdout, stderr, env, }: {
|
|
14
|
+
argv: string[];
|
|
15
|
+
cwd: string;
|
|
16
|
+
stdout: IFormatterStream;
|
|
17
|
+
stderr?: IFormatterStream;
|
|
18
|
+
env: NodeJS.ProcessEnv;
|
|
19
|
+
});
|
|
20
|
+
run(): Promise<ICliRunResult>;
|
|
21
|
+
}
|
package/lib/cli/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const configuration_1 = require("../configuration");
|
|
7
|
+
const api_1 = require("../api");
|
|
8
|
+
const i18n_1 = require("./i18n");
|
|
9
|
+
const install_validator_1 = require("./install_validator");
|
|
10
|
+
const debug_1 = __importDefault(require("debug"));
|
|
11
|
+
class Cli {
|
|
12
|
+
constructor({ argv, cwd, stdout, stderr = process.stderr, env, }) {
|
|
13
|
+
this.argv = argv;
|
|
14
|
+
this.cwd = cwd;
|
|
15
|
+
this.stdout = stdout;
|
|
16
|
+
this.stderr = stderr;
|
|
17
|
+
this.env = env;
|
|
18
|
+
}
|
|
19
|
+
async run() {
|
|
20
|
+
const debugEnabled = debug_1.default.enabled('cucumber');
|
|
21
|
+
if (debugEnabled) {
|
|
22
|
+
await (0, install_validator_1.validateInstall)();
|
|
23
|
+
}
|
|
24
|
+
const { options, configuration: argvConfiguration } = configuration_1.ArgvParser.parse(this.argv);
|
|
25
|
+
if (options.i18nLanguages) {
|
|
26
|
+
this.stdout.write((0, i18n_1.getLanguages)());
|
|
27
|
+
return {
|
|
28
|
+
shouldExitImmediately: true,
|
|
29
|
+
success: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (options.i18nKeywords) {
|
|
33
|
+
this.stdout.write((0, i18n_1.getKeywords)(options.i18nKeywords));
|
|
34
|
+
return {
|
|
35
|
+
shouldExitImmediately: true,
|
|
36
|
+
success: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const environment = {
|
|
40
|
+
cwd: this.cwd,
|
|
41
|
+
stdout: this.stdout,
|
|
42
|
+
stderr: this.stderr,
|
|
43
|
+
env: this.env,
|
|
44
|
+
debug: debugEnabled,
|
|
45
|
+
};
|
|
46
|
+
const { useConfiguration: configuration, runConfiguration } = await (0, api_1.loadConfiguration)({
|
|
47
|
+
file: options.config,
|
|
48
|
+
profiles: options.profile,
|
|
49
|
+
provided: argvConfiguration,
|
|
50
|
+
}, environment);
|
|
51
|
+
const { success } = await (0, api_1.runCucumber)(runConfiguration, environment);
|
|
52
|
+
return {
|
|
53
|
+
shouldExitImmediately: configuration.forceExit,
|
|
54
|
+
success,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.default = Cli;
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAAA,oDAA6C;AAE7C,gCAAuD;AACvD,iCAAkD;AAClD,2DAAqD;AACrD,kDAAyB;AAOzB,MAAqB,GAAG;IAOtB,YAAY,EACV,IAAI,EACJ,GAAG,EACH,MAAM,EACN,MAAM,GAAG,OAAO,CAAC,MAAM,EACvB,GAAG,GAOJ;QACC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA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AAE,iBAAiB;SAC5B,EACD,WAAW,CACZ,CAAA;QACH,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,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 { ArgvParser } from '../configuration'\nimport { IFormatterStream } from '../formatter'\nimport { loadConfiguration, runCucumber } from '../api'\nimport { getKeywords, getLanguages } from './i18n'\nimport { validateInstall } from './install_validator'\nimport debug from 'debug'\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validateInstall(): Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateInstall = void 0;
|
|
7
|
+
/* eslint-disable no-console */
|
|
8
|
+
const is_installed_globally_1 = __importDefault(require("is-installed-globally"));
|
|
9
|
+
async function validateInstall() {
|
|
10
|
+
if (is_installed_globally_1.default)
|
|
11
|
+
console.warn(`
|
|
12
|
+
It looks like you're running Cucumber from a global installation.
|
|
13
|
+
If so, you'll likely see issues - you need to have Cucumber installed as a local dependency in your project.
|
|
14
|
+
See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations
|
|
15
|
+
`);
|
|
16
|
+
}
|
|
17
|
+
exports.validateInstall = validateInstall;
|
|
18
|
+
//# sourceMappingURL=install_validator.js.map
|