@cucumber/cucumber 7.3.2 → 8.0.0-rc.3
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 +88 -51
- package/api/index.d.ts +6 -0
- package/lib/api/convert_configuration.d.ts +4 -0
- package/lib/api/convert_configuration.js +64 -0
- package/lib/api/convert_configuration.js.map +1 -0
- package/lib/api/environment.d.ts +2 -0
- package/lib/api/environment.js +13 -0
- package/lib/api/environment.js.map +1 -0
- package/lib/api/formatters.d.ts +16 -0
- package/lib/api/formatters.js +72 -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 +11 -0
- package/lib/api/index.js +24 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/load_configuration.d.ts +9 -0
- package/lib/api/load_configuration.js +32 -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 +28 -0
- package/lib/api/load_support.js.map +1 -0
- package/lib/api/paths.d.ts +7 -0
- package/lib/api/paths.js +99 -0
- package/lib/api/paths.js.map +1 -0
- package/lib/api/run_cucumber.d.ts +11 -0
- package/lib/api/run_cucumber.js +108 -0
- package/lib/api/run_cucumber.js.map +1 -0
- package/lib/api/runtime.d.ts +20 -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 +21 -0
- package/lib/api/support.js.map +1 -0
- package/lib/api/types.d.ts +168 -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 +16 -9
- package/lib/cli/helpers.js +49 -32
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +7 -7
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +6 -23
- package/lib/cli/index.js +38 -197
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/install_validator.js +1 -1
- package/lib/cli/install_validator.js.map +1 -1
- package/lib/cli/publish_banner.js +6 -6
- package/lib/cli/publish_banner.js.map +1 -1
- package/lib/cli/run.js +15 -7
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.d.ts +7 -0
- package/lib/cli/validate_node_engine_version.js +20 -0
- package/lib/cli/validate_node_engine_version.js.map +1 -0
- package/lib/configuration/argv_parser.d.ts +20 -0
- package/lib/{cli → configuration}/argv_parser.js +52 -53
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/check_schema.d.ts +2 -0
- package/lib/configuration/check_schema.js +56 -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 +2 -0
- package/lib/configuration/from_file.js +68 -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 +25 -0
- package/lib/configuration/index.js.map +1 -0
- package/lib/configuration/locate_file.d.ts +1 -0
- package/lib/configuration/locate_file.js +19 -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/{cli → configuration}/option_splitter.js +3 -2
- package/lib/configuration/option_splitter.js.map +1 -0
- package/lib/configuration/types.d.ts +25 -0
- package/lib/configuration/types.js +3 -0
- package/lib/configuration/types.js.map +1 -0
- package/lib/configuration/validate_configuration.d.ts +2 -0
- package/lib/configuration/validate_configuration.js +10 -0
- package/lib/configuration/validate_configuration.js.map +1 -0
- package/lib/formatter/builder.d.ts +7 -7
- package/lib/formatter/builder.js +48 -55
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/get_color_fns.js +15 -16
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +2 -1
- package/lib/formatter/helpers/event_data_collector.js +16 -15
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/formatters.d.ts +6 -0
- package/lib/formatter/helpers/formatters.js +41 -0
- package/lib/formatter/helpers/formatters.js.map +1 -0
- package/lib/formatter/helpers/gherkin_document_parser.js +29 -42
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +4 -4
- package/lib/formatter/helpers/issue_helpers.js +8 -9
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +2 -6
- package/lib/formatter/helpers/keyword_type.js.map +1 -1
- package/lib/formatter/helpers/location_helpers.js +1 -1
- package/lib/formatter/helpers/location_helpers.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js +9 -18
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.js +8 -7
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +2 -2
- package/lib/formatter/helpers/test_case_attempt_formatter.js +20 -19
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +1 -2
- package/lib/formatter/helpers/test_case_attempt_parser.js +18 -21
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.d.ts +1 -2
- package/lib/formatter/helpers/usage_helpers/index.js +29 -43
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/html_formatter.d.ts +1 -0
- package/lib/formatter/html_formatter.js +5 -4
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/http_stream.js +7 -7
- package/lib/formatter/http_stream.js.map +1 -1
- package/lib/formatter/index.d.ts +15 -2
- package/lib/formatter/index.js +2 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.d.ts +1 -0
- package/lib/formatter/json_formatter.js +25 -20
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/message_formatter.d.ts +1 -0
- package/lib/formatter/message_formatter.js +1 -0
- package/lib/formatter/message_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.d.ts +1 -0
- package/lib/formatter/progress_bar_formatter.js +18 -17
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.d.ts +1 -0
- package/lib/formatter/progress_formatter.js +3 -2
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/publish.d.ts +1 -0
- package/lib/formatter/publish.js +5 -0
- package/lib/formatter/publish.js.map +1 -0
- package/lib/formatter/rerun_formatter.d.ts +1 -0
- package/lib/formatter/rerun_formatter.js +15 -11
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.d.ts +1 -0
- package/lib/formatter/snippets_formatter.js +3 -3
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.js +2 -2
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +3 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
- package/lib/formatter/summary_formatter.d.ts +1 -0
- package/lib/formatter/summary_formatter.js +11 -11
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.d.ts +1 -0
- package/lib/formatter/usage_formatter.js +9 -10
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.d.ts +1 -0
- package/lib/formatter/usage_json_formatter.js +3 -3
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/importer.js +13 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +9 -1
- package/lib/index.js.map +1 -1
- package/lib/models/data_table.js +9 -7
- package/lib/models/data_table.js.map +1 -1
- 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.js +4 -5
- package/lib/models/step_definition.js.map +1 -1
- package/lib/pickle_filter.js +13 -13
- package/lib/pickle_filter.js.map +1 -1
- package/lib/runtime/assemble_test_cases.js +3 -3
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/attachment_manager/index.js +4 -4
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/helpers.d.ts +1 -0
- package/lib/runtime/helpers.js +42 -4
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +7 -7
- package/lib/runtime/index.js +12 -65
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/command_types.d.ts +3 -2
- package/lib/runtime/parallel/command_types.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +32 -12
- package/lib/runtime/parallel/coordinator.js +82 -38
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/run_worker.js +1 -1
- package/lib/runtime/parallel/run_worker.js.map +1 -1
- package/lib/runtime/parallel/worker.d.ts +2 -4
- package/lib/runtime/parallel/worker.js +18 -33
- package/lib/runtime/parallel/worker.js.map +1 -1
- 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.js +5 -7
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js +4 -4
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +3 -3
- package/lib/runtime/test_case_runner.js +19 -28
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/stack_trace_filter.js +6 -7
- package/lib/stack_trace_filter.js.map +1 -1
- package/lib/step_arguments.js +2 -2
- package/lib/step_arguments.js.map +1 -1
- package/lib/support_code_library_builder/{build_helpers.d.ts → build_parameter_type.d.ts} +0 -2
- 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 +30 -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 +4 -2
- package/lib/support_code_library_builder/index.js +43 -34
- package/lib/support_code_library_builder/index.js.map +1 -1
- 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/types.d.ts +10 -0
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/support_code_library_builder/validate_arguments.js +14 -19
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
- package/lib/time.d.ts +1 -0
- package/lib/time.js +17 -2
- package/lib/time.js.map +1 -1
- package/lib/user_code_runner.js +10 -17
- package/lib/user_code_runner.js.map +1 -1
- package/lib/value_checker.d.ts +2 -2
- package/lib/value_checker.js.map +1 -1
- package/lib/version.d.ts +1 -0
- package/lib/version.js +6 -0
- package/lib/version.js.map +1 -0
- package/lib/wrapper.mjs +42 -0
- package/package.json +98 -70
- package/lib/cli/argv_parser.d.ts +0 -51
- package/lib/cli/argv_parser.js.map +0 -1
- package/lib/cli/configuration_builder.d.ts +0 -46
- package/lib/cli/configuration_builder.js +0 -161
- package/lib/cli/configuration_builder.js.map +0 -1
- package/lib/cli/option_splitter.d.ts +0 -4
- package/lib/cli/option_splitter.js.map +0 -1
- package/lib/cli/profile_loader.d.ts +0 -6
- package/lib/cli/profile_loader.js +0 -42
- package/lib/cli/profile_loader.js.map +0 -1
- package/lib/support_code_library_builder/build_helpers.js +0 -41
- package/lib/support_code_library_builder/build_helpers.js.map +0 -1
- package/lib/support_code_library_builder/finalize_helpers.d.ts +0 -10
- package/lib/support_code_library_builder/finalize_helpers.js +0 -26
- package/lib/support_code_library_builder/finalize_helpers.js.map +0 -1
|
@@ -1,161 +0,0 @@
|
|
|
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 lodash_1 = __importDefault(require("lodash"));
|
|
7
|
-
const argv_parser_1 = __importDefault(require("./argv_parser"));
|
|
8
|
-
const fs_1 = __importDefault(require("mz/fs"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const option_splitter_1 = __importDefault(require("./option_splitter"));
|
|
11
|
-
const bluebird_1 = __importDefault(require("bluebird"));
|
|
12
|
-
const glob_1 = __importDefault(require("glob"));
|
|
13
|
-
const util_1 = require("util");
|
|
14
|
-
const value_checker_1 = require("../value_checker");
|
|
15
|
-
const DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports';
|
|
16
|
-
class ConfigurationBuilder {
|
|
17
|
-
constructor({ argv, cwd }) {
|
|
18
|
-
this.cwd = cwd;
|
|
19
|
-
argv_parser_1.default.lint(argv);
|
|
20
|
-
const parsedArgv = argv_parser_1.default.parse(argv);
|
|
21
|
-
this.args = parsedArgv.args;
|
|
22
|
-
this.options = parsedArgv.options;
|
|
23
|
-
}
|
|
24
|
-
static async build(options) {
|
|
25
|
-
const builder = new ConfigurationBuilder(options);
|
|
26
|
-
return await builder.build();
|
|
27
|
-
}
|
|
28
|
-
async build() {
|
|
29
|
-
const listI18nKeywordsFor = this.options.i18nKeywords;
|
|
30
|
-
const listI18nLanguages = this.options.i18nLanguages;
|
|
31
|
-
const unexpandedFeaturePaths = await this.getUnexpandedFeaturePaths();
|
|
32
|
-
let featurePaths = [];
|
|
33
|
-
let supportCodePaths = [];
|
|
34
|
-
if (listI18nKeywordsFor === '' && !listI18nLanguages) {
|
|
35
|
-
featurePaths = await this.expandFeaturePaths(unexpandedFeaturePaths);
|
|
36
|
-
let unexpandedSupportCodePaths = this.options.require;
|
|
37
|
-
if (unexpandedSupportCodePaths.length === 0) {
|
|
38
|
-
unexpandedSupportCodePaths = this.getFeatureDirectoryPaths(featurePaths);
|
|
39
|
-
}
|
|
40
|
-
supportCodePaths = await this.expandPaths(unexpandedSupportCodePaths, '.js');
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
featureDefaultLanguage: this.options.language,
|
|
44
|
-
featurePaths,
|
|
45
|
-
formats: this.getFormats(),
|
|
46
|
-
formatOptions: this.options.formatOptions,
|
|
47
|
-
publishing: this.isPublishing(),
|
|
48
|
-
listI18nKeywordsFor,
|
|
49
|
-
listI18nLanguages,
|
|
50
|
-
order: this.options.order,
|
|
51
|
-
parallel: this.options.parallel,
|
|
52
|
-
pickleFilterOptions: {
|
|
53
|
-
cwd: this.cwd,
|
|
54
|
-
featurePaths: unexpandedFeaturePaths,
|
|
55
|
-
names: this.options.name,
|
|
56
|
-
tagExpression: this.options.tags,
|
|
57
|
-
},
|
|
58
|
-
predictableIds: this.options.predictableIds,
|
|
59
|
-
profiles: this.options.profile,
|
|
60
|
-
runtimeOptions: {
|
|
61
|
-
dryRun: this.options.dryRun,
|
|
62
|
-
predictableIds: this.options.predictableIds,
|
|
63
|
-
failFast: this.options.failFast,
|
|
64
|
-
filterStacktraces: !this.options.backtrace,
|
|
65
|
-
retry: this.options.retry,
|
|
66
|
-
retryTagFilter: this.options.retryTagFilter,
|
|
67
|
-
strict: this.options.strict,
|
|
68
|
-
worldParameters: this.options.worldParameters,
|
|
69
|
-
},
|
|
70
|
-
shouldExitImmediately: this.options.exit,
|
|
71
|
-
supportCodePaths,
|
|
72
|
-
supportCodeRequiredModules: this.options.requireModule,
|
|
73
|
-
suppressPublishAdvertisement: this.isPublishAdvertisementSuppressed(),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
async expandPaths(unexpandedPaths, defaultExtension) {
|
|
77
|
-
const expandedPaths = await bluebird_1.default.map(unexpandedPaths, async (unexpandedPath) => {
|
|
78
|
-
const matches = await util_1.promisify(glob_1.default)(unexpandedPath, {
|
|
79
|
-
absolute: true,
|
|
80
|
-
cwd: this.cwd,
|
|
81
|
-
});
|
|
82
|
-
const expanded = await bluebird_1.default.map(matches, async (match) => {
|
|
83
|
-
if (path_1.default.extname(match) === '') {
|
|
84
|
-
return await util_1.promisify(glob_1.default)(`${match}/**/*${defaultExtension}`);
|
|
85
|
-
}
|
|
86
|
-
return [match];
|
|
87
|
-
});
|
|
88
|
-
return lodash_1.default.flatten(expanded);
|
|
89
|
-
});
|
|
90
|
-
return lodash_1.default.flatten(expandedPaths).map((x) => path_1.default.normalize(x));
|
|
91
|
-
}
|
|
92
|
-
async expandFeaturePaths(featurePaths) {
|
|
93
|
-
featurePaths = featurePaths.map((p) => p.replace(/(:\d+)*$/g, '')); // Strip line numbers
|
|
94
|
-
featurePaths = [...new Set(featurePaths)]; // Deduplicate the feature files
|
|
95
|
-
return this.expandPaths(featurePaths, '.feature');
|
|
96
|
-
}
|
|
97
|
-
getFeatureDirectoryPaths(featurePaths) {
|
|
98
|
-
const featureDirs = featurePaths.map((featurePath) => {
|
|
99
|
-
let featureDir = path_1.default.dirname(featurePath);
|
|
100
|
-
let childDir;
|
|
101
|
-
let parentDir = featureDir;
|
|
102
|
-
while (childDir !== parentDir) {
|
|
103
|
-
childDir = parentDir;
|
|
104
|
-
parentDir = path_1.default.dirname(childDir);
|
|
105
|
-
if (path_1.default.basename(parentDir) === 'features') {
|
|
106
|
-
featureDir = parentDir;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return path_1.default.relative(this.cwd, featureDir);
|
|
111
|
-
});
|
|
112
|
-
return lodash_1.default.uniq(featureDirs);
|
|
113
|
-
}
|
|
114
|
-
isPublishing() {
|
|
115
|
-
return (this.options.publish ||
|
|
116
|
-
this.isTruthyString(process.env.CUCUMBER_PUBLISH_ENABLED) ||
|
|
117
|
-
process.env.CUCUMBER_PUBLISH_TOKEN !== undefined);
|
|
118
|
-
}
|
|
119
|
-
isPublishAdvertisementSuppressed() {
|
|
120
|
-
return (this.options.publishQuiet ||
|
|
121
|
-
this.isTruthyString(process.env.CUCUMBER_PUBLISH_QUIET));
|
|
122
|
-
}
|
|
123
|
-
getFormats() {
|
|
124
|
-
const mapping = { '': 'progress' };
|
|
125
|
-
this.options.format.forEach((format) => {
|
|
126
|
-
const [type, outputTo] = option_splitter_1.default.split(format);
|
|
127
|
-
mapping[outputTo] = type;
|
|
128
|
-
});
|
|
129
|
-
if (this.isPublishing()) {
|
|
130
|
-
const publishUrl = value_checker_1.valueOrDefault(process.env.CUCUMBER_PUBLISH_URL, DEFAULT_CUCUMBER_PUBLISH_URL);
|
|
131
|
-
mapping[publishUrl] = 'message';
|
|
132
|
-
}
|
|
133
|
-
return lodash_1.default.map(mapping, (type, outputTo) => ({ outputTo, type }));
|
|
134
|
-
}
|
|
135
|
-
isTruthyString(s) {
|
|
136
|
-
if (s === undefined) {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
return s.match(/^(false|no|0)$/i) === null;
|
|
140
|
-
}
|
|
141
|
-
async getUnexpandedFeaturePaths() {
|
|
142
|
-
if (this.args.length > 0) {
|
|
143
|
-
const nestedFeaturePaths = await bluebird_1.default.map(this.args, async (arg) => {
|
|
144
|
-
const filename = path_1.default.basename(arg);
|
|
145
|
-
if (filename[0] === '@') {
|
|
146
|
-
const filePath = path_1.default.join(this.cwd, arg);
|
|
147
|
-
const content = await fs_1.default.readFile(filePath, 'utf8');
|
|
148
|
-
return lodash_1.default.chain(content).split('\n').map(lodash_1.default.trim).value();
|
|
149
|
-
}
|
|
150
|
-
return [arg];
|
|
151
|
-
});
|
|
152
|
-
const featurePaths = lodash_1.default.flatten(nestedFeaturePaths);
|
|
153
|
-
if (featurePaths.length > 0) {
|
|
154
|
-
return lodash_1.default.compact(featurePaths);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return ['features/**/*.{feature,feature.md}'];
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
exports.default = ConfigurationBuilder;
|
|
161
|
-
//# sourceMappingURL=configuration_builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configuration_builder.js","sourceRoot":"","sources":["../../src/cli/configuration_builder.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,gEAGsB;AACtB,+CAAsB;AACtB,gDAAuB;AACvB,wEAA8C;AAC9C,wDAA+B;AAC/B,gDAAuB;AACvB,+BAAgC;AAGhC,oDAAiD;AAgCjD,MAAM,4BAA4B,GAAG,0CAA0C,CAAA;AAE/E,MAAqB,oBAAoB;IAYvC,YAAY,EAAE,IAAI,EAAE,GAAG,EAAmC;QACxD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QAEd,qBAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACrB,MAAM,UAAU,GAAG,qBAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACzC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAA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;CACF;AAjLD,uCAiLC","sourcesContent":["import _ from 'lodash'\nimport ArgvParser, {\n IParsedArgvFormatOptions,\n IParsedArgvOptions,\n} from './argv_parser'\nimport fs from 'mz/fs'\nimport path from 'path'\nimport OptionSplitter from './option_splitter'\nimport bluebird from 'bluebird'\nimport glob from 'glob'\nimport { promisify } from 'util'\nimport { IPickleFilterOptions } from '../pickle_filter'\nimport { IRuntimeOptions } from '../runtime'\nimport { valueOrDefault } from '../value_checker'\n\nexport interface IConfigurationFormat {\n outputTo: string\n type: string\n}\n\nexport interface IConfiguration {\n featureDefaultLanguage: string\n featurePaths: string[]\n formats: IConfigurationFormat[]\n formatOptions: IParsedArgvFormatOptions\n publishing: boolean\n listI18nKeywordsFor: string\n listI18nLanguages: boolean\n order: string\n parallel: number\n pickleFilterOptions: IPickleFilterOptions\n predictableIds: boolean\n profiles: string[]\n runtimeOptions: IRuntimeOptions\n shouldExitImmediately: boolean\n supportCodePaths: string[]\n supportCodeRequiredModules: string[]\n suppressPublishAdvertisement: boolean\n}\n\nexport interface INewConfigurationBuilderOptions {\n argv: string[]\n cwd: string\n}\n\nconst DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports'\n\nexport default class ConfigurationBuilder {\n static async build(\n options: INewConfigurationBuilderOptions\n ): Promise<IConfiguration> {\n const builder = new ConfigurationBuilder(options)\n return await builder.build()\n }\n\n private readonly cwd: string\n private readonly args: string[]\n private readonly options: IParsedArgvOptions\n\n constructor({ argv, cwd }: INewConfigurationBuilderOptions) {\n this.cwd = cwd\n\n ArgvParser.lint(argv)\n const parsedArgv = ArgvParser.parse(argv)\n this.args = parsedArgv.args\n this.options = parsedArgv.options\n }\n\n async build(): Promise<IConfiguration> {\n const listI18nKeywordsFor = this.options.i18nKeywords\n const listI18nLanguages = this.options.i18nLanguages\n const unexpandedFeaturePaths = await this.getUnexpandedFeaturePaths()\n let featurePaths: string[] = []\n let supportCodePaths: string[] = []\n if (listI18nKeywordsFor === '' && !listI18nLanguages) {\n featurePaths = await this.expandFeaturePaths(unexpandedFeaturePaths)\n let unexpandedSupportCodePaths = this.options.require\n if (unexpandedSupportCodePaths.length === 0) {\n unexpandedSupportCodePaths = this.getFeatureDirectoryPaths(featurePaths)\n }\n supportCodePaths = await this.expandPaths(\n unexpandedSupportCodePaths,\n '.js'\n )\n }\n return {\n featureDefaultLanguage: this.options.language,\n featurePaths,\n formats: this.getFormats(),\n formatOptions: this.options.formatOptions,\n publishing: this.isPublishing(),\n listI18nKeywordsFor,\n listI18nLanguages,\n order: this.options.order,\n parallel: this.options.parallel,\n pickleFilterOptions: {\n cwd: this.cwd,\n featurePaths: unexpandedFeaturePaths,\n names: this.options.name,\n tagExpression: this.options.tags,\n },\n predictableIds: this.options.predictableIds,\n profiles: this.options.profile,\n runtimeOptions: {\n dryRun: this.options.dryRun,\n predictableIds: this.options.predictableIds,\n failFast: this.options.failFast,\n filterStacktraces: !this.options.backtrace,\n retry: this.options.retry,\n retryTagFilter: this.options.retryTagFilter,\n strict: this.options.strict,\n worldParameters: this.options.worldParameters,\n },\n shouldExitImmediately: this.options.exit,\n supportCodePaths,\n supportCodeRequiredModules: this.options.requireModule,\n suppressPublishAdvertisement: this.isPublishAdvertisementSuppressed(),\n }\n }\n\n async expandPaths(\n unexpandedPaths: string[],\n defaultExtension: string\n ): Promise<string[]> {\n const expandedPaths = await bluebird.map(\n unexpandedPaths,\n async (unexpandedPath) => {\n const matches = await promisify(glob)(unexpandedPath, {\n absolute: true,\n cwd: this.cwd,\n })\n const expanded = await bluebird.map(matches, async (match) => {\n if (path.extname(match) === '') {\n return await promisify(glob)(`${match}/**/*${defaultExtension}`)\n }\n return [match]\n })\n return _.flatten(expanded)\n }\n )\n return _.flatten(expandedPaths).map((x) => path.normalize(x))\n }\n\n async expandFeaturePaths(featurePaths: string[]): Promise<string[]> {\n featurePaths = featurePaths.map((p) => p.replace(/(:\\d+)*$/g, '')) // Strip line numbers\n featurePaths = [...new Set(featurePaths)] // Deduplicate the feature files\n return this.expandPaths(featurePaths, '.feature')\n }\n\n getFeatureDirectoryPaths(featurePaths: string[]): string[] {\n const featureDirs = featurePaths.map((featurePath) => {\n let featureDir = path.dirname(featurePath)\n let childDir: string\n let parentDir = featureDir\n while (childDir !== parentDir) {\n childDir = parentDir\n parentDir = path.dirname(childDir)\n if (path.basename(parentDir) === 'features') {\n featureDir = parentDir\n break\n }\n }\n return path.relative(this.cwd, featureDir)\n })\n return _.uniq(featureDirs)\n }\n\n isPublishing(): boolean {\n return (\n this.options.publish ||\n this.isTruthyString(process.env.CUCUMBER_PUBLISH_ENABLED) ||\n process.env.CUCUMBER_PUBLISH_TOKEN !== undefined\n )\n }\n\n isPublishAdvertisementSuppressed(): boolean {\n return (\n this.options.publishQuiet ||\n this.isTruthyString(process.env.CUCUMBER_PUBLISH_QUIET)\n )\n }\n\n getFormats(): IConfigurationFormat[] {\n const mapping: { [key: string]: string } = { '': 'progress' }\n this.options.format.forEach((format) => {\n const [type, outputTo] = OptionSplitter.split(format)\n mapping[outputTo] = type\n })\n if (this.isPublishing()) {\n const publishUrl = valueOrDefault(\n process.env.CUCUMBER_PUBLISH_URL,\n DEFAULT_CUCUMBER_PUBLISH_URL\n )\n\n mapping[publishUrl] = 'message'\n }\n return _.map(mapping, (type, outputTo) => ({ outputTo, type }))\n }\n\n isTruthyString(s: string | undefined): boolean {\n if (s === undefined) {\n return false\n }\n return s.match(/^(false|no|0)$/i) === null\n }\n\n async getUnexpandedFeaturePaths(): Promise<string[]> {\n if (this.args.length > 0) {\n const nestedFeaturePaths = await bluebird.map(this.args, async (arg) => {\n const filename = path.basename(arg)\n if (filename[0] === '@') {\n const filePath = path.join(this.cwd, arg)\n const content = await fs.readFile(filePath, 'utf8')\n return _.chain(content).split('\\n').map(_.trim).value()\n }\n return [arg]\n })\n const featurePaths = _.flatten(nestedFeaturePaths)\n if (featurePaths.length > 0) {\n return _.compact(featurePaths)\n }\n }\n return ['features/**/*.{feature,feature.md}']\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"option_splitter.js","sourceRoot":"","sources":["../../src/cli/option_splitter.ts"],"names":[],"mappings":";;AAAA,MAAM,cAAc,GAAG;IACrB,KAAK,CAAC,MAAc;QAClB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;QAE7C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAc,EAAE,IAAY,EAAE,CAAS,EAAE,EAAE;YACtE,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;gBAC1B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;aAC1C;YAED,OAAO,IAAI,CAAA;QACb,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;SAChB;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACpB,CAAC;AAED,kBAAe,cAAc,CAAA","sourcesContent":["const OptionSplitter = {\n split(option: string): string[] {\n const parts = option.split(/([^A-Z]):(?!\\\\)/)\n\n const result = parts.reduce((memo: string[], part: string, i: number) => {\n if (partNeedsRecombined(i)) {\n memo.push(parts.slice(i, i + 2).join(''))\n }\n\n return memo\n }, [])\n\n if (result.length === 1) {\n result.push('')\n }\n\n return result\n },\n}\n\nfunction partNeedsRecombined(i: number): boolean {\n return i % 2 === 0\n}\n\nexport default OptionSplitter\n"]}
|
|
@@ -1,42 +0,0 @@
|
|
|
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 lodash_1 = __importDefault(require("lodash"));
|
|
7
|
-
const fs_1 = __importDefault(require("mz/fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const string_argv_1 = __importDefault(require("string-argv"));
|
|
10
|
-
const value_checker_1 = require("../value_checker");
|
|
11
|
-
class ProfileLoader {
|
|
12
|
-
constructor(directory) {
|
|
13
|
-
this.directory = directory;
|
|
14
|
-
}
|
|
15
|
-
async getDefinitions() {
|
|
16
|
-
const definitionsFilePath = path_1.default.join(this.directory, 'cucumber.js');
|
|
17
|
-
const exists = await fs_1.default.exists(definitionsFilePath);
|
|
18
|
-
if (!exists) {
|
|
19
|
-
return {};
|
|
20
|
-
}
|
|
21
|
-
const definitions = require(definitionsFilePath); // eslint-disable-line @typescript-eslint/no-var-requires
|
|
22
|
-
if (typeof definitions !== 'object') {
|
|
23
|
-
throw new Error(`${definitionsFilePath} does not export an object`);
|
|
24
|
-
}
|
|
25
|
-
return definitions;
|
|
26
|
-
}
|
|
27
|
-
async getArgv(profiles) {
|
|
28
|
-
const definitions = await this.getDefinitions();
|
|
29
|
-
if (profiles.length === 0 && value_checker_1.doesHaveValue(definitions.default)) {
|
|
30
|
-
profiles = ['default'];
|
|
31
|
-
}
|
|
32
|
-
const argvs = profiles.map((profile) => {
|
|
33
|
-
if (value_checker_1.doesNotHaveValue(definitions[profile])) {
|
|
34
|
-
throw new Error(`Undefined profile: ${profile}`);
|
|
35
|
-
}
|
|
36
|
-
return string_argv_1.default(definitions[profile]);
|
|
37
|
-
});
|
|
38
|
-
return lodash_1.default.flatten(argvs);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.default = ProfileLoader;
|
|
42
|
-
//# sourceMappingURL=profile_loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile_loader.js","sourceRoot":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CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;CACF;AAjCD,gCAiCC","sourcesContent":["import _ from 'lodash'\nimport fs from 'mz/fs'\nimport path from 'path'\nimport stringArgv from 'string-argv'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\n\nexport default class ProfileLoader {\n private readonly directory: string\n\n constructor(directory: string) {\n this.directory = directory\n }\n\n async getDefinitions(): Promise<Record<string, string>> {\n const definitionsFilePath = path.join(this.directory, 'cucumber.js')\n const exists = await fs.exists(definitionsFilePath)\n if (!exists) {\n return {}\n }\n const definitions = require(definitionsFilePath) // eslint-disable-line @typescript-eslint/no-var-requires\n if (typeof definitions !== 'object') {\n throw new Error(`${definitionsFilePath} does not export an object`)\n }\n return definitions\n }\n\n async getArgv(profiles: string[]): Promise<string[]> {\n const definitions = await this.getDefinitions()\n if (profiles.length === 0 && doesHaveValue(definitions.default)) {\n profiles = ['default']\n }\n const argvs = profiles.map((profile) => {\n if (doesNotHaveValue(definitions[profile])) {\n throw new Error(`Undefined profile: ${profile}`)\n }\n return stringArgv(definitions[profile])\n })\n return _.flatten(argvs)\n }\n}\n"]}
|
|
@@ -1,41 +0,0 @@
|
|
|
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.buildParameterType = exports.getDefinitionLineAndUri = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
-
const cucumber_expressions_1 = require("@cucumber/cucumber-expressions");
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const stacktrace_js_1 = __importDefault(require("stacktrace-js"));
|
|
11
|
-
const stack_trace_filter_1 = require("../stack_trace_filter");
|
|
12
|
-
const value_checker_1 = require("../value_checker");
|
|
13
|
-
function getDefinitionLineAndUri(cwd) {
|
|
14
|
-
let line;
|
|
15
|
-
let uri;
|
|
16
|
-
const stackframes = stacktrace_js_1.default.getSync();
|
|
17
|
-
const stackframe = lodash_1.default.find(stackframes, (frame) => {
|
|
18
|
-
return !stack_trace_filter_1.isFileNameInCucumber(frame.getFileName());
|
|
19
|
-
});
|
|
20
|
-
if (value_checker_1.doesHaveValue(stackframe)) {
|
|
21
|
-
line = stackframe.getLineNumber();
|
|
22
|
-
uri = stackframe.getFileName();
|
|
23
|
-
if (value_checker_1.doesHaveValue(uri)) {
|
|
24
|
-
uri = path_1.default.relative(cwd, uri);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
line: value_checker_1.valueOrDefault(line, 0),
|
|
29
|
-
uri: value_checker_1.valueOrDefault(uri, 'unknown'),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
exports.getDefinitionLineAndUri = getDefinitionLineAndUri;
|
|
33
|
-
function buildParameterType({ name, regexp, transformer, useForSnippets, preferForRegexpMatch, }) {
|
|
34
|
-
if (typeof useForSnippets !== 'boolean')
|
|
35
|
-
useForSnippets = true;
|
|
36
|
-
if (typeof preferForRegexpMatch !== 'boolean')
|
|
37
|
-
preferForRegexpMatch = false;
|
|
38
|
-
return new cucumber_expressions_1.ParameterType(name, regexp, null, transformer, useForSnippets, preferForRegexpMatch);
|
|
39
|
-
}
|
|
40
|
-
exports.buildParameterType = buildParameterType;
|
|
41
|
-
//# sourceMappingURL=build_helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build_helpers.js","sourceRoot":"","sources":["../../src/support_code_library_builder/build_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsB;AACtB,yEAA8D;AAC9D,gDAAuB;AACvB,kEAAsC;AACtC,8DAA4D;AAC5D,oDAAgE;AAIhE,SAAgB,uBAAuB,CAAC,GAAW;IACjD,IAAI,IAAY,CAAA;IAChB,IAAI,GAAW,CAAA;IACf,MAAM,WAAW,GAAG,uBAAU,CAAC,OAAO,EAAE,CAAA;IACxC,MAAM,UAAU,GAAG,gBAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;QAC/C,OAAO,CAAC,yCAAoB,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;IACnD,CAAC,CAAC,CAAA;IACF,IAAI,6BAAa,CAAC,UAAU,CAAC,EAAE;QAC7B,IAAI,GAAG,UAAU,CAAC,aAAa,EAAE,CAAA;QACjC,GAAG,GAAG,UAAU,CAAC,WAAW,EAAE,CAAA;QAC9B,IAAI,6BAAa,CAAC,GAAG,CAAC,EAAE;YACtB,GAAG,GAAG,cAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;SAC9B;KACF;IACD,OAAO;QACL,IAAI,EAAE,8BAAc,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7B,GAAG,EAAE,8BAAc,CAAC,GAAG,EAAE,SAAS,CAAC;KACpC,CAAA;AACH,CAAC;AAlBD,0DAkBC;AAED,SAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,MAAM,EACN,WAAW,EACX,cAAc,EACd,oBAAoB,GACU;IAC9B,IAAI,OAAO,cAAc,KAAK,SAAS;QAAE,cAAc,GAAG,IAAI,CAAA;IAC9D,IAAI,OAAO,oBAAoB,KAAK,SAAS;QAAE,oBAAoB,GAAG,KAAK,CAAA;IAC3E,OAAO,IAAI,oCAAa,CACtB,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,WAAW,EACX,cAAc,EACd,oBAAoB,CACrB,CAAA;AACH,CAAC;AAjBD,gDAiBC","sourcesContent":["import _ from 'lodash'\nimport { ParameterType } from '@cucumber/cucumber-expressions'\nimport path from 'path'\nimport StackTrace from 'stacktrace-js'\nimport { isFileNameInCucumber } from '../stack_trace_filter'\nimport { doesHaveValue, valueOrDefault } from '../value_checker'\nimport { ILineAndUri } from '../types'\nimport { IParameterTypeDefinition } from './types'\n\nexport function getDefinitionLineAndUri(cwd: string): ILineAndUri {\n let line: number\n let uri: string\n const stackframes = StackTrace.getSync()\n const stackframe = _.find(stackframes, (frame) => {\n return !isFileNameInCucumber(frame.getFileName())\n })\n if (doesHaveValue(stackframe)) {\n line = stackframe.getLineNumber()\n uri = stackframe.getFileName()\n if (doesHaveValue(uri)) {\n uri = path.relative(cwd, uri)\n }\n }\n return {\n line: valueOrDefault(line, 0),\n uri: valueOrDefault(uri, 'unknown'),\n }\n}\n\nexport function buildParameterType({\n name,\n regexp,\n transformer,\n useForSnippets,\n preferForRegexpMatch,\n}: IParameterTypeDefinition<any>): ParameterType<any> {\n if (typeof useForSnippets !== 'boolean') useForSnippets = true\n if (typeof preferForRegexpMatch !== 'boolean') preferForRegexpMatch = false\n return new ParameterType(\n name,\n regexp,\n null,\n transformer,\n useForSnippets,\n preferForRegexpMatch\n )\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface IDefinitionConfig {
|
|
2
|
-
code: any;
|
|
3
|
-
line: number;
|
|
4
|
-
uri: string;
|
|
5
|
-
}
|
|
6
|
-
export interface IValidateNoGeneratorFunctionsRequest {
|
|
7
|
-
cwd: string;
|
|
8
|
-
definitionConfigs: IDefinitionConfig[];
|
|
9
|
-
}
|
|
10
|
-
export declare function validateNoGeneratorFunctions({ cwd, definitionConfigs, }: IValidateNoGeneratorFunctionsRequest): void;
|
|
@@ -1,26 +0,0 @@
|
|
|
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.validateNoGeneratorFunctions = void 0;
|
|
7
|
-
const is_generator_1 = __importDefault(require("is-generator"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
function validateNoGeneratorFunctions({ cwd, definitionConfigs, }) {
|
|
10
|
-
const generatorDefinitionConfigs = definitionConfigs.filter((definitionConfig) => is_generator_1.default.fn(definitionConfig.code));
|
|
11
|
-
if (generatorDefinitionConfigs.length > 0) {
|
|
12
|
-
const references = generatorDefinitionConfigs
|
|
13
|
-
.map((definitionConfig) => `${path_1.default.relative(cwd, definitionConfig.uri)}:${definitionConfig.line.toString()}`)
|
|
14
|
-
.join('\n ');
|
|
15
|
-
const message = `
|
|
16
|
-
The following hook/step definitions use generator functions:
|
|
17
|
-
|
|
18
|
-
${references}
|
|
19
|
-
|
|
20
|
-
Use 'this.setDefinitionFunctionWrapper(fn)' to wrap them in a function that returns a promise.
|
|
21
|
-
`;
|
|
22
|
-
throw new Error(message);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.validateNoGeneratorFunctions = validateNoGeneratorFunctions;
|
|
26
|
-
//# sourceMappingURL=finalize_helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"finalize_helpers.js","sourceRoot":"","sources":["../../src/support_code_library_builder/finalize_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAsC;AACtC,gDAAuB;AAavB,SAAgB,4BAA4B,CAAC,EAC3C,GAAG,EACH,iBAAiB,GACoB;IACrC,MAAM,0BAA0B,GAAG,iBAAiB,CAAC,MAAM,CACzD,CAAC,gBAAgB,EAAE,EAAE,CAAC,sBAAW,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAC5D,CAAA;IACD,IAAI,0BAA0B,CAAC,MAAM,GAAG,CAAC,EAAE;QACzC,MAAM,UAAU,GAAG,0BAA0B;aAC1C,GAAG,CACF,CAAC,gBAAgB,EAAE,EAAE,CACnB,GAAG,cAAI,CAAC,QAAQ,CACd,GAAG,EACH,gBAAgB,CAAC,GAAG,CACrB,IAAI,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAC1C;aACA,IAAI,CAAC,MAAM,CAAC,CAAA;QACf,MAAM,OAAO,GAAG;;;UAGV,UAAU;;;OAGb,CAAA;QACH,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;KACzB;AACH,CAAC;AA1BD,oEA0BC","sourcesContent":["import isGenerator from 'is-generator'\nimport path from 'path'\n\nexport interface IDefinitionConfig {\n code: any\n line: number\n uri: string\n}\n\nexport interface IValidateNoGeneratorFunctionsRequest {\n cwd: string\n definitionConfigs: IDefinitionConfig[]\n}\n\nexport function validateNoGeneratorFunctions({\n cwd,\n definitionConfigs,\n}: IValidateNoGeneratorFunctionsRequest): void {\n const generatorDefinitionConfigs = definitionConfigs.filter(\n (definitionConfig) => isGenerator.fn(definitionConfig.code)\n )\n if (generatorDefinitionConfigs.length > 0) {\n const references = generatorDefinitionConfigs\n .map(\n (definitionConfig) =>\n `${path.relative(\n cwd,\n definitionConfig.uri\n )}:${definitionConfig.line.toString()}`\n )\n .join('\\n ')\n const message = `\n The following hook/step definitions use generator functions:\n\n ${references}\n\n Use 'this.setDefinitionFunctionWrapper(fn)' to wrap them in a function that returns a promise.\n `\n throw new Error(message)\n }\n}\n"]}
|