@cucumber/cucumber 11.2.0 → 12.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/lib/api/convert_configuration.d.ts +0 -1
- package/lib/api/convert_configuration.js +1 -2
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/formatters.d.ts +0 -2
- package/lib/api/formatters.js +1 -2
- package/lib/api/formatters.js.map +1 -1
- package/lib/api/gherkin.js +1 -2
- package/lib/api/gherkin.js.map +1 -1
- package/lib/api/load_configuration.js +1 -2
- package/lib/api/load_configuration.js.map +1 -1
- package/lib/api/load_sources.js +1 -2
- package/lib/api/load_sources.js.map +1 -1
- package/lib/api/load_support.js +1 -2
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/plugins.js +3 -4
- package/lib/api/plugins.js.map +1 -1
- package/lib/api/run_cucumber.js +1 -2
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/support.js +1 -2
- package/lib/api/support.js.map +1 -1
- package/lib/api/test_helpers.js +2 -3
- package/lib/api/test_helpers.js.map +1 -1
- package/lib/assemble/assemble_test_cases.d.ts +0 -1
- package/lib/assemble/assemble_test_cases.js +1 -2
- package/lib/assemble/assemble_test_cases.js.map +1 -1
- package/lib/cli/helpers.d.ts +0 -2
- package/lib/cli/helpers.js +20 -11
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +2 -3
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +0 -1
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/install_validator.js +1 -2
- package/lib/cli/install_validator.js.map +1 -1
- package/lib/cli/run.js +1 -1
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.js +1 -2
- package/lib/cli/validate_node_engine_version.js.map +1 -1
- package/lib/configuration/argv_parser.js +0 -1
- package/lib/configuration/argv_parser.js.map +1 -1
- package/lib/configuration/check_schema.js +18 -10
- package/lib/configuration/check_schema.js.map +1 -1
- package/lib/configuration/default_configuration.js +0 -1
- package/lib/configuration/default_configuration.js.map +1 -1
- package/lib/configuration/from_file.js +4 -5
- package/lib/configuration/from_file.js.map +1 -1
- package/lib/configuration/helpers.js +1 -2
- package/lib/configuration/helpers.js.map +1 -1
- package/lib/configuration/locate_file.js +1 -2
- package/lib/configuration/locate_file.js.map +1 -1
- package/lib/configuration/merge_configurations.js +1 -2
- package/lib/configuration/merge_configurations.js.map +1 -1
- package/lib/configuration/parse_configuration.js +1 -2
- package/lib/configuration/parse_configuration.js.map +1 -1
- package/lib/configuration/split_format_descriptor.js +1 -2
- package/lib/configuration/split_format_descriptor.js.map +1 -1
- package/lib/configuration/types.d.ts +0 -5
- package/lib/configuration/types.js.map +1 -1
- package/lib/configuration/validate_configuration.js +1 -5
- package/lib/configuration/validate_configuration.js.map +1 -1
- package/lib/environment/console_logger.d.ts +0 -1
- package/lib/environment/console_logger.js.map +1 -1
- package/lib/environment/make_environment.js +1 -2
- package/lib/environment/make_environment.js.map +1 -1
- package/lib/environment/types.d.ts +0 -1
- package/lib/filter_stack_trace.js +2 -3
- package/lib/filter_stack_trace.js.map +1 -1
- package/lib/formatter/builder.d.ts +1 -5
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/builtin/html.js +1 -4
- package/lib/formatter/builtin/html.js.map +1 -1
- package/lib/formatter/builtin/index.d.ts +1 -1
- package/lib/formatter/create_stream.d.ts +0 -1
- package/lib/formatter/create_stream.js +3 -4
- package/lib/formatter/create_stream.js.map +1 -1
- package/lib/formatter/find_class_or_plugin.js +1 -2
- package/lib/formatter/find_class_or_plugin.js.map +1 -1
- package/lib/formatter/get_color_fns.d.ts +0 -2
- package/lib/formatter/get_color_fns.js +1 -1
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/duration_helpers.js +2 -3
- package/lib/formatter/helpers/duration_helpers.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +0 -1
- package/lib/formatter/helpers/event_data_collector.js +17 -7
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/gherkin_document_parser.js +4 -5
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/index.js +17 -7
- package/lib/formatter/helpers/index.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.js +6 -7
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +3 -3
- package/lib/formatter/helpers/keyword_type.js.map +1 -1
- package/lib/formatter/helpers/location_helpers.js +1 -2
- package/lib/formatter/helpers/location_helpers.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js +4 -5
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js +1 -2
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.js +18 -9
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js +18 -9
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js +18 -9
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js +18 -9
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/import_code.js +1 -2
- package/lib/formatter/import_code.js.map +1 -1
- package/lib/formatter/index.d.ts +0 -2
- package/lib/formatter/json_formatter.js +17 -7
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.js +17 -7
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/rerun_formatter.js +17 -7
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/resolve_implementation.js +1 -2
- package/lib/formatter/resolve_implementation.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +17 -7
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.js +17 -7
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +17 -7
- package/lib/index.js.map +1 -1
- package/lib/models/data_table.js.map +1 -1
- package/lib/models/step_definition.js.map +1 -1
- package/lib/paths/paths.js +1 -2
- package/lib/paths/paths.js.map +1 -1
- package/lib/pickle_filter.js.map +1 -1
- package/lib/plugin/plugin_manager.js +1 -1
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/publish/publish_plugin.js +46 -16
- package/lib/publish/publish_plugin.js.map +1 -1
- package/lib/runtime/attachment_manager/index.d.ts +0 -2
- package/lib/runtime/attachment_manager/index.js +17 -7
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/coordinator.d.ts +0 -1
- package/lib/runtime/format_error.js +1 -2
- package/lib/runtime/format_error.js.map +1 -1
- package/lib/runtime/helpers.js +20 -11
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/make_runtime.d.ts +0 -1
- package/lib/runtime/make_runtime.js +1 -2
- package/lib/runtime/make_runtime.js.map +1 -1
- package/lib/runtime/parallel/adapter.d.ts +0 -2
- package/lib/runtime/parallel/adapter.js.map +1 -1
- package/lib/runtime/parallel/run_worker.js.map +1 -1
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/run_test_run_hooks.js.map +1 -1
- package/lib/runtime/scope/make_proxy.js +1 -2
- package/lib/runtime/scope/make_proxy.js.map +1 -1
- package/lib/runtime/scope/test_case_scope.js +2 -2
- package/lib/runtime/scope/test_case_scope.js.map +1 -1
- package/lib/runtime/scope/test_run_scope.js +2 -2
- package/lib/runtime/scope/test_run_scope.js.map +1 -1
- package/lib/runtime/serial/adapter.d.ts +0 -1
- package/lib/runtime/serial/adapter.js.map +1 -1
- package/lib/runtime/step_runner.d.ts +5 -1
- package/lib/runtime/step_runner.js +24 -12
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +4 -4
- package/lib/runtime/test_case_runner.js +47 -20
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/runtime/worker.d.ts +0 -1
- package/lib/runtime/worker.js.map +1 -1
- package/lib/step_arguments.js +1 -2
- package/lib/step_arguments.js.map +1 -1
- package/lib/support_code_library_builder/build_parameter_type.js +1 -2
- package/lib/support_code_library_builder/build_parameter_type.js.map +1 -1
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +1 -2
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -1
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js +1 -2
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +2 -0
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/support_code_library_builder/validate_arguments.js +1 -1
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
- package/lib/time.d.ts +0 -2
- package/lib/time.js +19 -10
- package/lib/time.js.map +1 -1
- package/lib/try_require.js +2 -2
- package/lib/try_require.js.map +1 -1
- package/lib/tsconfig.node.tsbuildinfo +1 -0
- package/lib/uncaught_exception_manager.d.ts +0 -1
- package/lib/user_code_runner.js.map +1 -1
- package/lib/value_checker.js +3 -4
- package/lib/value_checker.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +59 -60
- package/lib/publish/http_stream.d.ts +0 -30
- package/lib/publish/http_stream.js +0 -117
- package/lib/publish/http_stream.js.map +0 -1
|
@@ -3,7 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.isFailure = isFailure;
|
|
7
|
+
exports.isWarning = isWarning;
|
|
8
|
+
exports.isIssue = isIssue;
|
|
9
|
+
exports.formatIssue = formatIssue;
|
|
10
|
+
exports.formatUndefinedParameterTypes = formatUndefinedParameterTypes;
|
|
11
|
+
exports.formatUndefinedParameterType = formatUndefinedParameterType;
|
|
7
12
|
const indent_string_1 = __importDefault(require("indent-string"));
|
|
8
13
|
const test_case_attempt_formatter_1 = require("./test_case_attempt_formatter");
|
|
9
14
|
function isFailure(result, willBeRetried = false) {
|
|
@@ -11,15 +16,12 @@ function isFailure(result, willBeRetried = false) {
|
|
|
11
16
|
result.status === 'UNDEFINED' ||
|
|
12
17
|
(result.status === 'FAILED' && !willBeRetried));
|
|
13
18
|
}
|
|
14
|
-
exports.isFailure = isFailure;
|
|
15
19
|
function isWarning(result, willBeRetried = false) {
|
|
16
20
|
return (result.status === 'PENDING' || (result.status === 'FAILED' && willBeRetried));
|
|
17
21
|
}
|
|
18
|
-
exports.isWarning = isWarning;
|
|
19
22
|
function isIssue(result) {
|
|
20
23
|
return isFailure(result) || isWarning(result);
|
|
21
24
|
}
|
|
22
|
-
exports.isIssue = isIssue;
|
|
23
25
|
function formatIssue({ colorFns, number, snippetBuilder, testCaseAttempt, supportCodeLibrary, printAttachments = true, }) {
|
|
24
26
|
const prefix = `${number.toString()}) `;
|
|
25
27
|
const formattedTestCaseAttempt = (0, test_case_attempt_formatter_1.formatTestCaseAttempt)({
|
|
@@ -38,7 +40,6 @@ function formatIssue({ colorFns, number, snippetBuilder, testCaseAttempt, suppor
|
|
|
38
40
|
});
|
|
39
41
|
return updatedLines.join('\n');
|
|
40
42
|
}
|
|
41
|
-
exports.formatIssue = formatIssue;
|
|
42
43
|
function formatUndefinedParameterTypes(undefinedParameterTypes) {
|
|
43
44
|
const output = [`Undefined parameter types:\n\n`];
|
|
44
45
|
const withLatest = {};
|
|
@@ -51,9 +52,7 @@ function formatUndefinedParameterTypes(undefinedParameterTypes) {
|
|
|
51
52
|
output.push('\n\n');
|
|
52
53
|
return output.join('');
|
|
53
54
|
}
|
|
54
|
-
exports.formatUndefinedParameterTypes = formatUndefinedParameterTypes;
|
|
55
55
|
function formatUndefinedParameterType(parameterType) {
|
|
56
56
|
return `"${parameterType.name}" e.g. \`${parameterType.expression}\``;
|
|
57
57
|
}
|
|
58
|
-
exports.formatUndefinedParameterType = formatUndefinedParameterType;
|
|
59
58
|
//# sourceMappingURL=issue_helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;AAQA,8BASC;AAED,8BAOC;AAED,0BAEC;AAWD,kCAwBC;AAED,sEAiBC;AAED,oEAIC;AA1FD,kEAAwC;AAKxC,+EAAqE;AAGrE,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,CAAC,aAAa,CAAC,CAC/C,CAAA;AACH,CAAC;AAED,SAAgB,SAAS,CACvB,MAA+B,EAC/B,gBAAyB,KAAK;IAE9B,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,aAAa,CAAC,CAC7E,CA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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;AAED,SAAgB,4BAA4B,CAC1C,aAA8C;IAE9C,OAAO,IAAI,aAAa,CAAC,IAAI,YAAY,aAAa,CAAC,UAAU,IAAI,CAAA;AACvE,CAAC","sourcesContent":["import indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport { IColorFns } from '../get_color_fns'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { SupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { formatTestCaseAttempt } from './test_case_attempt_formatter'\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: SupportCodeLibrary\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"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.KeywordType = void 0;
|
|
4
|
+
exports.getStepKeywordType = getStepKeywordType;
|
|
4
5
|
const gherkin_1 = require("@cucumber/gherkin");
|
|
5
6
|
const value_checker_1 = require("../../value_checker");
|
|
6
7
|
var KeywordType;
|
|
@@ -8,7 +9,7 @@ var KeywordType;
|
|
|
8
9
|
KeywordType["Precondition"] = "precondition";
|
|
9
10
|
KeywordType["Event"] = "event";
|
|
10
11
|
KeywordType["Outcome"] = "outcome";
|
|
11
|
-
})(KeywordType
|
|
12
|
+
})(KeywordType || (exports.KeywordType = KeywordType = {}));
|
|
12
13
|
function getStepKeywordType({ keyword, language, previousKeywordType, }) {
|
|
13
14
|
const dialect = gherkin_1.dialects[language];
|
|
14
15
|
const stepKeywords = ['given', 'when', 'then', 'and', 'but'];
|
|
@@ -28,5 +29,4 @@ function getStepKeywordType({ keyword, language, previousKeywordType, }) {
|
|
|
28
29
|
return KeywordType.Precondition;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
exports.getStepKeywordType = getStepKeywordType;
|
|
32
32
|
//# sourceMappingURL=keyword_type.js.map
|
|
@@ -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":";;;AAeA,gDAsBC;AArCD,+CAAqD;AACrD,uDAAmD;AAEnD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4CAA6B,CAAA;IAC7B,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EAJW,WAAW,2BAAX,WAAW,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,CAAC;QACb,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,CAAC;gBACvC,OAAO,mBAAmB,CAAA;YAC5B,CAAC;QACH,cAAc;QACd;YACE,OAAO,WAAW,CAAC,YAAY,CAAA;IACnC,CAAC;AACH,CAAC","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"]}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.formatLocation =
|
|
6
|
+
exports.formatLocation = formatLocation;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const value_checker_1 = require("../../value_checker");
|
|
9
9
|
function formatLocation(obj, cwd) {
|
|
@@ -13,5 +13,4 @@ function formatLocation(obj, cwd) {
|
|
|
13
13
|
}
|
|
14
14
|
return `${uri}:${obj.line.toString()}`;
|
|
15
15
|
}
|
|
16
|
-
exports.formatLocation = formatLocation;
|
|
17
16
|
//# sourceMappingURL=location_helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/location_helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"location_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/location_helpers.ts"],"names":[],"mappings":";;;;;AAIA,wCAMC;AAVD,0DAA4B;AAC5B,uDAAmD;AAGnD,SAAgB,cAAc,CAAC,GAAgB,EAAE,GAAY;IAC3D,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;IACjB,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,EAAE,CAAC;QACvB,GAAG,GAAG,mBAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/B,CAAC;IACD,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAA;AACxC,CAAC","sourcesContent":["import path from 'node: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,28 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getScenarioDescription = getScenarioDescription;
|
|
4
|
+
exports.getStepKeyword = getStepKeyword;
|
|
5
|
+
exports.getPickleStepMap = getPickleStepMap;
|
|
6
|
+
exports.getPickleLocation = getPickleLocation;
|
|
4
7
|
const gherkin_document_parser_1 = require("./gherkin_document_parser");
|
|
5
8
|
function getScenarioDescription({ pickle, gherkinScenarioMap, }) {
|
|
6
9
|
return pickle.astNodeIds
|
|
7
10
|
.map((id) => gherkinScenarioMap[id])
|
|
8
11
|
.filter((x) => x != null)[0].description;
|
|
9
12
|
}
|
|
10
|
-
exports.getScenarioDescription = getScenarioDescription;
|
|
11
13
|
function getStepKeyword({ pickleStep, gherkinStepMap, }) {
|
|
12
14
|
return pickleStep.astNodeIds
|
|
13
15
|
.map((id) => gherkinStepMap[id])
|
|
14
16
|
.filter((x) => x != null)[0].keyword;
|
|
15
17
|
}
|
|
16
|
-
exports.getStepKeyword = getStepKeyword;
|
|
17
18
|
function getPickleStepMap(pickle) {
|
|
18
19
|
const result = {};
|
|
19
20
|
pickle.steps.forEach((pickleStep) => (result[pickleStep.id] = pickleStep));
|
|
20
21
|
return result;
|
|
21
22
|
}
|
|
22
|
-
exports.getPickleStepMap = getPickleStepMap;
|
|
23
23
|
function getPickleLocation({ gherkinDocument, pickle, }) {
|
|
24
24
|
const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
|
|
25
25
|
return gherkinScenarioLocationMap[pickle.astNodeIds[pickle.astNodeIds.length - 1]];
|
|
26
26
|
}
|
|
27
|
-
exports.getPickleLocation = getPickleLocation;
|
|
28
27
|
//# 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":";;AAkBA,wDAOC;AAED,wCAOC;AAED,4CAMC;AAED,8CASC;AApDD,uEAAyE;AAiBzE,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;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;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;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","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { getGherkinScenarioLocationMap } from './gherkin_document_parser'\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"]}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.formatStepArgument =
|
|
6
|
+
exports.formatStepArgument = formatStepArgument;
|
|
7
7
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
8
8
|
const step_arguments_1 = require("../../step_arguments");
|
|
9
9
|
function formatDataTable(dataTable) {
|
|
@@ -44,5 +44,4 @@ function formatStepArgument(arg) {
|
|
|
44
44
|
docString: formatDocString,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
exports.formatStepArgument = formatStepArgument;
|
|
48
47
|
//# sourceMappingURL=step_argument_formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step_argument_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/step_argument_formatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"step_argument_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/step_argument_formatter.ts"],"names":[],"mappings":";;;;;AA0CA,gDAKC;AA/CD,4DAA8B;AAE9B,yDAAwD;AAExD,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","sourcesContent":["import Table from 'cli-table3'\nimport * as messages from '@cucumber/messages'\nimport { parseStepArgument } from '../../step_arguments'\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"]}
|
|
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.formatSummary =
|
|
36
|
+
exports.formatSummary = formatSummary;
|
|
27
37
|
const messages = __importStar(require("@cucumber/messages"));
|
|
28
38
|
const luxon_1 = require("luxon");
|
|
29
39
|
const value_checker_1 = require("../../value_checker");
|
|
@@ -66,7 +76,6 @@ function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }) {
|
|
|
66
76
|
const durationSummary = `${getDurationSummary(testRunDuration)} (executing steps: ${getDurationSummary(totalStepDuration)})\n`;
|
|
67
77
|
return [scenarioSummary, stepSummary, durationSummary].join('\n');
|
|
68
78
|
}
|
|
69
|
-
exports.formatSummary = formatSummary;
|
|
70
79
|
function getCountSummary({ colorFns, objects, type, }) {
|
|
71
80
|
const counts = {};
|
|
72
81
|
STATUS_REPORT_ORDER.forEach((x) => (counts[x] = 0));
|
|
@@ -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","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,sCAwCC;AA9DD,6DAA8C;AAC9C,iCAAgC;AAEhC,uDAAmD;AAGnD,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,CAAC,oBAAoB,CAAC,MAAM;IACpC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;IACvC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;IACvC,QAAQ,CAAC,oBAAoB,CAAC,OAAO;IACrC,QAAQ,CAAC,oBAAoB,CAAC,OAAO;IACrC,QAAQ,CAAC,oBAAoB,CAAC,MAAM;IACpC,QAAQ,CAAC,oBAAoB,CAAC,OAAO;CACtC,CAAA;AAQD,SAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,gBAAgB,EAChB,eAAe,GACO;IACtB,MAAM,eAAe,GAA8B,EAAE,CAAA;IACrD,MAAM,eAAe,GAA8B,EAAE,CAAA;IACrD,IAAI,iBAAiB,GAAG,QAAQ,CAAC,cAA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,GAAG,GAAG,IAAI,IAAI,CAClB,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAC5D,CAAA;IACD,MAAM,QAAQ,GAAG,gBAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC;QAC7D,SAAS;QACT,SAAS;QACT,cAAc;KACf,CAAC,CAAA;IACF,OAAO,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { Interval } from 'luxon'\nimport { IColorFns } from '../get_color_fns'\nimport { doesHaveValue } from '../../value_checker'\nimport { ITestCaseAttempt } from './event_data_collector'\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 messages.TestStepResultStatus.UNKNOWN,\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 = Interval.fromDateTimes(start, end).toDuration([\n 'minutes',\n 'seconds',\n 'milliseconds',\n ])\n return duration.toFormat(\"m'm'ss.SSS's'\")\n}\n"]}
|
|
@@ -15,18 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.formatTestCaseAttempt =
|
|
39
|
+
exports.formatTestCaseAttempt = formatTestCaseAttempt;
|
|
30
40
|
const indent_string_1 = __importDefault(require("indent-string"));
|
|
31
41
|
const messages = __importStar(require("@cucumber/messages"));
|
|
32
42
|
const figures_1 = __importDefault(require("figures"));
|
|
@@ -102,7 +112,6 @@ function formatTestCaseAttempt({ colorFns, snippetBuilder, supportCodeLibrary, t
|
|
|
102
112
|
});
|
|
103
113
|
return `${text}\n`;
|
|
104
114
|
}
|
|
105
|
-
exports.formatTestCaseAttempt = formatTestCaseAttempt;
|
|
106
115
|
function getAttemptText(attempt, willBeRetried) {
|
|
107
116
|
if (attempt > 0 || willBeRetried) {
|
|
108
117
|
const numberStr = (attempt + 1).toString();
|
|
@@ -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":";;;;;;;;;;;;;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OAAe,EAAE,aAAsB;IAC7D,IAAI,OAAO,GAAG,CAAC,IAAI,aAAa,EAAE,CAAC;QACjC,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;IAC/C,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC","sourcesContent":["import indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport figures from 'figures'\nimport { IColorFns } from '../get_color_fns'\nimport { doesHaveValue, valueOrDefault } from '../../value_checker'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { SupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { formatLocation } from './location_helpers'\nimport {\n IParsedTestStep,\n parseTestCaseAttempt,\n} from './test_case_attempt_parser'\nimport { formatStepArgument } from './step_argument_formatter'\nimport { ITestCaseAttempt } from './event_data_collector'\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 name,\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(name)) {\n text += colorFn(` (${name})`)\n }\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, fileName }) => {\n let message = ''\n if (mediaType === 'text/plain') {\n message = `: ${body}`\n } else if (fileName) {\n message = `: ${fileName}`\n }\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: SupportCodeLibrary\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"]}
|
|
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.parseTestCaseAttempt =
|
|
36
|
+
exports.parseTestCaseAttempt = parseTestCaseAttempt;
|
|
27
37
|
const messages = __importStar(require("@cucumber/messages"));
|
|
28
38
|
const messages_1 = require("@cucumber/messages");
|
|
29
39
|
const value_checker_1 = require("../../value_checker");
|
|
@@ -131,5 +141,4 @@ function parseTestCaseAttempt({ testCaseAttempt, snippetBuilder, supportCodeLibr
|
|
|
131
141
|
testSteps: parsedTestSteps,
|
|
132
142
|
};
|
|
133
143
|
}
|
|
134
|
-
exports.parseTestCaseAttempt = parseTestCaseAttempt;
|
|
135
144
|
//# sourceMappingURL=test_case_attempt_parser.js.map
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgIA,oDAiEC;AAjMD,6DAA8C;AAC9C,iDAAmD;AAGnD,uDAAmE;AAGnE,iDAAgE;AAChE,uEAGkC;AAClC,mDAAkE;AAyClE,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,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,YAAY;gBACZ,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,OAAO;QACb,MAAM,EAAE,cAAc;KACvB,CAAA;IACD,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,IAAI,cAAsC,CAAA;QAC1C,IAAI,YAAY,EAAE,CAAC;YACjB,cAAc,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,IAAI,CACpE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,MAAM,CAChC,CAAA;QACH,CAAC;aAAM,CAAC;YACN,cAAc,GAAG,kBAAkB,CAAC,4BAA4B,CAA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M,CAAC,CAAA;QAE7D,IAAI,OAAO,EAAE,WAAW,EAAE,UAAU,CAAA;QACpC,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACzC,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;YACjD,OAAO,GAAG,IAAA,8BAAc,EAAC,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CAAA;YACxD,WAAW,GAAG,IAAA,iCAAkB,EAAC;gBAC/B,OAAO;gBACP,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,QAAQ;gBAC1C,mBAAmB;aACpB,CAAC,CAAA;QACJ,CAAC;QACD,MAAM,UAAU,GAAG,SAAS,CAAC;YAC3B,YAAY;YACZ,cAAc;YACd,OAAO;YACP,WAAW;YACX,UAAU;YACV,SAAS,EAAE,iBAAiB;YAC5B,cAAc;YACd,kBAAkB;YAClB,QAAQ;YACR,cAAc;YACd,mBAAmB,EAAE,IAAA,8BAAc,EACjC,eAAe,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,EAC5C,EAAE,CACH;SACF,CAAC,CAAA;QACF,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAChC,mBAAmB,GAAG,WAAW,CAAA;IACnC,CAAC,CAAC,CAAA;IACF,OAAO;QACL,QAAQ,EAAE,cAAc;QACxB,SAAS,EAAE,eAAe;KAC3B,CAAA;AACH,CAAC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { TestStepResult } from '@cucumber/messages'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { SupportCodeLibrary } 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 { getStepKeywordType, KeywordType } from './keyword_type'\nimport {\n getGherkinScenarioLocationMap,\n getGherkinStepMap,\n} from './gherkin_document_parser'\nimport { getPickleStepMap, getStepKeyword } from './pickle_parser'\nimport { ITestCaseAttempt } from './event_data_collector'\n\nexport interface IParsedTestStep {\n actionLocation?: ILineAndUri\n argument?: messages.PickleStepArgument\n attachments: messages.Attachment[]\n keyword: string\n name?: 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: SupportCodeLibrary\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 out.name = hookDefinition.name\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: SupportCodeLibrary\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"]}
|
|
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getUsage =
|
|
36
|
+
exports.getUsage = getUsage;
|
|
27
37
|
const messages = __importStar(require("@cucumber/messages"));
|
|
28
38
|
const pickle_parser_1 = require("../pickle_parser");
|
|
29
39
|
const gherkin_document_parser_1 = require("../gherkin_document_parser");
|
|
@@ -107,5 +117,4 @@ function getUsage({ stepDefinitions, eventDataCollector, }) {
|
|
|
107
117
|
const mapping = buildMapping({ stepDefinitions, eventDataCollector });
|
|
108
118
|
return buildResult(mapping);
|
|
109
119
|
}
|
|
110
|
-
exports.getUsage = getUsage;
|
|
111
120
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/formatter/helpers/usage_helpers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/formatter/helpers/usage_helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HA,4BAMC;AAlID,6DAA8C;AAC9C,oDAAmD;AACnD,wEAA8D;AAE9D,0DAAsD;AAyBtD,SAAS,iBAAiB,CACxB,eAAiC;IAEjC,MAAM,OAAO,GAA2B,EAAE,CAAA;IAC1C,eAAe,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE;QACzC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,GAAG;YAC3B,IAAI,EAAE,cAAc,CAAC,aAAa,CAAC,QAAQ,EAAE;YAC7C,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,MAAM;YACzC,WAAW,EAAE,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI;YACvD,OAAO,EAAE,EAAE;YACX,GAAG,EAAE,cAAc,CAAC,GAAG;SACxB,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,kBAAkB,GAA6C;IACnE,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AAO,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,CAAA;QAClD,MAAM,SAAS,GAAwB,OAAO;aAC3C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC;aACjC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;QACzB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,iBAAiB,GAAG,SAAS,CAAC,MAAM,CACxC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,EACnE,CAAC,CACF,CAAA;YACD,MAAM,CAAC,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAClE,iBAAiB,GAAG,SAAS,CAAC,MAAM,CACrC,CAAA;QACH,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC,CAAC;SACD,IAAI,CACH,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CACvB,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC,CACxE,CAAA;AACL,CAAC;AAED,SAAgB,QAAQ,CAAC,EACvB,eAAe,EACf,kBAAkB,GACD;IACjB,MAAM,OAAO,GAAG,YAAY,CAAC,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC,CAAA;IACrE,OAAO,WAAW,CAAC,OAAO,CAAC,CAAA;AAC7B,CAAC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { getPickleStepMap } from '../pickle_parser'\nimport { getGherkinStepMap } from '../gherkin_document_parser'\nimport StepDefinition from '../../../models/step_definition'\nimport { doesHaveValue } from '../../../value_checker'\nimport EventDataCollector from '../event_data_collector'\n\nexport interface IUsageMatch {\n duration?: messages.Duration\n line: number\n text: string\n uri: string\n}\n\nexport interface IUsage {\n code: string\n line: number\n matches: IUsageMatch[]\n meanDuration?: messages.Duration\n pattern: string\n patternType: string\n uri: string\n}\n\nexport interface IGetUsageRequest {\n eventDataCollector: EventDataCollector\n stepDefinitions: StepDefinition[]\n}\n\nfunction buildEmptyMapping(\n stepDefinitions: StepDefinition[]\n): Record<string, IUsage> {\n const mapping: Record<string, IUsage> = {}\n stepDefinitions.forEach((stepDefinition) => {\n mapping[stepDefinition.id] = {\n code: stepDefinition.unwrappedCode.toString(),\n line: stepDefinition.line,\n pattern: stepDefinition.expression.source,\n patternType: stepDefinition.expression.constructor.name,\n matches: [],\n uri: stepDefinition.uri,\n }\n })\n return mapping\n}\n\nconst unexecutedStatuses: readonly messages.TestStepResultStatus[] = [\n messages.TestStepResultStatus.AMBIGUOUS,\n messages.TestStepResultStatus.SKIPPED,\n messages.TestStepResultStatus.UNDEFINED,\n]\n\nfunction buildMapping({\n stepDefinitions,\n eventDataCollector,\n}: IGetUsageRequest): Record<string, IUsage> {\n const mapping = buildEmptyMapping(stepDefinitions)\n eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {\n const pickleStepMap = getPickleStepMap(testCaseAttempt.pickle)\n const gherkinStepMap = getGherkinStepMap(testCaseAttempt.gherkinDocument)\n testCaseAttempt.testCase.testSteps.forEach((testStep) => {\n if (\n doesHaveValue(testStep.pickleStepId) &&\n testStep.stepDefinitionIds.length === 1\n ) {\n const stepDefinitionId = testStep.stepDefinitionIds[0]\n const pickleStep = pickleStepMap[testStep.pickleStepId]\n const gherkinStep = gherkinStepMap[pickleStep.astNodeIds[0]]\n const match: IUsageMatch = {\n line: gherkinStep.location.line,\n text: pickleStep.text,\n uri: testCaseAttempt.pickle.uri,\n }\n const { duration, status } = testCaseAttempt.stepResults[testStep.id]\n if (!unexecutedStatuses.includes(status) && doesHaveValue(duration)) {\n match.duration = duration\n }\n if (doesHaveValue(mapping[stepDefinitionId])) {\n mapping[stepDefinitionId].matches.push(match)\n }\n }\n })\n })\n return mapping\n}\n\nfunction normalizeDuration(duration?: messages.Duration): number {\n if (duration == null) {\n return Number.MIN_SAFE_INTEGER\n }\n return messages.TimeConversion.durationToMilliseconds(duration)\n}\n\nfunction buildResult(mapping: Record<string, IUsage>): IUsage[] {\n return Object.keys(mapping)\n .map((stepDefinitionId) => {\n const { matches, ...rest } = mapping[stepDefinitionId]\n const sortedMatches = matches.sort((a: IUsageMatch, b: IUsageMatch) => {\n if (a.duration === b.duration) {\n return a.text < b.text ? -1 : 1\n }\n return normalizeDuration(b.duration) - normalizeDuration(a.duration)\n })\n const result = { matches: sortedMatches, ...rest }\n const durations: messages.Duration[] = matches\n .filter((m) => m.duration != null)\n .map((m) => m.duration)\n if (durations.length > 0) {\n const totalMilliseconds = durations.reduce(\n (acc, x) => acc + messages.TimeConversion.durationToMilliseconds(x),\n 0\n )\n result.meanDuration = messages.TimeConversion.millisecondsToDuration(\n totalMilliseconds / durations.length\n )\n }\n return result\n })\n .sort(\n (a: IUsage, b: IUsage) =>\n normalizeDuration(b.meanDuration) - normalizeDuration(a.meanDuration)\n )\n}\n\nexport function getUsage({\n stepDefinitions,\n eventDataCollector,\n}: IGetUsageRequest): IUsage[] {\n const mapping = buildMapping({ stepDefinitions, eventDataCollector })\n return buildResult(mapping)\n}\n"]}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.importCode =
|
|
6
|
+
exports.importCode = importCode;
|
|
7
7
|
const node_url_1 = require("node:url");
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
async function importCode(specifier, cwd) {
|
|
@@ -23,5 +23,4 @@ async function importCode(specifier, cwd) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
exports.importCode = importCode;
|
|
27
26
|
//# sourceMappingURL=import_code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import_code.js","sourceRoot":"","sources":["../../src/formatter/import_code.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"import_code.js","sourceRoot":"","sources":["../../src/formatter/import_code.ts"],"names":[],"mappings":";;;;;AAGA,gCAcC;AAjBD,uCAAwC;AACxC,0DAA4B;AAErB,KAAK,UAAU,UAAU,CAAC,SAAiB,EAAE,GAAW;IAC7D,IAAI,CAAC;QACH,IAAI,UAAU,GAAiB,SAAS,CAAA;QACxC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,UAAU,GAAG,IAAA,wBAAa,EAAC,mBAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAA;QAC1D,CAAC;aAAM,IAAI,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3C,UAAU,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAA;QACjC,CAAC;QACD,OAAO,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAA;IAC5C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,EAAE,EAAE;YACzD,KAAK,EAAE,CAAC;SACT,CAAC,CAAA;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { pathToFileURL } from 'node:url'\nimport path from 'node:path'\n\nexport async function importCode(specifier: string, cwd: string): Promise<any> {\n try {\n let normalized: URL | string = specifier\n if (specifier.startsWith('.')) {\n normalized = pathToFileURL(path.resolve(cwd, specifier))\n } else if (specifier.startsWith('file://')) {\n normalized = new URL(specifier)\n }\n return await import(normalized.toString())\n } catch (e) {\n throw new Error(`Failed to import formatter ${specifier}`, {\n cause: e,\n })\n }\n}\n"]}
|