@cucumber/cucumber 7.3.0 → 8.0.0-rc.2
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 +11 -4
- package/lib/cli/argv_parser.d.ts +3 -3
- package/lib/cli/argv_parser.js +19 -19
- package/lib/cli/argv_parser.js.map +1 -1
- package/lib/cli/configuration_builder.d.ts +5 -46
- package/lib/cli/configuration_builder.js +61 -150
- package/lib/cli/configuration_builder.js.map +1 -1
- package/lib/cli/helpers.d.ts +5 -3
- package/lib/cli/helpers.js +42 -15
- 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 +4 -23
- package/lib/cli/index.js +18 -193
- 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/option_splitter.js +1 -0
- package/lib/cli/option_splitter.js.map +1 -1
- package/lib/cli/profile_loader.d.ts +3 -2
- package/lib/cli/profile_loader.js +20 -13
- package/lib/cli/profile_loader.js.map +1 -1
- package/lib/cli/publish_banner.js +1 -1
- package/lib/cli/publish_banner.js.map +1 -1
- package/lib/cli/run.js +3 -4
- package/lib/cli/run.js.map +1 -1
- package/lib/configuration/index.d.ts +1 -0
- package/lib/configuration/index.js +14 -0
- package/lib/configuration/index.js.map +1 -0
- package/lib/configuration/types.d.ts +29 -0
- package/lib/configuration/types.js +3 -0
- package/lib/configuration/types.js.map +1 -0
- package/lib/formatter/builder.d.ts +5 -4
- package/lib/formatter/builder.js +41 -55
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/get_color_fns.d.ts +4 -0
- package/lib/formatter/get_color_fns.js +11 -4
- 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 +2 -2
- package/lib/formatter/helpers/issue_helpers.js +6 -7
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +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.js +12 -12
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js +17 -20
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js +26 -40
- 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 +1 -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 +17 -16
- 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 -2
- 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 +10 -10
- 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 -9
- 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 -2
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/importer.js +13 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -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/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/run/formatters.d.ts +14 -0
- package/lib/run/formatters.js +76 -0
- package/lib/run/formatters.js.map +1 -0
- package/lib/run/index.d.ts +2 -0
- package/lib/run/index.js +15 -0
- package/lib/run/index.js.map +1 -0
- package/lib/run/paths.d.ts +6 -0
- package/lib/run/paths.js +83 -0
- package/lib/run/paths.js.map +1 -0
- package/lib/run/runCucumber.d.ts +3 -0
- package/lib/run/runCucumber.js +88 -0
- package/lib/run/runCucumber.js.map +1 -0
- package/lib/run/runtime.d.ts +19 -0
- package/lib/run/runtime.js +58 -0
- package/lib/run/runtime.js.map +1 -0
- package/lib/run/support.d.ts +8 -0
- package/lib/run/support.js +26 -0
- package/lib/run/support.js.map +1 -0
- package/lib/run/types.d.ts +12 -0
- package/lib/run/types.js +3 -0
- package/lib/run/types.js.map +1 -0
- 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 +5 -3
- package/lib/runtime/index.js +22 -46
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +6 -5
- package/lib/runtime/parallel/coordinator.js +19 -22
- 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.js +21 -13
- package/lib/runtime/parallel/worker.js.map +1 -1
- 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.js +18 -31
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +2 -1
- 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 +38 -0
- package/package.json +77 -67
- package/CHANGELOG.md +0 -1908
- 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
|
@@ -0,0 +1,41 @@
|
|
|
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 json_formatter_1 = __importDefault(require("../json_formatter"));
|
|
7
|
+
const message_formatter_1 = __importDefault(require("../message_formatter"));
|
|
8
|
+
const progress_bar_formatter_1 = __importDefault(require("../progress_bar_formatter"));
|
|
9
|
+
const progress_formatter_1 = __importDefault(require("../progress_formatter"));
|
|
10
|
+
const rerun_formatter_1 = __importDefault(require("../rerun_formatter"));
|
|
11
|
+
const snippets_formatter_1 = __importDefault(require("../snippets_formatter"));
|
|
12
|
+
const summary_formatter_1 = __importDefault(require("../summary_formatter"));
|
|
13
|
+
const usage_formatter_1 = __importDefault(require("../usage_formatter"));
|
|
14
|
+
const usage_json_formatter_1 = __importDefault(require("../usage_json_formatter"));
|
|
15
|
+
const html_formatter_1 = __importDefault(require("../html_formatter"));
|
|
16
|
+
const Formatters = {
|
|
17
|
+
getFormatters() {
|
|
18
|
+
return {
|
|
19
|
+
json: json_formatter_1.default,
|
|
20
|
+
message: message_formatter_1.default,
|
|
21
|
+
html: html_formatter_1.default,
|
|
22
|
+
progress: progress_formatter_1.default,
|
|
23
|
+
'progress-bar': progress_bar_formatter_1.default,
|
|
24
|
+
rerun: rerun_formatter_1.default,
|
|
25
|
+
snippets: snippets_formatter_1.default,
|
|
26
|
+
summary: summary_formatter_1.default,
|
|
27
|
+
usage: usage_formatter_1.default,
|
|
28
|
+
'usage-json': usage_json_formatter_1.default,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
buildFormattersDocumentationString() {
|
|
32
|
+
let concatanatedFormattersDocumentation = '';
|
|
33
|
+
const formatters = this.getFormatters();
|
|
34
|
+
for (const formatterName in formatters) {
|
|
35
|
+
concatanatedFormattersDocumentation += ` ${formatterName}: ${formatters[formatterName].documentation}\n`;
|
|
36
|
+
}
|
|
37
|
+
return concatanatedFormattersDocumentation;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
exports.default = Formatters;
|
|
41
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../src/formatter/helpers/formatters.ts"],"names":[],"mappings":";;;;;AACA,uEAA6C;AAC7C,6EAAmD;AACnD,uFAA4D;AAC5D,+EAAqD;AACrD,yEAA+C;AAC/C,+EAAqD;AACrD,6EAAmD;AACnD,yEAA+C;AAC/C,mFAAwD;AACxD,uEAA6C;AAE7C,MAAM,UAAU,GAAG;IACjB,aAAa;QACX,OAAO;YACL,IAAI,EAAE,wBAAa;YACnB,OAAO,EAAE,2BAAgB;YACzB,IAAI,EAAE,wBAAa;YACnB,QAAQ,EAAE,4BAAiB;YAC3B,cAAc,EAAE,gCAAoB;YACpC,KAAK,EAAE,yBAAc;YACrB,QAAQ,EAAE,4BAAiB;YAC3B,OAAO,EAAE,2BAAgB;YACzB,KAAK,EAAE,yBAAc;YACrB,YAAY,EAAE,8BAAkB;SACjC,CAAA;IACH,CAAC;IACD,kCAAkC;QAChC,IAAI,mCAAmC,GAAW,EAAE,CAAA;QACpD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QACvC,KAAK,MAAM,aAAa,IAAI,UAAU,EAAE;YACtC,mCAAmC,IAAI,OAAO,aAAa,KAAK,UAAU,CAAC,aAAa,CAAC,CAAC,aAAa,IAAI,CAAA;SAC5G;QAED,OAAO,mCAAmC,CAAA;IAC5C,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import Formatter from '../.'\nimport JsonFormatter from '../json_formatter'\nimport MessageFormatter from '../message_formatter'\nimport ProgressBarFormatter from '../progress_bar_formatter'\nimport ProgressFormatter from '../progress_formatter'\nimport RerunFormatter from '../rerun_formatter'\nimport SnippetsFormatter from '../snippets_formatter'\nimport SummaryFormatter from '../summary_formatter'\nimport UsageFormatter from '../usage_formatter'\nimport UsageJsonFormatter from '../usage_json_formatter'\nimport HtmlFormatter from '../html_formatter'\n\nconst Formatters = {\n getFormatters(): Record<string, typeof Formatter> {\n return {\n json: JsonFormatter,\n message: MessageFormatter,\n html: HtmlFormatter,\n progress: ProgressFormatter,\n 'progress-bar': ProgressBarFormatter,\n rerun: RerunFormatter,\n snippets: SnippetsFormatter,\n summary: SummaryFormatter,\n usage: UsageFormatter,\n 'usage-json': UsageJsonFormatter,\n }\n },\n buildFormattersDocumentationString(): string {\n let concatanatedFormattersDocumentation: string = ''\n const formatters = this.getFormatters()\n for (const formatterName in formatters) {\n concatanatedFormattersDocumentation += ` ${formatterName}: ${formatters[formatterName].documentation}\\n`\n }\n\n return concatanatedFormattersDocumentation\n },\n}\n\nexport default Formatters\n"]}
|
|
@@ -1,76 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getGherkinScenarioLocationMap = exports.getGherkinExampleRuleMap = exports.getGherkinScenarioMap = exports.getGherkinStepMap = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
4
|
const value_checker_1 = require("../../value_checker");
|
|
9
5
|
function getGherkinStepMap(gherkinDocument) {
|
|
10
|
-
|
|
6
|
+
const result = {};
|
|
7
|
+
gherkinDocument.feature.children
|
|
11
8
|
.map(extractStepContainers)
|
|
12
|
-
.
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
.map((step) => [step.id, step])
|
|
16
|
-
.fromPairs()
|
|
17
|
-
.value();
|
|
9
|
+
.flat()
|
|
10
|
+
.forEach((x) => x.steps.forEach((step) => (result[step.id] = step)));
|
|
11
|
+
return result;
|
|
18
12
|
}
|
|
19
13
|
exports.getGherkinStepMap = getGherkinStepMap;
|
|
20
14
|
function extractStepContainers(child) {
|
|
21
|
-
if (value_checker_1.doesHaveValue(child.background)) {
|
|
15
|
+
if ((0, value_checker_1.doesHaveValue)(child.background)) {
|
|
22
16
|
return [child.background];
|
|
23
17
|
}
|
|
24
|
-
else if (value_checker_1.doesHaveValue(child.rule)) {
|
|
25
|
-
return child.rule.children.map((ruleChild) => value_checker_1.doesHaveValue(ruleChild.background)
|
|
18
|
+
else if ((0, value_checker_1.doesHaveValue)(child.rule)) {
|
|
19
|
+
return child.rule.children.map((ruleChild) => (0, value_checker_1.doesHaveValue)(ruleChild.background)
|
|
26
20
|
? ruleChild.background
|
|
27
21
|
: ruleChild.scenario);
|
|
28
22
|
}
|
|
29
23
|
return [child.scenario];
|
|
30
24
|
}
|
|
31
25
|
function getGherkinScenarioMap(gherkinDocument) {
|
|
32
|
-
|
|
26
|
+
const result = {};
|
|
27
|
+
gherkinDocument.feature.children
|
|
33
28
|
.map((child) => {
|
|
34
|
-
if (value_checker_1.doesHaveValue(child.rule)) {
|
|
29
|
+
if ((0, value_checker_1.doesHaveValue)(child.rule)) {
|
|
35
30
|
return child.rule.children;
|
|
36
31
|
}
|
|
37
32
|
return [child];
|
|
38
33
|
})
|
|
39
|
-
.
|
|
40
|
-
.
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
.flat()
|
|
35
|
+
.forEach((x) => {
|
|
36
|
+
if (x.scenario != null) {
|
|
37
|
+
result[x.scenario.id] = x.scenario;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return result;
|
|
45
41
|
}
|
|
46
42
|
exports.getGherkinScenarioMap = getGherkinScenarioMap;
|
|
47
43
|
function getGherkinExampleRuleMap(gherkinDocument) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.
|
|
51
|
-
.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
.flatten()
|
|
57
|
-
.fromPairs()
|
|
58
|
-
.value();
|
|
44
|
+
const result = {};
|
|
45
|
+
gherkinDocument.feature.children
|
|
46
|
+
.filter((x) => x.rule != null)
|
|
47
|
+
.forEach((x) => x.rule.children
|
|
48
|
+
.filter((child) => (0, value_checker_1.doesHaveValue)(child.scenario))
|
|
49
|
+
.forEach((child) => (result[child.scenario.id] = x.rule)));
|
|
50
|
+
return result;
|
|
59
51
|
}
|
|
60
52
|
exports.getGherkinExampleRuleMap = getGherkinExampleRuleMap;
|
|
61
53
|
function getGherkinScenarioLocationMap(gherkinDocument) {
|
|
62
54
|
const locationMap = {};
|
|
63
55
|
const scenarioMap = getGherkinScenarioMap(gherkinDocument);
|
|
64
|
-
|
|
56
|
+
Object.keys(scenarioMap).forEach((id) => {
|
|
57
|
+
const scenario = scenarioMap[id];
|
|
65
58
|
locationMap[id] = scenario.location;
|
|
66
|
-
if (value_checker_1.doesHaveValue(scenario.examples)) {
|
|
67
|
-
|
|
68
|
-
.map('tableBody')
|
|
69
|
-
.flatten()
|
|
70
|
-
.forEach((tableRow) => {
|
|
71
|
-
locationMap[tableRow.id] = tableRow.location;
|
|
72
|
-
})
|
|
73
|
-
.value();
|
|
59
|
+
if ((0, value_checker_1.doesHaveValue)(scenario.examples)) {
|
|
60
|
+
scenario.examples.forEach((x) => x.tableBody.forEach((tableRow) => (locationMap[tableRow.id] = tableRow.location)));
|
|
74
61
|
}
|
|
75
62
|
});
|
|
76
63
|
return locationMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/gherkin_document_parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/gherkin_document_parser.ts"],"names":[],"mappings":";;;AACA,uDAAmD;AAEnD,SAAgB,iBAAiB,CAC/B,eAAyC;IAEzC,MAAM,MAAM,GAAkC,EAAE,CAAA;IAChD,eAAe,CAAC,OAAO,CAAC,QAAQ;SAC7B,GAAG,CAAC,qBAAqB,CAAC;SAC1B,IAAI,EAAE;SACN,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,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ACH,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC;AAlBD,sEAkBC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport function getGherkinStepMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Step> {\n const result: Record<string, messages.Step> = {}\n gherkinDocument.feature.children\n .map(extractStepContainers)\n .flat()\n .forEach((x) =>\n x.steps.forEach((step: messages.Step) => (result[step.id] = step))\n )\n return result\n}\n\nfunction extractStepContainers(\n child: messages.FeatureChild\n): Array<messages.Scenario | messages.Background> {\n if (doesHaveValue(child.background)) {\n return [child.background]\n } else if (doesHaveValue(child.rule)) {\n return child.rule.children.map((ruleChild) =>\n doesHaveValue(ruleChild.background)\n ? ruleChild.background\n : ruleChild.scenario\n )\n }\n return [child.scenario]\n}\n\nexport function getGherkinScenarioMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Scenario> {\n const result: Record<string, messages.Scenario> = {}\n gherkinDocument.feature.children\n .map((child: messages.FeatureChild) => {\n if (doesHaveValue(child.rule)) {\n return child.rule.children\n }\n return [child]\n })\n .flat()\n .forEach((x) => {\n if (x.scenario != null) {\n result[x.scenario.id] = x.scenario\n }\n })\n return result\n}\n\nexport function getGherkinExampleRuleMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Rule> {\n const result: Record<string, messages.Rule> = {}\n gherkinDocument.feature.children\n .filter((x) => x.rule != null)\n .forEach((x) =>\n x.rule.children\n .filter((child) => doesHaveValue(child.scenario))\n .forEach((child) => (result[child.scenario.id] = x.rule))\n )\n return result\n}\n\nexport function getGherkinScenarioLocationMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Location> {\n const locationMap: Record<string, messages.Location> = {}\n const scenarioMap: Record<string, messages.Scenario> =\n getGherkinScenarioMap(gherkinDocument)\n Object.keys(scenarioMap).forEach((id) => {\n const scenario = scenarioMap[id]\n locationMap[id] = scenario.location\n if (doesHaveValue(scenario.examples)) {\n scenario.examples.forEach((x) =>\n x.tableBody.forEach(\n (tableRow) => (locationMap[tableRow.id] = tableRow.location)\n )\n )\n }\n })\n return locationMap\n}\n"]}
|
|
@@ -3,8 +3,8 @@ import { IColorFns } from '../get_color_fns';
|
|
|
3
3
|
import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
|
|
4
4
|
import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
|
|
5
5
|
import { ITestCaseAttempt } from './event_data_collector';
|
|
6
|
-
export declare function isFailure(result: messages.TestStepResult): boolean;
|
|
7
|
-
export declare function isWarning(result: messages.TestStepResult): boolean;
|
|
6
|
+
export declare function isFailure(result: messages.TestStepResult, willBeRetried?: boolean): boolean;
|
|
7
|
+
export declare function isWarning(result: messages.TestStepResult, willBeRetried?: boolean): boolean;
|
|
8
8
|
export declare function isIssue(result: messages.TestStepResult): boolean;
|
|
9
9
|
export interface IFormatIssueRequest {
|
|
10
10
|
colorFns: IColorFns;
|
|
@@ -6,15 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.formatUndefinedParameterType = exports.formatUndefinedParameterTypes = exports.formatIssue = exports.isIssue = exports.isWarning = exports.isFailure = void 0;
|
|
7
7
|
const indent_string_1 = __importDefault(require("indent-string"));
|
|
8
8
|
const test_case_attempt_formatter_1 = require("./test_case_attempt_formatter");
|
|
9
|
-
function isFailure(result) {
|
|
9
|
+
function isFailure(result, willBeRetried = false) {
|
|
10
10
|
return (result.status === 'AMBIGUOUS' ||
|
|
11
11
|
result.status === 'UNDEFINED' ||
|
|
12
|
-
(result.status === 'FAILED' && !
|
|
12
|
+
(result.status === 'FAILED' && !willBeRetried));
|
|
13
13
|
}
|
|
14
14
|
exports.isFailure = isFailure;
|
|
15
|
-
function isWarning(result) {
|
|
16
|
-
return (result.status === 'PENDING' ||
|
|
17
|
-
(result.status === 'FAILED' && result.willBeRetried));
|
|
15
|
+
function isWarning(result, willBeRetried = false) {
|
|
16
|
+
return (result.status === 'PENDING' || (result.status === 'FAILED' && willBeRetried));
|
|
18
17
|
}
|
|
19
18
|
exports.isWarning = isWarning;
|
|
20
19
|
function isIssue(result) {
|
|
@@ -23,7 +22,7 @@ function isIssue(result) {
|
|
|
23
22
|
exports.isIssue = isIssue;
|
|
24
23
|
function formatIssue({ colorFns, cwd, number, snippetBuilder, testCaseAttempt, supportCodeLibrary, }) {
|
|
25
24
|
const prefix = `${number.toString()}) `;
|
|
26
|
-
const formattedTestCaseAttempt = test_case_attempt_formatter_1.formatTestCaseAttempt({
|
|
25
|
+
const formattedTestCaseAttempt = (0, test_case_attempt_formatter_1.formatTestCaseAttempt)({
|
|
27
26
|
colorFns,
|
|
28
27
|
cwd,
|
|
29
28
|
snippetBuilder,
|
|
@@ -35,7 +34,7 @@ function formatIssue({ colorFns, cwd, number, snippetBuilder, testCaseAttempt, s
|
|
|
35
34
|
if (index === 0) {
|
|
36
35
|
return `${prefix}${line}`;
|
|
37
36
|
}
|
|
38
|
-
return indent_string_1.default(line, prefix.length);
|
|
37
|
+
return (0, indent_string_1.default)(line, prefix.length);
|
|
39
38
|
});
|
|
40
39
|
return updatedLines.join('\n');
|
|
41
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;AACxC,+EAAqE;AAOrE,SAAgB,SAAS,
|
|
1
|
+
{"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;AACxC,+EAAqE;AAOrE,SAAgB,SAAS,CACvB,MAA+B,EAC/B,gBAAyB,KAAK;IAE9B,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,CAA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CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;QAChD,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAA;IAChD,CAAC,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;SACtB,GAAG,CACF,CAAC,aAAa,EAAE,EAAE,CAAC,KAAK,4BAA4B,CAAC,aAAa,CAAC,EAAE,CACtE;SACA,IAAI,CAAC,IAAI,CAAC,CACd,CAAA;IACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACnB,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxB,CAAC;AAjBD,sEAiBC;AAED,SAAgB,4BAA4B,CAC1C,aAA8C;IAE9C,OAAO,IAAI,aAAa,CAAC,IAAI,YAAY,aAAa,CAAC,UAAU,IAAI,CAAA;AACvE,CAAC;AAJD,oEAIC","sourcesContent":["import indentString from 'indent-string'\nimport { formatTestCaseAttempt } from './test_case_attempt_formatter'\nimport * as messages from '@cucumber/messages'\nimport { IColorFns } from '../get_color_fns'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { ITestCaseAttempt } from './event_data_collector'\n\nexport function isFailure(\n result: messages.TestStepResult,\n willBeRetried: boolean = false\n): boolean {\n return (\n result.status === 'AMBIGUOUS' ||\n result.status === 'UNDEFINED' ||\n (result.status === 'FAILED' && !willBeRetried)\n )\n}\n\nexport function isWarning(\n result: messages.TestStepResult,\n willBeRetried: boolean = false\n): boolean {\n return (\n result.status === 'PENDING' || (result.status === 'FAILED' && willBeRetried)\n )\n}\n\nexport function isIssue(result: messages.TestStepResult): boolean {\n return isFailure(result) || isWarning(result)\n}\n\nexport interface IFormatIssueRequest {\n colorFns: IColorFns\n cwd: string\n number: number\n snippetBuilder: StepDefinitionSnippetBuilder\n testCaseAttempt: ITestCaseAttempt\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport function formatIssue({\n colorFns,\n cwd,\n number,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n}: IFormatIssueRequest): string {\n const prefix = `${number.toString()}) `\n const formattedTestCaseAttempt = formatTestCaseAttempt({\n colorFns,\n cwd,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n })\n const lines = formattedTestCaseAttempt.split('\\n')\n const updatedLines = lines.map((line, index) => {\n if (index === 0) {\n return `${prefix}${line}`\n }\n return indentString(line, prefix.length)\n })\n return updatedLines.join('\\n')\n}\n\nexport function formatUndefinedParameterTypes(\n undefinedParameterTypes: messages.UndefinedParameterType[]\n): string {\n const output = [`Undefined parameter types:\\n\\n`]\n const withLatest: Record<string, messages.UndefinedParameterType> = {}\n undefinedParameterTypes.forEach((parameterType) => {\n withLatest[parameterType.name] = parameterType\n })\n output.push(\n Object.values(withLatest)\n .map(\n (parameterType) => `- ${formatUndefinedParameterType(parameterType)}`\n )\n .join('\\n')\n )\n output.push('\\n\\n')\n return output.join('')\n}\n\nexport function formatUndefinedParameterType(\n parameterType: messages.UndefinedParameterType\n): string {\n return `\"${parameterType.name}\" e.g. \\`${parameterType.expression}\\``\n}\n"]}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getStepKeywordType = exports.KeywordType = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
4
|
const gherkin_1 = require("@cucumber/gherkin");
|
|
9
5
|
const value_checker_1 = require("../../value_checker");
|
|
10
6
|
var KeywordType;
|
|
@@ -16,7 +12,7 @@ var KeywordType;
|
|
|
16
12
|
function getStepKeywordType({ keyword, language, previousKeywordType, }) {
|
|
17
13
|
const dialect = gherkin_1.dialects[language];
|
|
18
14
|
const stepKeywords = ['given', 'when', 'then', 'and', 'but'];
|
|
19
|
-
const type =
|
|
15
|
+
const type = stepKeywords.find((key) => dialect[key].includes(keyword));
|
|
20
16
|
switch (type) {
|
|
21
17
|
case 'when':
|
|
22
18
|
return KeywordType.Event;
|
|
@@ -24,7 +20,7 @@ function getStepKeywordType({ keyword, language, previousKeywordType, }) {
|
|
|
24
20
|
return KeywordType.Outcome;
|
|
25
21
|
case 'and':
|
|
26
22
|
case 'but':
|
|
27
|
-
if (value_checker_1.doesHaveValue(previousKeywordType)) {
|
|
23
|
+
if ((0, value_checker_1.doesHaveValue)(previousKeywordType)) {
|
|
28
24
|
return previousKeywordType;
|
|
29
25
|
}
|
|
30
26
|
// fallthrough
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyword_type.js","sourceRoot":"","sources":["../../../src/formatter/helpers/keyword_type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyword_type.js","sourceRoot":"","sources":["../../../src/formatter/helpers/keyword_type.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AACrD,uDAAmD;AAEnD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4CAA6B,CAAA;IAC7B,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAQD,SAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,QAAQ,EACR,mBAAmB,GACQ;IAC3B,MAAM,OAAO,GAAY,kBAAQ,CAAC,QAAQ,CAAC,CAAA;IAC3C,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;IACrE,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;IACvE,QAAQ,IAAI,EAAE;QACZ,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,KAAK,CAAA;QAC1B,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,OAAO,CAAA;QAC5B,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,IAAI,IAAA,6BAAa,EAAC,mBAAmB,CAAC,EAAE;gBACtC,OAAO,mBAAmB,CAAA;aAC3B;QACH,cAAc;QACd;YACE,OAAO,WAAW,CAAC,YAAY,CAAA;KAClC;AACH,CAAC;AAtBD,gDAsBC","sourcesContent":["import { Dialect, dialects } from '@cucumber/gherkin'\nimport { doesHaveValue } from '../../value_checker'\n\nexport enum KeywordType {\n Precondition = 'precondition',\n Event = 'event',\n Outcome = 'outcome',\n}\n\nexport interface IGetStepKeywordTypeOptions {\n keyword: string\n language: string\n previousKeywordType?: KeywordType\n}\n\nexport function getStepKeywordType({\n keyword,\n language,\n previousKeywordType,\n}: IGetStepKeywordTypeOptions): KeywordType {\n const dialect: Dialect = dialects[language]\n const stepKeywords = ['given', 'when', 'then', 'and', 'but'] as const\n const type = stepKeywords.find((key) => dialect[key].includes(keyword))\n switch (type) {\n case 'when':\n return KeywordType.Event\n case 'then':\n return KeywordType.Outcome\n case 'and':\n case 'but':\n if (doesHaveValue(previousKeywordType)) {\n return previousKeywordType\n }\n // fallthrough\n default:\n return KeywordType.Precondition\n }\n}\n"]}
|
|
@@ -8,7 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const value_checker_1 = require("../../value_checker");
|
|
9
9
|
function formatLocation(obj, cwd) {
|
|
10
10
|
let uri = obj.uri;
|
|
11
|
-
if (value_checker_1.doesHaveValue(cwd)) {
|
|
11
|
+
if ((0, value_checker_1.doesHaveValue)(cwd)) {
|
|
12
12
|
uri = path_1.default.relative(cwd, uri);
|
|
13
13
|
}
|
|
14
14
|
return `${uri}:${obj.line.toString()}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/location_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,uDAAmD;AAGnD,SAAgB,cAAc,CAAC,GAAgB,EAAE,GAAY;IAC3D,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;IACjB,IAAI,6BAAa,
|
|
1
|
+
{"version":3,"file":"location_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/location_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,uDAAmD;AAGnD,SAAgB,cAAc,CAAC,GAAgB,EAAE,GAAY;IAC3D,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;IACjB,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,EAAE;QACtB,GAAG,GAAG,cAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;KAC9B;IACD,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAA;AACxC,CAAC;AAND,wCAMC","sourcesContent":["import path from 'path'\nimport { doesHaveValue } from '../../value_checker'\nimport { ILineAndUri } from '../../types'\n\nexport function formatLocation(obj: ILineAndUri, cwd?: string): string {\n let uri = obj.uri\n if (doesHaveValue(cwd)) {\n uri = path.relative(cwd, uri)\n }\n return `${uri}:${obj.line.toString()}`\n}\n"]}
|
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getPickleLocation = exports.getPickleStepMap = exports.getStepKeyword = exports.getScenarioDescription = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
4
|
const gherkin_document_parser_1 = require("./gherkin_document_parser");
|
|
9
5
|
function getScenarioDescription({ pickle, gherkinScenarioMap, }) {
|
|
10
|
-
return
|
|
6
|
+
return pickle.astNodeIds
|
|
11
7
|
.map((id) => gherkinScenarioMap[id])
|
|
12
|
-
.
|
|
13
|
-
.first()
|
|
14
|
-
.value().description;
|
|
8
|
+
.filter((x) => x != null)[0].description;
|
|
15
9
|
}
|
|
16
10
|
exports.getScenarioDescription = getScenarioDescription;
|
|
17
11
|
function getStepKeyword({ pickleStep, gherkinStepMap, }) {
|
|
18
|
-
return
|
|
12
|
+
return pickleStep.astNodeIds
|
|
19
13
|
.map((id) => gherkinStepMap[id])
|
|
20
|
-
.
|
|
21
|
-
.first()
|
|
22
|
-
.value().keyword;
|
|
14
|
+
.filter((x) => x != null)[0].keyword;
|
|
23
15
|
}
|
|
24
16
|
exports.getStepKeyword = getStepKeyword;
|
|
25
17
|
function getPickleStepMap(pickle) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
.value();
|
|
18
|
+
const result = {};
|
|
19
|
+
pickle.steps.forEach((pickleStep) => (result[pickleStep.id] = pickleStep));
|
|
20
|
+
return result;
|
|
30
21
|
}
|
|
31
22
|
exports.getPickleStepMap = getPickleStepMap;
|
|
32
23
|
function getPickleLocation({ gherkinDocument, pickle, }) {
|
|
33
|
-
const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
|
|
34
|
-
return gherkinScenarioLocationMap[
|
|
24
|
+
const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
|
|
25
|
+
return gherkinScenarioLocationMap[pickle.astNodeIds[pickle.astNodeIds.length - 1]];
|
|
35
26
|
}
|
|
36
27
|
exports.getPickleLocation = getPickleLocation;
|
|
37
28
|
//# sourceMappingURL=pickle_parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickle_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/pickle_parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pickle_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/pickle_parser.ts"],"names":[],"mappings":";;;AAAA,uEAAyE;AAkBzE,SAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,kBAAkB,GACa;IAC/B,OAAO,MAAM,CAAC,UAAU;SACrB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;SACnC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;AAC5C,CAAC;AAPD,wDAOC;AAED,SAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,cAAc,GACS;IACvB,OAAO,UAAU,CAAC,UAAU;SACzB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;SAC/B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;AACxC,CAAC;AAPD,wCAOC;AAED,SAAgB,gBAAgB,CAC9B,MAAuB;IAEvB,MAAM,MAAM,GAAwC,EAAE,CAAA;IACtD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAA;IAC1E,OAAO,MAAM,CAAA;AACf,CAAC;AAND,4CAMC;AAED,SAAgB,iBAAiB,CAAC,EAChC,eAAe,EACf,MAAM,GACoB;IAC1B,MAAM,0BAA0B,GAC9B,IAAA,uDAA6B,EAAC,eAAe,CAAC,CAAA;IAChD,OAAO,0BAA0B,CAC/B,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAChD,CAAA;AACH,CAAC;AATD,8CASC","sourcesContent":["import { getGherkinScenarioLocationMap } from './gherkin_document_parser'\nimport * as messages from '@cucumber/messages'\n\nexport interface IGetPickleLocationRequest {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n}\n\nexport interface IGetStepKeywordRequest {\n pickleStep: messages.PickleStep\n gherkinStepMap: Record<string, messages.Step>\n}\n\nexport interface IGetScenarioDescriptionRequest {\n pickle: messages.Pickle\n gherkinScenarioMap: Record<string, messages.Scenario>\n}\n\nexport function getScenarioDescription({\n pickle,\n gherkinScenarioMap,\n}: IGetScenarioDescriptionRequest): string {\n return pickle.astNodeIds\n .map((id) => gherkinScenarioMap[id])\n .filter((x) => x != null)[0].description\n}\n\nexport function getStepKeyword({\n pickleStep,\n gherkinStepMap,\n}: IGetStepKeywordRequest): string {\n return pickleStep.astNodeIds\n .map((id) => gherkinStepMap[id])\n .filter((x) => x != null)[0].keyword\n}\n\nexport function getPickleStepMap(\n pickle: messages.Pickle\n): Record<string, messages.PickleStep> {\n const result: Record<string, messages.PickleStep> = {}\n pickle.steps.forEach((pickleStep) => (result[pickleStep.id] = pickleStep))\n return result\n}\n\nexport function getPickleLocation({\n gherkinDocument,\n pickle,\n}: IGetPickleLocationRequest): messages.Location {\n const gherkinScenarioLocationMap =\n getGherkinScenarioLocationMap(gherkinDocument)\n return gherkinScenarioLocationMap[\n pickle.astNodeIds[pickle.astNodeIds.length - 1]\n ]\n}\n"]}
|
|
@@ -39,7 +39,7 @@ function formatDocString(docString) {
|
|
|
39
39
|
return `"""\n${docString.content}\n"""`;
|
|
40
40
|
}
|
|
41
41
|
function formatStepArgument(arg) {
|
|
42
|
-
return step_arguments_1.parseStepArgument(arg, {
|
|
42
|
+
return (0, step_arguments_1.parseStepArgument)(arg, {
|
|
43
43
|
dataTable: formatDataTable,
|
|
44
44
|
docString: formatDocString,
|
|
45
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step_argument_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/step_argument_formatter.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAC9B,yDAAwD;AAGxD,SAAS,eAAe,CAAC,SAA+B;IACtD,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;QACtB,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,aAAa,EAAE,EAAE;YACjB,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,EAAE;YAClB,IAAI,EAAE,GAAG;YACT,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,EAAE;YACf,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,EAAE;SAChB;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,cAAc,EAAE,CAAC;YACjB,eAAe,EAAE,CAAC;SACnB;KACF,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACtC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACrB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACxD,CACF,CAAA;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;IACnB,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAA;AACzB,CAAC;AAED,SAAS,eAAe,CAAC,SAAmC;IAC1D,OAAO,QAAQ,SAAS,CAAC,OAAO,OAAO,CAAA;AACzC,CAAC;AAED,SAAgB,kBAAkB,CAAC,GAAgC;IACjE,OAAO,kCAAiB,
|
|
1
|
+
{"version":3,"file":"step_argument_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/step_argument_formatter.ts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ACJ,CAAC;AALD,gDAKC","sourcesContent":["import Table from 'cli-table3'\nimport { parseStepArgument } from '../../step_arguments'\nimport * as messages from '@cucumber/messages'\n\nfunction formatDataTable(dataTable: messages.PickleTable): 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': 1,\n 'padding-right': 1,\n },\n })\n const rows = dataTable.rows.map((row) =>\n row.cells.map((cell) =>\n cell.value.replace(/\\\\/g, '\\\\\\\\').replace(/\\n/g, '\\\\n')\n )\n )\n table.push(...rows)\n return table.toString()\n}\n\nfunction formatDocString(docString: messages.PickleDocString): string {\n return `\"\"\"\\n${docString.content}\\n\"\"\"`\n}\n\nexport function formatStepArgument(arg: messages.PickleStepArgument): string {\n return parseStepArgument(arg, {\n dataTable: formatDataTable,\n docString: formatDocString,\n })\n}\n"]}
|
|
@@ -23,7 +23,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.formatSummary = void 0;
|
|
26
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
27
26
|
const duration_1 = __importDefault(require("duration"));
|
|
28
27
|
const messages = __importStar(require("@cucumber/messages"));
|
|
29
28
|
const value_checker_1 = require("../../value_checker");
|
|
@@ -39,14 +38,14 @@ function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }) {
|
|
|
39
38
|
const testCaseResults = [];
|
|
40
39
|
const testStepResults = [];
|
|
41
40
|
let totalStepDuration = messages.TimeConversion.millisecondsToDuration(0);
|
|
42
|
-
testCaseAttempts.forEach(({ testCase, worstTestStepResult, stepResults }) => {
|
|
41
|
+
testCaseAttempts.forEach(({ testCase, willBeRetried, worstTestStepResult, stepResults }) => {
|
|
43
42
|
Object.values(stepResults).forEach((stepResult) => {
|
|
44
43
|
totalStepDuration = messages.TimeConversion.addDurations(totalStepDuration, stepResult.duration);
|
|
45
44
|
});
|
|
46
|
-
if (!
|
|
45
|
+
if (!willBeRetried) {
|
|
47
46
|
testCaseResults.push(worstTestStepResult);
|
|
48
|
-
|
|
49
|
-
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
|
|
47
|
+
testCase.testSteps.forEach((testStep) => {
|
|
48
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
|
|
50
49
|
testStepResults.push(stepResults[testStep.id]);
|
|
51
50
|
}
|
|
52
51
|
});
|
|
@@ -67,8 +66,10 @@ function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }) {
|
|
|
67
66
|
}
|
|
68
67
|
exports.formatSummary = formatSummary;
|
|
69
68
|
function getCountSummary({ colorFns, objects, type, }) {
|
|
70
|
-
const counts =
|
|
71
|
-
|
|
69
|
+
const counts = {};
|
|
70
|
+
STATUS_REPORT_ORDER.forEach((x) => (counts[x] = 0));
|
|
71
|
+
objects.forEach((x) => (counts[x.status] += 1));
|
|
72
|
+
const total = Object.values(counts).reduce((acc, x) => acc + x, 0);
|
|
72
73
|
let text = `${total.toString()} ${type}${total === 1 ? '' : 's'}`;
|
|
73
74
|
if (total > 0) {
|
|
74
75
|
const details = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA+B;AAG/B,6DAA8C;AAC9C,uDAAmD;AAEnD,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,CA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V,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CACxB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CACvD,CACF,CAAA;aACF;QACH,CAAC,CAAC,CAAA;QACF,IAAI,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;KACnC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,kBAAkB,CAAC,WAA8B;IACxD,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAA;IACzB,MAAM,GAAG,GAAG,IAAI,IAAI,CAClB,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAC5D,CAAA;IACD,MAAM,QAAQ,GAAG,IAAI,kBAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACzC,mFAAmF;IACnF,OAAO,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AAC/D,CAAC","sourcesContent":["import Duration from 'duration'\nimport { IColorFns } from '../get_color_fns'\nimport { ITestCaseAttempt } from './event_data_collector'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nconst STATUS_REPORT_ORDER = [\n messages.TestStepResultStatus.FAILED,\n messages.TestStepResultStatus.AMBIGUOUS,\n messages.TestStepResultStatus.UNDEFINED,\n messages.TestStepResultStatus.PENDING,\n messages.TestStepResultStatus.SKIPPED,\n messages.TestStepResultStatus.PASSED,\n]\n\nexport interface IFormatSummaryRequest {\n colorFns: IColorFns\n testCaseAttempts: ITestCaseAttempt[]\n testRunDuration: messages.Duration\n}\n\nexport function formatSummary({\n colorFns,\n testCaseAttempts,\n testRunDuration,\n}: IFormatSummaryRequest): string {\n const testCaseResults: messages.TestStepResult[] = []\n const testStepResults: messages.TestStepResult[] = []\n let totalStepDuration = messages.TimeConversion.millisecondsToDuration(0)\n testCaseAttempts.forEach(\n ({ testCase, willBeRetried, worstTestStepResult, stepResults }) => {\n Object.values(stepResults).forEach((stepResult) => {\n totalStepDuration = messages.TimeConversion.addDurations(\n totalStepDuration,\n stepResult.duration\n )\n })\n if (!willBeRetried) {\n testCaseResults.push(worstTestStepResult)\n testCase.testSteps.forEach((testStep) => {\n if (doesHaveValue(testStep.pickleStepId)) {\n testStepResults.push(stepResults[testStep.id])\n }\n })\n }\n }\n )\n const scenarioSummary = getCountSummary({\n colorFns,\n objects: testCaseResults,\n type: 'scenario',\n })\n const stepSummary = getCountSummary({\n colorFns,\n objects: testStepResults,\n type: 'step',\n })\n const durationSummary = `${getDurationSummary(\n testRunDuration\n )} (executing steps: ${getDurationSummary(totalStepDuration)})\\n`\n return [scenarioSummary, stepSummary, durationSummary].join('\\n')\n}\n\ninterface IGetCountSummaryRequest {\n colorFns: IColorFns\n objects: messages.TestStepResult[]\n type: string\n}\n\nfunction getCountSummary({\n colorFns,\n objects,\n type,\n}: IGetCountSummaryRequest): string {\n const counts: Record<string, number> = {}\n STATUS_REPORT_ORDER.forEach((x) => (counts[x] = 0))\n objects.forEach((x) => (counts[x.status] += 1))\n const total = Object.values(counts).reduce((acc, x) => acc + x, 0)\n let text = `${total.toString()} ${type}${total === 1 ? '' : 's'}`\n if (total > 0) {\n const details: string[] = []\n STATUS_REPORT_ORDER.forEach((status) => {\n if (counts[status] > 0) {\n details.push(\n colorFns.forStatus(status)(\n `${counts[status].toString()} ${status.toLowerCase()}`\n )\n )\n }\n })\n text += ` (${details.join(', ')})`\n }\n return text\n}\n\nfunction getDurationSummary(durationMsg: messages.Duration): string {\n const start = new Date(0)\n const end = new Date(\n messages.TimeConversion.durationToMilliseconds(durationMsg)\n )\n const duration = new Duration(start, end)\n // Use spaces in toString method for readability and to avoid %Ls which is a format\n return duration.toString('%Ms m %S . %L s').replace(/ /g, '')\n}\n"]}
|
|
@@ -44,7 +44,7 @@ function getStepMessage(testStep) {
|
|
|
44
44
|
case messages.TestStepResultStatus.FAILED:
|
|
45
45
|
return testStep.result.message;
|
|
46
46
|
case messages.TestStepResultStatus.UNDEFINED:
|
|
47
|
-
return `${'Undefined. Implement with the following snippet:' + '\n\n'}${indent_string_1.default(testStep.snippet, 2)}\n`;
|
|
47
|
+
return `${'Undefined. Implement with the following snippet:' + '\n\n'}${(0, indent_string_1.default)(testStep.snippet, 2)}\n`;
|
|
48
48
|
case messages.TestStepResultStatus.PENDING:
|
|
49
49
|
return 'Pending';
|
|
50
50
|
}
|
|
@@ -53,36 +53,36 @@ function getStepMessage(testStep) {
|
|
|
53
53
|
function formatStep({ colorFns, testStep }) {
|
|
54
54
|
const { result: { status }, actionLocation, attachments, } = testStep;
|
|
55
55
|
const colorFn = colorFns.forStatus(status);
|
|
56
|
-
const identifier = testStep.keyword + value_checker_1.valueOrDefault(testStep.text, '');
|
|
56
|
+
const identifier = testStep.keyword + (0, value_checker_1.valueOrDefault)(testStep.text, '');
|
|
57
57
|
let text = colorFn(`${CHARACTERS.get(status)} ${identifier}`);
|
|
58
|
-
if (value_checker_1.doesHaveValue(actionLocation)) {
|
|
59
|
-
text += ` # ${colorFns.location(location_helpers_1.formatLocation(actionLocation))}`;
|
|
58
|
+
if ((0, value_checker_1.doesHaveValue)(actionLocation)) {
|
|
59
|
+
text += ` # ${colorFns.location((0, location_helpers_1.formatLocation)(actionLocation))}`;
|
|
60
60
|
}
|
|
61
61
|
text += '\n';
|
|
62
|
-
if (value_checker_1.doesHaveValue(testStep.argument)) {
|
|
63
|
-
const argumentsText = step_argument_formatter_1.formatStepArgument(testStep.argument);
|
|
64
|
-
text += indent_string_1.default(`${colorFn(argumentsText)}\n`, 4);
|
|
62
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.argument)) {
|
|
63
|
+
const argumentsText = (0, step_argument_formatter_1.formatStepArgument)(testStep.argument);
|
|
64
|
+
text += (0, indent_string_1.default)(`${colorFn(argumentsText)}\n`, 4);
|
|
65
65
|
}
|
|
66
66
|
attachments.forEach(({ body, mediaType }) => {
|
|
67
67
|
const message = mediaType === 'text/plain' ? `: ${body}` : '';
|
|
68
|
-
text += indent_string_1.default(`Attachment (${mediaType})${message}\n`, 4);
|
|
68
|
+
text += (0, indent_string_1.default)(`Attachment (${mediaType})${message}\n`, 4);
|
|
69
69
|
});
|
|
70
70
|
const message = getStepMessage(testStep);
|
|
71
71
|
if (message !== '') {
|
|
72
|
-
text += `${indent_string_1.default(colorFn(message), 4)}\n`;
|
|
72
|
+
text += `${(0, indent_string_1.default)(colorFn(message), 4)}\n`;
|
|
73
73
|
}
|
|
74
74
|
return text;
|
|
75
75
|
}
|
|
76
76
|
function formatTestCaseAttempt({ colorFns, cwd, snippetBuilder, supportCodeLibrary, testCaseAttempt, }) {
|
|
77
|
-
const parsed = test_case_attempt_parser_1.parseTestCaseAttempt({
|
|
77
|
+
const parsed = (0, test_case_attempt_parser_1.parseTestCaseAttempt)({
|
|
78
78
|
cwd,
|
|
79
79
|
snippetBuilder,
|
|
80
80
|
testCaseAttempt,
|
|
81
81
|
supportCodeLibrary,
|
|
82
82
|
});
|
|
83
83
|
let text = `Scenario: ${parsed.testCase.name}`;
|
|
84
|
-
text += getAttemptText(parsed.testCase.attempt,
|
|
85
|
-
text += ` # ${colorFns.location(location_helpers_1.formatLocation(parsed.testCase.sourceLocation))}\n`;
|
|
84
|
+
text += getAttemptText(parsed.testCase.attempt, testCaseAttempt.willBeRetried);
|
|
85
|
+
text += ` # ${colorFns.location((0, location_helpers_1.formatLocation)(parsed.testCase.sourceLocation))}\n`;
|
|
86
86
|
parsed.testSteps.forEach((testStep) => {
|
|
87
87
|
text += formatStep({ colorFns, testStep });
|
|
88
88
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_case_attempt_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAwC;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H,cAAc;QACd,eAAe;QACf,kBAAkB;KACnB,CAAC,CAAA;IACF,IAAI,IAAI,GAAG,aAAa,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;IAC9C,IAAI,IAAI,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,aAAa,CAAC,CAAA;IAC9E,IAAI,IAAI,MAAM,QAAQ,CAAC,QAAQ,CAC7B,IAAA,iCAAc,EAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAC/C,IAAI,CAAA;IACL,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACpC,IAAI,IAAI,UAAU,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,IAAI,IAAI,CAAA;AACpB,CAAC;AAtBD,sDAsBC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,aAAsB;IAC7D,IAAI,OAAO,GAAG,CAAC,IAAI,aAAa,EAAE;QAChC,MAAM,SAAS,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;QAC1C,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;QACnD,OAAO,aAAa,SAAS,GAAG,UAAU,GAAG,CAAA;KAC9C;IACD,OAAO,EAAE,CAAA;AACX,CAAC","sourcesContent":["import indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport figures from 'figures'\nimport { formatLocation } from './location_helpers'\nimport {\n IParsedTestStep,\n parseTestCaseAttempt,\n} from './test_case_attempt_parser'\nimport { formatStepArgument } from './step_argument_formatter'\nimport { IColorFns } from '../get_color_fns'\nimport { doesHaveValue, valueOrDefault } from '../../value_checker'\nimport { ITestCaseAttempt } from './event_data_collector'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\n\nconst CHARACTERS: Map<messages.TestStepResultStatus, string> = new Map([\n [messages.TestStepResultStatus.AMBIGUOUS, figures.cross],\n [messages.TestStepResultStatus.FAILED, figures.cross],\n [messages.TestStepResultStatus.PASSED, figures.tick],\n [messages.TestStepResultStatus.PENDING, '?'],\n [messages.TestStepResultStatus.SKIPPED, '-'],\n [messages.TestStepResultStatus.UNDEFINED, '?'],\n])\n\nfunction getStepMessage(testStep: IParsedTestStep): string {\n switch (testStep.result.status) {\n case messages.TestStepResultStatus.AMBIGUOUS:\n case messages.TestStepResultStatus.FAILED:\n return testStep.result.message\n case messages.TestStepResultStatus.UNDEFINED:\n return `${\n 'Undefined. Implement with the following snippet:' + '\\n\\n'\n }${indentString(testStep.snippet, 2)}\\n`\n case messages.TestStepResultStatus.PENDING:\n return 'Pending'\n }\n return ''\n}\n\ninterface IFormatStepRequest {\n colorFns: IColorFns\n testStep: IParsedTestStep\n}\n\nfunction formatStep({ colorFns, testStep }: IFormatStepRequest): string {\n const {\n result: { status },\n actionLocation,\n attachments,\n } = testStep\n const colorFn = colorFns.forStatus(status)\n const identifier = testStep.keyword + valueOrDefault(testStep.text, '')\n let text = colorFn(`${CHARACTERS.get(status)} ${identifier}`)\n if (doesHaveValue(actionLocation)) {\n text += ` # ${colorFns.location(formatLocation(actionLocation))}`\n }\n text += '\\n'\n if (doesHaveValue(testStep.argument)) {\n const argumentsText = formatStepArgument(testStep.argument)\n text += indentString(`${colorFn(argumentsText)}\\n`, 4)\n }\n attachments.forEach(({ body, mediaType }) => {\n const message = mediaType === 'text/plain' ? `: ${body}` : ''\n text += indentString(`Attachment (${mediaType})${message}\\n`, 4)\n })\n const message = getStepMessage(testStep)\n if (message !== '') {\n text += `${indentString(colorFn(message), 4)}\\n`\n }\n return text\n}\n\nexport interface IFormatTestCaseAttemptRequest {\n colorFns: IColorFns\n cwd: string\n testCaseAttempt: ITestCaseAttempt\n snippetBuilder: StepDefinitionSnippetBuilder\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport function formatTestCaseAttempt({\n colorFns,\n cwd,\n snippetBuilder,\n supportCodeLibrary,\n testCaseAttempt,\n}: IFormatTestCaseAttemptRequest): string {\n const parsed = parseTestCaseAttempt({\n cwd,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n })\n let text = `Scenario: ${parsed.testCase.name}`\n text += getAttemptText(parsed.testCase.attempt, testCaseAttempt.willBeRetried)\n text += ` # ${colorFns.location(\n formatLocation(parsed.testCase.sourceLocation)\n )}\\n`\n parsed.testSteps.forEach((testStep) => {\n text += formatStep({ colorFns, testStep })\n })\n return `${text}\\n`\n}\n\nfunction getAttemptText(attempt: number, willBeRetried: boolean): string {\n if (attempt > 0 || willBeRetried) {\n const numberStr = (attempt + 1).toString()\n const retriedStr = willBeRetried ? ', retried' : ''\n return ` (attempt ${numberStr}${retriedStr})`\n }\n return ''\n}\n"]}
|