@cucumber/cucumber 8.0.0-rc.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -51
- package/api/index.d.ts +6 -0
- package/lib/api/convert_configuration.d.ts +4 -0
- package/lib/api/convert_configuration.js +65 -0
- package/lib/api/convert_configuration.js.map +1 -0
- package/lib/api/environment.d.ts +2 -0
- package/lib/api/environment.js +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 +28 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/load_configuration.d.ts +9 -0
- package/lib/api/load_configuration.js +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 -10
- package/lib/cli/helpers.js +54 -38
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +1 -1
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +6 -23
- package/lib/cli/index.js +38 -195
- 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 +10 -0
- package/lib/cli/validate_node_engine_version.js +24 -0
- package/lib/cli/validate_node_engine_version.js.map +1 -0
- package/lib/configuration/argv_parser.d.ts +20 -0
- package/lib/{cli → configuration}/argv_parser.js +47 -44
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/check_schema.d.ts +2 -0
- package/lib/configuration/check_schema.js +60 -0
- package/lib/configuration/check_schema.js.map +1 -0
- package/lib/configuration/default_configuration.d.ts +2 -0
- package/lib/configuration/default_configuration.js +27 -0
- package/lib/configuration/default_configuration.js.map +1 -0
- package/lib/configuration/from_file.d.ts +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 +29 -0
- package/lib/configuration/index.js.map +1 -0
- package/lib/configuration/locate_file.d.ts +1 -0
- package/lib/configuration/locate_file.js +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 +4 -3
- 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 +3 -3
- package/lib/formatter/builder.js +34 -8
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/fixtures/typescript.d.ts +2 -0
- package/lib/formatter/fixtures/typescript.js +6 -0
- package/lib/formatter/fixtures/typescript.js.map +1 -0
- package/lib/formatter/get_color_fns.js +15 -16
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.js +15 -11
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/gherkin_document_parser.js +6 -6
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/index.js +5 -1
- package/lib/formatter/helpers/index.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
- package/lib/formatter/helpers/issue_helpers.js +4 -4
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +1 -1
- 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 +1 -1
- 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 +6 -2
- 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 +24 -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 +19 -15
- 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 +13 -9
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/html_formatter.js +4 -4
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/http_stream.js +6 -6
- package/lib/formatter/http_stream.js.map +1 -1
- package/lib/formatter/index.d.ts +14 -2
- package/lib/formatter/index.js +2 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.js +18 -14
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.js +16 -16
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.js +7 -3
- 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.js +10 -6
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +7 -4
- 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/summary_formatter.js +9 -9
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.js +11 -8
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.js +2 -3
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.js +13 -2
- package/lib/index.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 +3 -3
- package/lib/models/step_definition.js.map +1 -1
- package/lib/pickle_filter.js +8 -8
- package/lib/pickle_filter.js.map +1 -1
- package/lib/runtime/assemble_test_cases.js +1 -1
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/attachment_manager/index.js +9 -5
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/helpers.js +11 -4
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +7 -5
- package/lib/runtime/index.js +8 -27
- 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 -11
- package/lib/runtime/parallel/coordinator.js +80 -28
- 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 +14 -37
- 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 +9 -5
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js +9 -5
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.js +11 -7
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/stack_trace_filter.js +2 -2
- 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 -19
- 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 +9 -0
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/time.js +5 -1
- package/lib/time.js.map +1 -1
- package/lib/user_code_runner.js +4 -4
- package/lib/user_code_runner.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 +5 -1
- package/package.json +72 -49
- package/lib/cli/argv_parser.d.ts +0 -50
- package/lib/cli/argv_parser.js.map +0 -1
- package/lib/cli/configuration_builder.d.ts +0 -45
- package/lib/cli/configuration_builder.js +0 -159
- 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 -7
- package/lib/cli/profile_loader.js +0 -49
- package/lib/cli/profile_loader.js.map +0 -1
- package/lib/support_code_library_builder/build_helpers.js +0 -45
- package/lib/support_code_library_builder/build_helpers.js.map +0 -1
|
@@ -8,12 +8,12 @@ export declare function isWarning(result: messages.TestStepResult, willBeRetried
|
|
|
8
8
|
export declare function isIssue(result: messages.TestStepResult): boolean;
|
|
9
9
|
export interface IFormatIssueRequest {
|
|
10
10
|
colorFns: IColorFns;
|
|
11
|
-
cwd: string;
|
|
12
11
|
number: number;
|
|
13
12
|
snippetBuilder: StepDefinitionSnippetBuilder;
|
|
14
13
|
testCaseAttempt: ITestCaseAttempt;
|
|
15
14
|
supportCodeLibrary: ISupportCodeLibrary;
|
|
15
|
+
printAttachments?: boolean;
|
|
16
16
|
}
|
|
17
|
-
export declare function formatIssue({ colorFns,
|
|
17
|
+
export declare function formatIssue({ colorFns, number, snippetBuilder, testCaseAttempt, supportCodeLibrary, printAttachments, }: IFormatIssueRequest): string;
|
|
18
18
|
export declare function formatUndefinedParameterTypes(undefinedParameterTypes: messages.UndefinedParameterType[]): string;
|
|
19
19
|
export declare function formatUndefinedParameterType(parameterType: messages.UndefinedParameterType): string;
|
|
@@ -20,21 +20,21 @@ function isIssue(result) {
|
|
|
20
20
|
return isFailure(result) || isWarning(result);
|
|
21
21
|
}
|
|
22
22
|
exports.isIssue = isIssue;
|
|
23
|
-
function formatIssue({ colorFns,
|
|
23
|
+
function formatIssue({ colorFns, number, snippetBuilder, testCaseAttempt, supportCodeLibrary, printAttachments = true, }) {
|
|
24
24
|
const prefix = `${number.toString()}) `;
|
|
25
|
-
const formattedTestCaseAttempt = test_case_attempt_formatter_1.formatTestCaseAttempt({
|
|
25
|
+
const formattedTestCaseAttempt = (0, test_case_attempt_formatter_1.formatTestCaseAttempt)({
|
|
26
26
|
colorFns,
|
|
27
|
-
cwd,
|
|
28
27
|
snippetBuilder,
|
|
29
28
|
testCaseAttempt,
|
|
30
29
|
supportCodeLibrary,
|
|
30
|
+
printAttachments,
|
|
31
31
|
});
|
|
32
32
|
const lines = formattedTestCaseAttempt.split('\n');
|
|
33
33
|
const updatedLines = lines.map((line, index) => {
|
|
34
34
|
if (index === 0) {
|
|
35
35
|
return `${prefix}${line}`;
|
|
36
36
|
}
|
|
37
|
-
return indent_string_1.default(line, prefix.length);
|
|
37
|
+
return (0, indent_string_1.default)(line, prefix.length);
|
|
38
38
|
});
|
|
39
39
|
return updatedLines.join('\n');
|
|
40
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,CACvB,MAA+B,EAC/B,gBAAyB,KAAK;IAE9B,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,MAA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,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 number: number\n snippetBuilder: StepDefinitionSnippetBuilder\n testCaseAttempt: ITestCaseAttempt\n supportCodeLibrary: ISupportCodeLibrary\n printAttachments?: boolean\n}\n\nexport function formatIssue({\n colorFns,\n number,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n printAttachments = true,\n}: IFormatIssueRequest): string {\n const prefix = `${number.toString()}) `\n const formattedTestCaseAttempt = formatTestCaseAttempt({\n colorFns,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n printAttachments,\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"]}
|
|
@@ -20,7 +20,7 @@ function getStepKeywordType({ keyword, language, previousKeywordType, }) {
|
|
|
20
20
|
return KeywordType.Outcome;
|
|
21
21
|
case 'and':
|
|
22
22
|
case 'but':
|
|
23
|
-
if (value_checker_1.doesHaveValue(previousKeywordType)) {
|
|
23
|
+
if ((0, value_checker_1.doesHaveValue)(previousKeywordType)) {
|
|
24
24
|
return previousKeywordType;
|
|
25
25
|
}
|
|
26
26
|
// fallthrough
|
|
@@ -1 +1 @@
|
|
|
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,IA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AO,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"]}
|
|
@@ -21,7 +21,7 @@ function getPickleStepMap(pickle) {
|
|
|
21
21
|
}
|
|
22
22
|
exports.getPickleStepMap = getPickleStepMap;
|
|
23
23
|
function getPickleLocation({ gherkinDocument, pickle, }) {
|
|
24
|
-
const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
|
|
24
|
+
const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
|
|
25
25
|
return gherkinScenarioLocationMap[pickle.astNodeIds[pickle.astNodeIds.length - 1]];
|
|
26
26
|
}
|
|
27
27
|
exports.getPickleLocation = getPickleLocation;
|
|
@@ -1 +1 @@
|
|
|
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,C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AW,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"],"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,IAAA,kCAAiB,EAAC,GAAG,EAAE;QAC5B,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,eAAe;KAC3B,CAAC,CAAA;AACJ,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"]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -45,7 +49,7 @@ function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }) {
|
|
|
45
49
|
if (!willBeRetried) {
|
|
46
50
|
testCaseResults.push(worstTestStepResult);
|
|
47
51
|
testCase.testSteps.forEach((testStep) => {
|
|
48
|
-
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
|
|
52
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
|
|
49
53
|
testStepResults.push(stepResults[testStep.id]);
|
|
50
54
|
}
|
|
51
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"summary_helpers.js","source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AE;QACb,MAAM,OAAO,GAAa,EAAE,CAAA;QAC5B,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACrC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;gBACtB,OAAO,CAAC,IAAI,CACV,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"]}
|
|
@@ -4,9 +4,9 @@ import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
|
|
|
4
4
|
import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
|
|
5
5
|
export interface IFormatTestCaseAttemptRequest {
|
|
6
6
|
colorFns: IColorFns;
|
|
7
|
-
cwd: string;
|
|
8
7
|
testCaseAttempt: ITestCaseAttempt;
|
|
9
8
|
snippetBuilder: StepDefinitionSnippetBuilder;
|
|
10
9
|
supportCodeLibrary: ISupportCodeLibrary;
|
|
10
|
+
printAttachments?: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare function formatTestCaseAttempt({ colorFns,
|
|
12
|
+
export declare function formatTestCaseAttempt({ colorFns, snippetBuilder, supportCodeLibrary, testCaseAttempt, printAttachments, }: IFormatTestCaseAttemptRequest): string;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -44,47 +48,48 @@ function getStepMessage(testStep) {
|
|
|
44
48
|
case messages.TestStepResultStatus.FAILED:
|
|
45
49
|
return testStep.result.message;
|
|
46
50
|
case messages.TestStepResultStatus.UNDEFINED:
|
|
47
|
-
return `${'Undefined. Implement with the following snippet:' + '\n\n'}${indent_string_1.default(testStep.snippet, 2)}\n`;
|
|
51
|
+
return `${'Undefined. Implement with the following snippet:' + '\n\n'}${(0, indent_string_1.default)(testStep.snippet, 2)}\n`;
|
|
48
52
|
case messages.TestStepResultStatus.PENDING:
|
|
49
53
|
return 'Pending';
|
|
50
54
|
}
|
|
51
55
|
return '';
|
|
52
56
|
}
|
|
53
|
-
function formatStep({ colorFns, testStep }) {
|
|
57
|
+
function formatStep({ colorFns, testStep, printAttachments, }) {
|
|
54
58
|
const { result: { status }, actionLocation, attachments, } = testStep;
|
|
55
59
|
const colorFn = colorFns.forStatus(status);
|
|
56
|
-
const identifier = testStep.keyword + value_checker_1.valueOrDefault(testStep.text, '');
|
|
60
|
+
const identifier = testStep.keyword + (0, value_checker_1.valueOrDefault)(testStep.text, '');
|
|
57
61
|
let text = colorFn(`${CHARACTERS.get(status)} ${identifier}`);
|
|
58
|
-
if (value_checker_1.doesHaveValue(actionLocation)) {
|
|
59
|
-
text += ` # ${colorFns.location(location_helpers_1.formatLocation(actionLocation))}`;
|
|
62
|
+
if ((0, value_checker_1.doesHaveValue)(actionLocation)) {
|
|
63
|
+
text += ` # ${colorFns.location((0, location_helpers_1.formatLocation)(actionLocation))}`;
|
|
60
64
|
}
|
|
61
65
|
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);
|
|
66
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.argument)) {
|
|
67
|
+
const argumentsText = (0, step_argument_formatter_1.formatStepArgument)(testStep.argument);
|
|
68
|
+
text += (0, indent_string_1.default)(`${colorFn(argumentsText)}\n`, 4);
|
|
69
|
+
}
|
|
70
|
+
if ((0, value_checker_1.valueOrDefault)(printAttachments, true)) {
|
|
71
|
+
attachments.forEach(({ body, mediaType }) => {
|
|
72
|
+
const message = mediaType === 'text/plain' ? `: ${body}` : '';
|
|
73
|
+
text += (0, indent_string_1.default)(`Attachment (${mediaType})${message}\n`, 4);
|
|
74
|
+
});
|
|
65
75
|
}
|
|
66
|
-
attachments.forEach(({ body, mediaType }) => {
|
|
67
|
-
const message = mediaType === 'text/plain' ? `: ${body}` : '';
|
|
68
|
-
text += indent_string_1.default(`Attachment (${mediaType})${message}\n`, 4);
|
|
69
|
-
});
|
|
70
76
|
const message = getStepMessage(testStep);
|
|
71
77
|
if (message !== '') {
|
|
72
|
-
text += `${indent_string_1.default(colorFn(message), 4)}\n`;
|
|
78
|
+
text += `${(0, indent_string_1.default)(colorFn(message), 4)}\n`;
|
|
73
79
|
}
|
|
74
80
|
return text;
|
|
75
81
|
}
|
|
76
|
-
function formatTestCaseAttempt({ colorFns,
|
|
77
|
-
const parsed = test_case_attempt_parser_1.parseTestCaseAttempt({
|
|
78
|
-
cwd,
|
|
82
|
+
function formatTestCaseAttempt({ colorFns, snippetBuilder, supportCodeLibrary, testCaseAttempt, printAttachments, }) {
|
|
83
|
+
const parsed = (0, test_case_attempt_parser_1.parseTestCaseAttempt)({
|
|
79
84
|
snippetBuilder,
|
|
80
85
|
testCaseAttempt,
|
|
81
86
|
supportCodeLibrary,
|
|
82
87
|
});
|
|
83
88
|
let text = `Scenario: ${parsed.testCase.name}`;
|
|
84
89
|
text += getAttemptText(parsed.testCase.attempt, testCaseAttempt.willBeRetried);
|
|
85
|
-
text += ` # ${colorFns.location(location_helpers_1.formatLocation(parsed.testCase.sourceLocation))}\n`;
|
|
90
|
+
text += ` # ${colorFns.location((0, location_helpers_1.formatLocation)(parsed.testCase.sourceLocation))}\n`;
|
|
86
91
|
parsed.testSteps.forEach((testStep) => {
|
|
87
|
-
text += formatStep({ colorFns, testStep });
|
|
92
|
+
text += formatStep({ colorFns, testStep, printAttachments });
|
|
88
93
|
});
|
|
89
94
|
return `${text}\n`;
|
|
90
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_case_attempt_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_formatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test_case_attempt_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAwC;AACxC,6DAA8C;AAC9C,sDAA6B;AAC7B,yDAAmD;AACnD,yEAGmC;AACnC,uEAA8D;AAE9D,uDAAmE;AAKnE,MAAM,UAAU,GAA+C,IAAI,GAAG,CAAC;IACrE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,iBAAO,CAAC,KAAK,CAAC;IACxD,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,iBAAO,CAAC,KAAK,CAAC;IACrD,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,iBAAO,CAAC,IAAI,CAAC;IACpD,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC;IAC5C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC;IAC5C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,GAAG,CAAC;CAC/C,CAAC,CAAA;AAEF,SAAS,cAAc,CAAC,QAAyB;IAC/C,QAAQ,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAC9B,KAAK,QAAQ,CAAC,oBAAoB,CAAC,SAAS,CAAC;QAC7C,KAAK,QAAQ,CAAC,oBAAoB,CAAC,MAAM;YACvC,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAA;QAChC,KAAK,QAAQ,CAAC,oBAAoB,CAAC,SAAS;YAC1C,OAAO,GACL,kDAAkD,GAAG,MACvD,GAAG,IAAA,uBAAY,EAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI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,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 printAttachments?: boolean\n}\n\nfunction formatStep({\n colorFns,\n testStep,\n printAttachments,\n}: 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 if (valueOrDefault(printAttachments, true)) {\n attachments.forEach(({ body, mediaType }) => {\n const message = mediaType === 'text/plain' ? `: ${body}` : ''\n text += indentString(`Attachment (${mediaType})${message}\\n`, 4)\n })\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 testCaseAttempt: ITestCaseAttempt\n snippetBuilder: StepDefinitionSnippetBuilder\n supportCodeLibrary: ISupportCodeLibrary\n printAttachments?: boolean\n}\n\nexport function formatTestCaseAttempt({\n colorFns,\n snippetBuilder,\n supportCodeLibrary,\n testCaseAttempt,\n printAttachments,\n}: IFormatTestCaseAttemptRequest): string {\n const parsed = parseTestCaseAttempt({\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, printAttachments })\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"]}
|
|
@@ -24,9 +24,8 @@ export interface IParsedTestCaseAttempt {
|
|
|
24
24
|
testSteps: IParsedTestStep[];
|
|
25
25
|
}
|
|
26
26
|
export interface IParseTestCaseAttemptRequest {
|
|
27
|
-
cwd: string;
|
|
28
27
|
testCaseAttempt: ITestCaseAttempt;
|
|
29
28
|
snippetBuilder: StepDefinitionSnippetBuilder;
|
|
30
29
|
supportCodeLibrary: ISupportCodeLibrary;
|
|
31
30
|
}
|
|
32
|
-
export declare function parseTestCaseAttempt({
|
|
31
|
+
export declare function parseTestCaseAttempt({ testCaseAttempt, snippetBuilder, supportCodeLibrary, }: IParseTestCaseAttemptRequest): IParsedTestCaseAttempt;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -29,14 +33,14 @@ const messages_1 = require("@cucumber/messages");
|
|
|
29
33
|
function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleStep, pickleUri, snippetBuilder, supportCodeLibrary, testStep, testStepResult, testStepAttachments, }) {
|
|
30
34
|
const out = {
|
|
31
35
|
attachments: testStepAttachments,
|
|
32
|
-
keyword: value_checker_1.doesHaveValue(testStep.pickleStepId)
|
|
36
|
+
keyword: (0, value_checker_1.doesHaveValue)(testStep.pickleStepId)
|
|
33
37
|
? keyword
|
|
34
38
|
: isBeforeHook
|
|
35
39
|
? 'Before'
|
|
36
40
|
: 'After',
|
|
37
41
|
result: testStepResult,
|
|
38
42
|
};
|
|
39
|
-
if (value_checker_1.doesHaveValue(testStep.hookId)) {
|
|
43
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.hookId)) {
|
|
40
44
|
let hookDefinition;
|
|
41
45
|
if (isBeforeHook) {
|
|
42
46
|
hookDefinition = supportCodeLibrary.beforeTestCaseHookDefinitions.find((x) => x.id === testStep.hookId);
|
|
@@ -49,7 +53,7 @@ function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleS
|
|
|
49
53
|
line: hookDefinition.line,
|
|
50
54
|
};
|
|
51
55
|
}
|
|
52
|
-
if (value_checker_1.doesHaveValue(testStep.stepDefinitionIds) &&
|
|
56
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.stepDefinitionIds) &&
|
|
53
57
|
testStep.stepDefinitionIds.length === 1) {
|
|
54
58
|
const stepDefinition = supportCodeLibrary.stepDefinitions.find((x) => x.id === testStep.stepDefinitionIds[0]);
|
|
55
59
|
out.actionLocation = {
|
|
@@ -57,13 +61,13 @@ function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleS
|
|
|
57
61
|
line: stepDefinition.line,
|
|
58
62
|
};
|
|
59
63
|
}
|
|
60
|
-
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
|
|
64
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
|
|
61
65
|
out.sourceLocation = {
|
|
62
66
|
uri: pickleUri,
|
|
63
67
|
line: gherkinStepMap[pickleStep.astNodeIds[0]].location.line,
|
|
64
68
|
};
|
|
65
69
|
out.text = pickleStep.text;
|
|
66
|
-
if (value_checker_1.doesHaveValue(pickleStep.argument)) {
|
|
70
|
+
if ((0, value_checker_1.doesHaveValue)(pickleStep.argument)) {
|
|
67
71
|
out.argument = pickleStep.argument;
|
|
68
72
|
}
|
|
69
73
|
}
|
|
@@ -74,11 +78,11 @@ function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleS
|
|
|
74
78
|
}
|
|
75
79
|
// Converts a testCaseAttempt into a json object with all data needed for
|
|
76
80
|
// displaying it in a pretty format
|
|
77
|
-
function parseTestCaseAttempt({
|
|
81
|
+
function parseTestCaseAttempt({ testCaseAttempt, snippetBuilder, supportCodeLibrary, }) {
|
|
78
82
|
const { testCase, pickle, gherkinDocument } = testCaseAttempt;
|
|
79
|
-
const gherkinStepMap = gherkin_document_parser_1.getGherkinStepMap(gherkinDocument);
|
|
80
|
-
const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
|
|
81
|
-
const pickleStepMap = pickle_parser_1.getPickleStepMap(pickle);
|
|
83
|
+
const gherkinStepMap = (0, gherkin_document_parser_1.getGherkinStepMap)(gherkinDocument);
|
|
84
|
+
const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
|
|
85
|
+
const pickleStepMap = (0, pickle_parser_1.getPickleStepMap)(pickle);
|
|
82
86
|
const relativePickleUri = pickle.uri;
|
|
83
87
|
const parsedTestCase = {
|
|
84
88
|
attempt: testCaseAttempt.attempt,
|
|
@@ -94,12 +98,12 @@ function parseTestCaseAttempt({ cwd, testCaseAttempt, snippetBuilder, supportCod
|
|
|
94
98
|
let previousKeywordType = keyword_type_1.KeywordType.Precondition;
|
|
95
99
|
testCase.testSteps.forEach((testStep) => {
|
|
96
100
|
const testStepResult = testCaseAttempt.stepResults[testStep.id] || new messages_1.TestStepResult();
|
|
97
|
-
isBeforeHook = isBeforeHook && value_checker_1.doesHaveValue(testStep.hookId);
|
|
101
|
+
isBeforeHook = isBeforeHook && (0, value_checker_1.doesHaveValue)(testStep.hookId);
|
|
98
102
|
let keyword, keywordType, pickleStep;
|
|
99
|
-
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
|
|
103
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
|
|
100
104
|
pickleStep = pickleStepMap[testStep.pickleStepId];
|
|
101
|
-
keyword = pickle_parser_1.getStepKeyword({ pickleStep, gherkinStepMap });
|
|
102
|
-
keywordType = keyword_type_1.getStepKeywordType({
|
|
105
|
+
keyword = (0, pickle_parser_1.getStepKeyword)({ pickleStep, gherkinStepMap });
|
|
106
|
+
keywordType = (0, keyword_type_1.getStepKeywordType)({
|
|
103
107
|
keyword,
|
|
104
108
|
language: gherkinDocument.feature.language,
|
|
105
109
|
previousKeywordType,
|
|
@@ -116,7 +120,7 @@ function parseTestCaseAttempt({ cwd, testCaseAttempt, snippetBuilder, supportCod
|
|
|
116
120
|
supportCodeLibrary,
|
|
117
121
|
testStep,
|
|
118
122
|
testStepResult,
|
|
119
|
-
testStepAttachments: value_checker_1.valueOrDefault(testCaseAttempt.stepAttachments[testStep.id], []),
|
|
123
|
+
testStepAttachments: (0, value_checker_1.valueOrDefault)(testCaseAttempt.stepAttachments[testStep.id], []),
|
|
120
124
|
});
|
|
121
125
|
parsedTestSteps.push(parsedStep);
|
|
122
126
|
previousKeywordType = keywordType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_case_attempt_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test_case_attempt_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_parser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAgE;AAChE,uEAGkC;AAClC,mDAAkE;AAClE,6DAA8C;AAI9C,uDAAmE;AAGnE,iDAAmD;AAuCnD,SAAS,SAAS,CAAC,EACjB,YAAY,EACZ,cAAc,EACd,OAAO,EACP,WAAW,EACX,UAAU,EACV,SAAS,EACT,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,mBAAmB,GACD;IAClB,MAAM,GAAG,GAAoB;QAC3B,WAAW,EAAE,mBAAmB;QAChC,OAAO,EAAE,IAAA,6BAAa,EAAC,QAAQ,CAAC,YAAY,CAAC;YAC3C,CAA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getStepKeywordType, KeywordType } from './keyword_type'\nimport {\n getGherkinScenarioLocationMap,\n getGherkinStepMap,\n} from './gherkin_document_parser'\nimport { getPickleStepMap, getStepKeyword } from './pickle_parser'\nimport * as messages from '@cucumber/messages'\nimport { ITestCaseAttempt } from './event_data_collector'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { doesHaveValue, valueOrDefault } from '../../value_checker'\nimport TestCaseHookDefinition from '../../models/test_case_hook_definition'\nimport { ILineAndUri } from '../../types'\nimport { TestStepResult } from '@cucumber/messages'\n\nexport interface IParsedTestStep {\n actionLocation?: ILineAndUri\n argument?: messages.PickleStepArgument\n attachments: messages.Attachment[]\n keyword: string\n result: messages.TestStepResult\n snippet?: string\n sourceLocation?: ILineAndUri\n text?: string\n}\n\nexport interface IParsedTestCase {\n attempt: number\n name: string\n sourceLocation?: ILineAndUri\n worstTestStepResult: messages.TestStepResult\n}\n\nexport interface IParsedTestCaseAttempt {\n testCase: IParsedTestCase\n testSteps: IParsedTestStep[]\n}\n\ninterface IParseStepRequest {\n isBeforeHook: boolean\n gherkinStepMap: Record<string, messages.Step>\n keyword: string\n keywordType: KeywordType\n pickleStep: messages.PickleStep\n pickleUri: string\n snippetBuilder: StepDefinitionSnippetBuilder\n supportCodeLibrary: ISupportCodeLibrary\n testStep: messages.TestStep\n testStepResult: messages.TestStepResult\n testStepAttachments: messages.Attachment[]\n}\n\nfunction parseStep({\n isBeforeHook,\n gherkinStepMap,\n keyword,\n keywordType,\n pickleStep,\n pickleUri,\n snippetBuilder,\n supportCodeLibrary,\n testStep,\n testStepResult,\n testStepAttachments,\n}: IParseStepRequest): IParsedTestStep {\n const out: IParsedTestStep = {\n attachments: testStepAttachments,\n keyword: doesHaveValue(testStep.pickleStepId)\n ? keyword\n : isBeforeHook\n ? 'Before'\n : 'After',\n result: testStepResult,\n }\n if (doesHaveValue(testStep.hookId)) {\n let hookDefinition: TestCaseHookDefinition\n if (isBeforeHook) {\n hookDefinition = supportCodeLibrary.beforeTestCaseHookDefinitions.find(\n (x) => x.id === testStep.hookId\n )\n } else {\n hookDefinition = supportCodeLibrary.afterTestCaseHookDefinitions.find(\n (x) => x.id === testStep.hookId\n )\n }\n out.actionLocation = {\n uri: hookDefinition.uri,\n line: hookDefinition.line,\n }\n }\n if (\n doesHaveValue(testStep.stepDefinitionIds) &&\n testStep.stepDefinitionIds.length === 1\n ) {\n const stepDefinition = supportCodeLibrary.stepDefinitions.find(\n (x) => x.id === testStep.stepDefinitionIds[0]\n )\n out.actionLocation = {\n uri: stepDefinition.uri,\n line: stepDefinition.line,\n }\n }\n if (doesHaveValue(testStep.pickleStepId)) {\n out.sourceLocation = {\n uri: pickleUri,\n line: gherkinStepMap[pickleStep.astNodeIds[0]].location.line,\n }\n out.text = pickleStep.text\n if (doesHaveValue(pickleStep.argument)) {\n out.argument = pickleStep.argument\n }\n }\n if (testStepResult.status === messages.TestStepResultStatus.UNDEFINED) {\n out.snippet = snippetBuilder.build({ keywordType, pickleStep })\n }\n return out\n}\n\nexport interface IParseTestCaseAttemptRequest {\n testCaseAttempt: ITestCaseAttempt\n snippetBuilder: StepDefinitionSnippetBuilder\n supportCodeLibrary: ISupportCodeLibrary\n}\n\n// Converts a testCaseAttempt into a json object with all data needed for\n// displaying it in a pretty format\nexport function parseTestCaseAttempt({\n testCaseAttempt,\n snippetBuilder,\n supportCodeLibrary,\n}: IParseTestCaseAttemptRequest): IParsedTestCaseAttempt {\n const { testCase, pickle, gherkinDocument } = testCaseAttempt\n const gherkinStepMap = getGherkinStepMap(gherkinDocument)\n const gherkinScenarioLocationMap =\n getGherkinScenarioLocationMap(gherkinDocument)\n const pickleStepMap = getPickleStepMap(pickle)\n const relativePickleUri = pickle.uri\n const parsedTestCase: IParsedTestCase = {\n attempt: testCaseAttempt.attempt,\n name: pickle.name,\n sourceLocation: {\n uri: relativePickleUri,\n line: gherkinScenarioLocationMap[\n pickle.astNodeIds[pickle.astNodeIds.length - 1]\n ].line,\n },\n worstTestStepResult: testCaseAttempt.worstTestStepResult,\n }\n const parsedTestSteps: IParsedTestStep[] = []\n let isBeforeHook = true\n let previousKeywordType = KeywordType.Precondition\n\n testCase.testSteps.forEach((testStep) => {\n const testStepResult =\n testCaseAttempt.stepResults[testStep.id] || new TestStepResult()\n\n isBeforeHook = isBeforeHook && doesHaveValue(testStep.hookId)\n\n let keyword, keywordType, pickleStep\n if (doesHaveValue(testStep.pickleStepId)) {\n pickleStep = pickleStepMap[testStep.pickleStepId]\n keyword = getStepKeyword({ pickleStep, gherkinStepMap })\n keywordType = getStepKeywordType({\n keyword,\n language: gherkinDocument.feature.language,\n previousKeywordType,\n })\n }\n const parsedStep = parseStep({\n isBeforeHook,\n gherkinStepMap,\n keyword,\n keywordType,\n pickleStep,\n pickleUri: relativePickleUri,\n snippetBuilder,\n supportCodeLibrary,\n testStep,\n testStepResult,\n testStepAttachments: valueOrDefault(\n testCaseAttempt.stepAttachments[testStep.id],\n []\n ),\n })\n parsedTestSteps.push(parsedStep)\n previousKeywordType = keywordType\n })\n return {\n testCase: parsedTestCase,\n testSteps: parsedTestSteps,\n }\n}\n"]}
|
|
@@ -17,8 +17,7 @@ export interface IUsage {
|
|
|
17
17
|
uri: string;
|
|
18
18
|
}
|
|
19
19
|
export interface IGetUsageRequest {
|
|
20
|
-
cwd: string;
|
|
21
20
|
eventDataCollector: EventDataCollector;
|
|
22
21
|
stepDefinitions: StepDefinition[];
|
|
23
22
|
}
|
|
24
|
-
export declare function getUsage({
|
|
23
|
+
export declare function getUsage({ stepDefinitions, eventDataCollector, }: IGetUsageRequest): IUsage[];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -43,13 +47,13 @@ const unexecutedStatuses = [
|
|
|
43
47
|
messages.TestStepResultStatus.SKIPPED,
|
|
44
48
|
messages.TestStepResultStatus.UNDEFINED,
|
|
45
49
|
];
|
|
46
|
-
function buildMapping({
|
|
50
|
+
function buildMapping({ stepDefinitions, eventDataCollector, }) {
|
|
47
51
|
const mapping = buildEmptyMapping(stepDefinitions);
|
|
48
52
|
eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {
|
|
49
|
-
const pickleStepMap = pickle_parser_1.getPickleStepMap(testCaseAttempt.pickle);
|
|
50
|
-
const gherkinStepMap = gherkin_document_parser_1.getGherkinStepMap(testCaseAttempt.gherkinDocument);
|
|
53
|
+
const pickleStepMap = (0, pickle_parser_1.getPickleStepMap)(testCaseAttempt.pickle);
|
|
54
|
+
const gherkinStepMap = (0, gherkin_document_parser_1.getGherkinStepMap)(testCaseAttempt.gherkinDocument);
|
|
51
55
|
testCaseAttempt.testCase.testSteps.forEach((testStep) => {
|
|
52
|
-
if (value_checker_1.doesHaveValue(testStep.pickleStepId) &&
|
|
56
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId) &&
|
|
53
57
|
testStep.stepDefinitionIds.length === 1) {
|
|
54
58
|
const stepDefinitionId = testStep.stepDefinitionIds[0];
|
|
55
59
|
const pickleStep = pickleStepMap[testStep.pickleStepId];
|
|
@@ -60,10 +64,10 @@ function buildMapping({ cwd, stepDefinitions, eventDataCollector, }) {
|
|
|
60
64
|
uri: testCaseAttempt.pickle.uri,
|
|
61
65
|
};
|
|
62
66
|
const { duration, status } = testCaseAttempt.stepResults[testStep.id];
|
|
63
|
-
if (!unexecutedStatuses.includes(status) && value_checker_1.doesHaveValue(duration)) {
|
|
67
|
+
if (!unexecutedStatuses.includes(status) && (0, value_checker_1.doesHaveValue)(duration)) {
|
|
64
68
|
match.duration = duration;
|
|
65
69
|
}
|
|
66
|
-
if (value_checker_1.doesHaveValue(mapping[stepDefinitionId])) {
|
|
70
|
+
if ((0, value_checker_1.doesHaveValue)(mapping[stepDefinitionId])) {
|
|
67
71
|
mapping[stepDefinitionId].matches.push(match);
|
|
68
72
|
}
|
|
69
73
|
}
|
|
@@ -99,8 +103,8 @@ function buildResult(mapping) {
|
|
|
99
103
|
})
|
|
100
104
|
.sort((a, b) => normalizeDuration(b.meanDuration) - normalizeDuration(a.meanDuration));
|
|
101
105
|
}
|
|
102
|
-
function getUsage({
|
|
103
|
-
const mapping = buildMapping({
|
|
106
|
+
function getUsage({ stepDefinitions, eventDataCollector, }) {
|
|
107
|
+
const mapping = buildMapping({ stepDefinitions, eventDataCollector });
|
|
104
108
|
return buildResult(mapping);
|
|
105
109
|
}
|
|
106
110
|
exports.getUsage = getUsage;
|