@cucumber/cucumber 7.3.2 → 8.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -51
- package/api/index.d.ts +6 -0
- package/lib/api/convert_configuration.d.ts +4 -0
- package/lib/api/convert_configuration.js +64 -0
- package/lib/api/convert_configuration.js.map +1 -0
- package/lib/api/environment.d.ts +2 -0
- package/lib/api/environment.js +13 -0
- package/lib/api/environment.js.map +1 -0
- package/lib/api/formatters.d.ts +16 -0
- package/lib/api/formatters.js +72 -0
- package/lib/api/formatters.js.map +1 -0
- package/lib/api/gherkin.d.ts +21 -0
- package/lib/api/gherkin.js +65 -0
- package/lib/api/gherkin.js.map +1 -0
- package/lib/api/index.d.ts +11 -0
- package/lib/api/index.js +24 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/load_configuration.d.ts +9 -0
- package/lib/api/load_configuration.js +32 -0
- package/lib/api/load_configuration.js.map +1 -0
- package/lib/api/load_sources.d.ts +9 -0
- package/lib/api/load_sources.js +53 -0
- package/lib/api/load_sources.js.map +1 -0
- package/lib/api/load_support.d.ts +10 -0
- package/lib/api/load_support.js +28 -0
- package/lib/api/load_support.js.map +1 -0
- package/lib/api/paths.d.ts +7 -0
- package/lib/api/paths.js +99 -0
- package/lib/api/paths.js.map +1 -0
- package/lib/api/run_cucumber.d.ts +11 -0
- package/lib/api/run_cucumber.js +108 -0
- package/lib/api/run_cucumber.js.map +1 -0
- package/lib/api/runtime.d.ts +20 -0
- package/lib/api/runtime.js +36 -0
- package/lib/api/runtime.js.map +1 -0
- package/lib/api/support.d.ts +9 -0
- package/lib/api/support.js +21 -0
- package/lib/api/support.js.map +1 -0
- package/lib/api/types.d.ts +168 -0
- package/lib/api/types.js +3 -0
- package/lib/api/types.js.map +1 -0
- package/lib/api/wrapper.mjs +6 -0
- package/lib/cli/helpers.d.ts +16 -9
- package/lib/cli/helpers.js +49 -32
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +7 -7
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +6 -23
- package/lib/cli/index.js +38 -197
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/install_validator.js +1 -1
- package/lib/cli/install_validator.js.map +1 -1
- package/lib/cli/publish_banner.js +6 -6
- package/lib/cli/publish_banner.js.map +1 -1
- package/lib/cli/run.js +15 -7
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.d.ts +7 -0
- package/lib/cli/validate_node_engine_version.js +20 -0
- package/lib/cli/validate_node_engine_version.js.map +1 -0
- package/lib/configuration/argv_parser.d.ts +20 -0
- package/lib/{cli → configuration}/argv_parser.js +52 -53
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/check_schema.d.ts +2 -0
- package/lib/configuration/check_schema.js +56 -0
- package/lib/configuration/check_schema.js.map +1 -0
- package/lib/configuration/default_configuration.d.ts +2 -0
- package/lib/configuration/default_configuration.js +27 -0
- package/lib/configuration/default_configuration.js.map +1 -0
- package/lib/configuration/from_file.d.ts +2 -0
- package/lib/configuration/from_file.js +68 -0
- package/lib/configuration/from_file.js.map +1 -0
- package/lib/configuration/helpers.d.ts +1 -0
- package/lib/configuration/helpers.js +11 -0
- package/lib/configuration/helpers.js.map +1 -0
- package/lib/configuration/index.d.ts +7 -0
- package/lib/configuration/index.js +25 -0
- package/lib/configuration/index.js.map +1 -0
- package/lib/configuration/locate_file.d.ts +1 -0
- package/lib/configuration/locate_file.js +19 -0
- package/lib/configuration/locate_file.js.map +1 -0
- package/lib/configuration/merge_configurations.d.ts +2 -0
- package/lib/configuration/merge_configurations.js +48 -0
- package/lib/configuration/merge_configurations.js.map +1 -0
- package/lib/configuration/option_splitter.d.ts +3 -0
- package/lib/{cli → configuration}/option_splitter.js +3 -2
- package/lib/configuration/option_splitter.js.map +1 -0
- package/lib/configuration/types.d.ts +25 -0
- package/lib/configuration/types.js +3 -0
- package/lib/configuration/types.js.map +1 -0
- package/lib/configuration/validate_configuration.d.ts +2 -0
- package/lib/configuration/validate_configuration.js +10 -0
- package/lib/configuration/validate_configuration.js.map +1 -0
- package/lib/formatter/builder.d.ts +7 -7
- package/lib/formatter/builder.js +48 -55
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/get_color_fns.js +15 -16
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +2 -1
- package/lib/formatter/helpers/event_data_collector.js +16 -15
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/formatters.d.ts +6 -0
- package/lib/formatter/helpers/formatters.js +41 -0
- package/lib/formatter/helpers/formatters.js.map +1 -0
- package/lib/formatter/helpers/gherkin_document_parser.js +29 -42
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +4 -4
- package/lib/formatter/helpers/issue_helpers.js +8 -9
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +2 -6
- package/lib/formatter/helpers/keyword_type.js.map +1 -1
- package/lib/formatter/helpers/location_helpers.js +1 -1
- package/lib/formatter/helpers/location_helpers.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js +9 -18
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.js +8 -7
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +2 -2
- package/lib/formatter/helpers/test_case_attempt_formatter.js +20 -19
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +1 -2
- package/lib/formatter/helpers/test_case_attempt_parser.js +18 -21
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.d.ts +1 -2
- package/lib/formatter/helpers/usage_helpers/index.js +29 -43
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/html_formatter.d.ts +1 -0
- package/lib/formatter/html_formatter.js +5 -4
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/http_stream.js +7 -7
- package/lib/formatter/http_stream.js.map +1 -1
- package/lib/formatter/index.d.ts +15 -2
- package/lib/formatter/index.js +2 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.d.ts +1 -0
- package/lib/formatter/json_formatter.js +25 -20
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/message_formatter.d.ts +1 -0
- package/lib/formatter/message_formatter.js +1 -0
- package/lib/formatter/message_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.d.ts +1 -0
- package/lib/formatter/progress_bar_formatter.js +18 -17
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.d.ts +1 -0
- package/lib/formatter/progress_formatter.js +3 -2
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/publish.d.ts +1 -0
- package/lib/formatter/publish.js +5 -0
- package/lib/formatter/publish.js.map +1 -0
- package/lib/formatter/rerun_formatter.d.ts +1 -0
- package/lib/formatter/rerun_formatter.js +15 -11
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.d.ts +1 -0
- package/lib/formatter/snippets_formatter.js +3 -3
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.js +2 -2
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +3 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
- package/lib/formatter/summary_formatter.d.ts +1 -0
- package/lib/formatter/summary_formatter.js +11 -11
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.d.ts +1 -0
- package/lib/formatter/usage_formatter.js +9 -10
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.d.ts +1 -0
- package/lib/formatter/usage_json_formatter.js +3 -3
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/importer.js +13 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +9 -1
- package/lib/index.js.map +1 -1
- package/lib/models/data_table.js +9 -7
- package/lib/models/data_table.js.map +1 -1
- package/lib/models/pickle_order.d.ts +1 -0
- package/lib/models/pickle_order.js +3 -0
- package/lib/models/pickle_order.js.map +1 -0
- package/lib/models/step_definition.js +4 -5
- package/lib/models/step_definition.js.map +1 -1
- package/lib/pickle_filter.js +13 -13
- package/lib/pickle_filter.js.map +1 -1
- package/lib/runtime/assemble_test_cases.js +3 -3
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/attachment_manager/index.js +4 -4
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/helpers.d.ts +1 -0
- package/lib/runtime/helpers.js +42 -4
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +7 -7
- package/lib/runtime/index.js +12 -65
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/command_types.d.ts +3 -2
- package/lib/runtime/parallel/command_types.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +32 -12
- package/lib/runtime/parallel/coordinator.js +82 -38
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/run_worker.js +1 -1
- package/lib/runtime/parallel/run_worker.js.map +1 -1
- package/lib/runtime/parallel/worker.d.ts +2 -4
- package/lib/runtime/parallel/worker.js +18 -33
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/run_test_run_hooks.d.ts +3 -0
- package/lib/runtime/run_test_run_hooks.js +28 -0
- package/lib/runtime/run_test_run_hooks.js.map +1 -0
- package/lib/runtime/step_runner.js +5 -7
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js +4 -4
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +3 -3
- package/lib/runtime/test_case_runner.js +19 -28
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/stack_trace_filter.js +6 -7
- package/lib/stack_trace_filter.js.map +1 -1
- package/lib/step_arguments.js +2 -2
- package/lib/step_arguments.js.map +1 -1
- package/lib/support_code_library_builder/{build_helpers.d.ts → build_parameter_type.d.ts} +0 -2
- package/lib/support_code_library_builder/build_parameter_type.js +13 -0
- package/lib/support_code_library_builder/build_parameter_type.js.map +1 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +30 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -0
- package/lib/support_code_library_builder/index.d.ts +4 -2
- package/lib/support_code_library_builder/index.js +43 -34
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js +16 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -0
- package/lib/support_code_library_builder/types.d.ts +10 -0
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/support_code_library_builder/validate_arguments.js +14 -19
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
- package/lib/time.d.ts +1 -0
- package/lib/time.js +17 -2
- package/lib/time.js.map +1 -1
- package/lib/user_code_runner.js +10 -17
- package/lib/user_code_runner.js.map +1 -1
- package/lib/value_checker.d.ts +2 -2
- package/lib/value_checker.js.map +1 -1
- package/lib/version.d.ts +1 -0
- package/lib/version.js +6 -0
- package/lib/version.js.map +1 -0
- package/lib/wrapper.mjs +42 -0
- package/package.json +98 -70
- package/lib/cli/argv_parser.d.ts +0 -51
- package/lib/cli/argv_parser.js.map +0 -1
- package/lib/cli/configuration_builder.d.ts +0 -46
- package/lib/cli/configuration_builder.js +0 -161
- package/lib/cli/configuration_builder.js.map +0 -1
- package/lib/cli/option_splitter.d.ts +0 -4
- package/lib/cli/option_splitter.js.map +0 -1
- package/lib/cli/profile_loader.d.ts +0 -6
- package/lib/cli/profile_loader.js +0 -42
- package/lib/cli/profile_loader.js.map +0 -1
- package/lib/support_code_library_builder/build_helpers.js +0 -41
- package/lib/support_code_library_builder/build_helpers.js.map +0 -1
- package/lib/support_code_library_builder/finalize_helpers.d.ts +0 -10
- package/lib/support_code_library_builder/finalize_helpers.js +0 -26
- package/lib/support_code_library_builder/finalize_helpers.js.map +0 -1
|
@@ -23,7 +23,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.formatSummary = void 0;
|
|
26
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
27
26
|
const duration_1 = __importDefault(require("duration"));
|
|
28
27
|
const messages = __importStar(require("@cucumber/messages"));
|
|
29
28
|
const value_checker_1 = require("../../value_checker");
|
|
@@ -39,14 +38,14 @@ function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }) {
|
|
|
39
38
|
const testCaseResults = [];
|
|
40
39
|
const testStepResults = [];
|
|
41
40
|
let totalStepDuration = messages.TimeConversion.millisecondsToDuration(0);
|
|
42
|
-
testCaseAttempts.forEach(({ testCase, worstTestStepResult, stepResults }) => {
|
|
41
|
+
testCaseAttempts.forEach(({ testCase, willBeRetried, worstTestStepResult, stepResults }) => {
|
|
43
42
|
Object.values(stepResults).forEach((stepResult) => {
|
|
44
43
|
totalStepDuration = messages.TimeConversion.addDurations(totalStepDuration, stepResult.duration);
|
|
45
44
|
});
|
|
46
|
-
if (!
|
|
45
|
+
if (!willBeRetried) {
|
|
47
46
|
testCaseResults.push(worstTestStepResult);
|
|
48
|
-
|
|
49
|
-
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
|
|
47
|
+
testCase.testSteps.forEach((testStep) => {
|
|
48
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
|
|
50
49
|
testStepResults.push(stepResults[testStep.id]);
|
|
51
50
|
}
|
|
52
51
|
});
|
|
@@ -67,8 +66,10 @@ function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }) {
|
|
|
67
66
|
}
|
|
68
67
|
exports.formatSummary = formatSummary;
|
|
69
68
|
function getCountSummary({ colorFns, objects, type, }) {
|
|
70
|
-
const counts =
|
|
71
|
-
|
|
69
|
+
const counts = {};
|
|
70
|
+
STATUS_REPORT_ORDER.forEach((x) => (counts[x] = 0));
|
|
71
|
+
objects.forEach((x) => (counts[x.status] += 1));
|
|
72
|
+
const total = Object.values(counts).reduce((acc, x) => acc + x, 0);
|
|
72
73
|
let text = `${total.toString()} ${type}${total === 1 ? '' : 's'}`;
|
|
73
74
|
if (total > 0) {
|
|
74
75
|
const details = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA+B;AAG/B,6DAA8C;AAC9C,uDAAmD;AAEnD,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,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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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;
|
|
@@ -44,47 +44,48 @@ function getStepMessage(testStep) {
|
|
|
44
44
|
case messages.TestStepResultStatus.FAILED:
|
|
45
45
|
return testStep.result.message;
|
|
46
46
|
case messages.TestStepResultStatus.UNDEFINED:
|
|
47
|
-
return `${'Undefined. Implement with the following snippet:' + '\n\n'}${indent_string_1.default(testStep.snippet, 2)}\n`;
|
|
47
|
+
return `${'Undefined. Implement with the following snippet:' + '\n\n'}${(0, indent_string_1.default)(testStep.snippet, 2)}\n`;
|
|
48
48
|
case messages.TestStepResultStatus.PENDING:
|
|
49
49
|
return 'Pending';
|
|
50
50
|
}
|
|
51
51
|
return '';
|
|
52
52
|
}
|
|
53
|
-
function formatStep({ colorFns, testStep }) {
|
|
53
|
+
function formatStep({ colorFns, testStep, printAttachments, }) {
|
|
54
54
|
const { result: { status }, actionLocation, attachments, } = testStep;
|
|
55
55
|
const colorFn = colorFns.forStatus(status);
|
|
56
|
-
const identifier = testStep.keyword + value_checker_1.valueOrDefault(testStep.text, '');
|
|
56
|
+
const identifier = testStep.keyword + (0, value_checker_1.valueOrDefault)(testStep.text, '');
|
|
57
57
|
let text = colorFn(`${CHARACTERS.get(status)} ${identifier}`);
|
|
58
|
-
if (value_checker_1.doesHaveValue(actionLocation)) {
|
|
59
|
-
text += ` # ${colorFns.location(location_helpers_1.formatLocation(actionLocation))}`;
|
|
58
|
+
if ((0, value_checker_1.doesHaveValue)(actionLocation)) {
|
|
59
|
+
text += ` # ${colorFns.location((0, location_helpers_1.formatLocation)(actionLocation))}`;
|
|
60
60
|
}
|
|
61
61
|
text += '\n';
|
|
62
|
-
if (value_checker_1.doesHaveValue(testStep.argument)) {
|
|
63
|
-
const argumentsText = step_argument_formatter_1.formatStepArgument(testStep.argument);
|
|
64
|
-
text += indent_string_1.default(`${colorFn(argumentsText)}\n`, 4);
|
|
62
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.argument)) {
|
|
63
|
+
const argumentsText = (0, step_argument_formatter_1.formatStepArgument)(testStep.argument);
|
|
64
|
+
text += (0, indent_string_1.default)(`${colorFn(argumentsText)}\n`, 4);
|
|
65
|
+
}
|
|
66
|
+
if ((0, value_checker_1.valueOrDefault)(printAttachments, true)) {
|
|
67
|
+
attachments.forEach(({ body, mediaType }) => {
|
|
68
|
+
const message = mediaType === 'text/plain' ? `: ${body}` : '';
|
|
69
|
+
text += (0, indent_string_1.default)(`Attachment (${mediaType})${message}\n`, 4);
|
|
70
|
+
});
|
|
65
71
|
}
|
|
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
72
|
const message = getStepMessage(testStep);
|
|
71
73
|
if (message !== '') {
|
|
72
|
-
text += `${indent_string_1.default(colorFn(message), 4)}\n`;
|
|
74
|
+
text += `${(0, indent_string_1.default)(colorFn(message), 4)}\n`;
|
|
73
75
|
}
|
|
74
76
|
return text;
|
|
75
77
|
}
|
|
76
|
-
function formatTestCaseAttempt({ colorFns,
|
|
77
|
-
const parsed = test_case_attempt_parser_1.parseTestCaseAttempt({
|
|
78
|
-
cwd,
|
|
78
|
+
function formatTestCaseAttempt({ colorFns, snippetBuilder, supportCodeLibrary, testCaseAttempt, printAttachments, }) {
|
|
79
|
+
const parsed = (0, test_case_attempt_parser_1.parseTestCaseAttempt)({
|
|
79
80
|
snippetBuilder,
|
|
80
81
|
testCaseAttempt,
|
|
81
82
|
supportCodeLibrary,
|
|
82
83
|
});
|
|
83
84
|
let text = `Scenario: ${parsed.testCase.name}`;
|
|
84
|
-
text += getAttemptText(parsed.testCase.attempt,
|
|
85
|
-
text += ` # ${colorFns.location(location_helpers_1.formatLocation(parsed.testCase.sourceLocation))}\n`;
|
|
85
|
+
text += getAttemptText(parsed.testCase.attempt, testCaseAttempt.willBeRetried);
|
|
86
|
+
text += ` # ${colorFns.location((0, location_helpers_1.formatLocation)(parsed.testCase.sourceLocation))}\n`;
|
|
86
87
|
parsed.testSteps.forEach((testStep) => {
|
|
87
|
-
text += formatStep({ colorFns, testStep });
|
|
88
|
+
text += formatStep({ colorFns, testStep, printAttachments });
|
|
88
89
|
});
|
|
89
90
|
return `${text}\n`;
|
|
90
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_case_attempt_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAwC;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,SAA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CAAC,CAAA;IACF,OAAO,GAAG,IAAI,IAAI,CAAA;AACpB,CAAC;AArBD,sDAqBC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,aAAsB;IAC7D,IAAI,OAAO,GAAG,CAAC,IAAI,aAAa,EAAE;QAChC,MAAM,SAAS,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;QAC1C,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;QACnD,OAAO,aAAa,SAAS,GAAG,UAAU,GAAG,CAAA;KAC9C;IACD,OAAO,EAAE,CAAA;AACX,CAAC","sourcesContent":["import indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport figures from 'figures'\nimport { formatLocation } from './location_helpers'\nimport {\n IParsedTestStep,\n parseTestCaseAttempt,\n} from './test_case_attempt_parser'\nimport { formatStepArgument } from './step_argument_formatter'\nimport { IColorFns } from '../get_color_fns'\nimport { doesHaveValue, valueOrDefault } from '../../value_checker'\nimport { ITestCaseAttempt } from './event_data_collector'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\n\nconst CHARACTERS: Map<messages.TestStepResultStatus, string> = new Map([\n [messages.TestStepResultStatus.AMBIGUOUS, figures.cross],\n [messages.TestStepResultStatus.FAILED, figures.cross],\n [messages.TestStepResultStatus.PASSED, figures.tick],\n [messages.TestStepResultStatus.PENDING, '?'],\n [messages.TestStepResultStatus.SKIPPED, '-'],\n [messages.TestStepResultStatus.UNDEFINED, '?'],\n])\n\nfunction getStepMessage(testStep: IParsedTestStep): string {\n switch (testStep.result.status) {\n case messages.TestStepResultStatus.AMBIGUOUS:\n case messages.TestStepResultStatus.FAILED:\n return testStep.result.message\n case messages.TestStepResultStatus.UNDEFINED:\n return `${\n 'Undefined. Implement with the following snippet:' + '\\n\\n'\n }${indentString(testStep.snippet, 2)}\\n`\n case messages.TestStepResultStatus.PENDING:\n return 'Pending'\n }\n return ''\n}\n\ninterface IFormatStepRequest {\n colorFns: IColorFns\n testStep: IParsedTestStep\n 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;
|
|
@@ -18,28 +18,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
22
|
exports.parseTestCaseAttempt = void 0;
|
|
26
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
27
23
|
const keyword_type_1 = require("./keyword_type");
|
|
28
24
|
const gherkin_document_parser_1 = require("./gherkin_document_parser");
|
|
29
25
|
const pickle_parser_1 = require("./pickle_parser");
|
|
30
26
|
const messages = __importStar(require("@cucumber/messages"));
|
|
31
27
|
const value_checker_1 = require("../../value_checker");
|
|
28
|
+
const messages_1 = require("@cucumber/messages");
|
|
32
29
|
function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleStep, pickleUri, snippetBuilder, supportCodeLibrary, testStep, testStepResult, testStepAttachments, }) {
|
|
33
30
|
const out = {
|
|
34
31
|
attachments: testStepAttachments,
|
|
35
|
-
keyword: value_checker_1.doesHaveValue(testStep.pickleStepId)
|
|
32
|
+
keyword: (0, value_checker_1.doesHaveValue)(testStep.pickleStepId)
|
|
36
33
|
? keyword
|
|
37
34
|
: isBeforeHook
|
|
38
35
|
? 'Before'
|
|
39
36
|
: 'After',
|
|
40
37
|
result: testStepResult,
|
|
41
38
|
};
|
|
42
|
-
if (value_checker_1.doesHaveValue(testStep.hookId)) {
|
|
39
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.hookId)) {
|
|
43
40
|
let hookDefinition;
|
|
44
41
|
if (isBeforeHook) {
|
|
45
42
|
hookDefinition = supportCodeLibrary.beforeTestCaseHookDefinitions.find((x) => x.id === testStep.hookId);
|
|
@@ -52,7 +49,7 @@ function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleS
|
|
|
52
49
|
line: hookDefinition.line,
|
|
53
50
|
};
|
|
54
51
|
}
|
|
55
|
-
if (value_checker_1.doesHaveValue(testStep.stepDefinitionIds) &&
|
|
52
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.stepDefinitionIds) &&
|
|
56
53
|
testStep.stepDefinitionIds.length === 1) {
|
|
57
54
|
const stepDefinition = supportCodeLibrary.stepDefinitions.find((x) => x.id === testStep.stepDefinitionIds[0]);
|
|
58
55
|
out.actionLocation = {
|
|
@@ -60,13 +57,13 @@ function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleS
|
|
|
60
57
|
line: stepDefinition.line,
|
|
61
58
|
};
|
|
62
59
|
}
|
|
63
|
-
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
|
|
60
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
|
|
64
61
|
out.sourceLocation = {
|
|
65
62
|
uri: pickleUri,
|
|
66
63
|
line: gherkinStepMap[pickleStep.astNodeIds[0]].location.line,
|
|
67
64
|
};
|
|
68
65
|
out.text = pickleStep.text;
|
|
69
|
-
if (value_checker_1.doesHaveValue(pickleStep.argument)) {
|
|
66
|
+
if ((0, value_checker_1.doesHaveValue)(pickleStep.argument)) {
|
|
70
67
|
out.argument = pickleStep.argument;
|
|
71
68
|
}
|
|
72
69
|
}
|
|
@@ -77,32 +74,32 @@ function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleS
|
|
|
77
74
|
}
|
|
78
75
|
// Converts a testCaseAttempt into a json object with all data needed for
|
|
79
76
|
// displaying it in a pretty format
|
|
80
|
-
function parseTestCaseAttempt({
|
|
77
|
+
function parseTestCaseAttempt({ testCaseAttempt, snippetBuilder, supportCodeLibrary, }) {
|
|
81
78
|
const { testCase, pickle, gherkinDocument } = testCaseAttempt;
|
|
82
|
-
const gherkinStepMap = gherkin_document_parser_1.getGherkinStepMap(gherkinDocument);
|
|
83
|
-
const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
|
|
84
|
-
const pickleStepMap = pickle_parser_1.getPickleStepMap(pickle);
|
|
79
|
+
const gherkinStepMap = (0, gherkin_document_parser_1.getGherkinStepMap)(gherkinDocument);
|
|
80
|
+
const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
|
|
81
|
+
const pickleStepMap = (0, pickle_parser_1.getPickleStepMap)(pickle);
|
|
85
82
|
const relativePickleUri = pickle.uri;
|
|
86
83
|
const parsedTestCase = {
|
|
87
84
|
attempt: testCaseAttempt.attempt,
|
|
88
85
|
name: pickle.name,
|
|
89
86
|
sourceLocation: {
|
|
90
87
|
uri: relativePickleUri,
|
|
91
|
-
line: gherkinScenarioLocationMap[
|
|
88
|
+
line: gherkinScenarioLocationMap[pickle.astNodeIds[pickle.astNodeIds.length - 1]].line,
|
|
92
89
|
},
|
|
93
90
|
worstTestStepResult: testCaseAttempt.worstTestStepResult,
|
|
94
91
|
};
|
|
95
92
|
const parsedTestSteps = [];
|
|
96
93
|
let isBeforeHook = true;
|
|
97
94
|
let previousKeywordType = keyword_type_1.KeywordType.Precondition;
|
|
98
|
-
|
|
99
|
-
const testStepResult = testCaseAttempt.stepResults[testStep.id];
|
|
100
|
-
isBeforeHook = isBeforeHook && value_checker_1.doesHaveValue(testStep.hookId);
|
|
95
|
+
testCase.testSteps.forEach((testStep) => {
|
|
96
|
+
const testStepResult = testCaseAttempt.stepResults[testStep.id] || new messages_1.TestStepResult();
|
|
97
|
+
isBeforeHook = isBeforeHook && (0, value_checker_1.doesHaveValue)(testStep.hookId);
|
|
101
98
|
let keyword, keywordType, pickleStep;
|
|
102
|
-
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
|
|
99
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
|
|
103
100
|
pickleStep = pickleStepMap[testStep.pickleStepId];
|
|
104
|
-
keyword = pickle_parser_1.getStepKeyword({ pickleStep, gherkinStepMap });
|
|
105
|
-
keywordType = keyword_type_1.getStepKeywordType({
|
|
101
|
+
keyword = (0, pickle_parser_1.getStepKeyword)({ pickleStep, gherkinStepMap });
|
|
102
|
+
keywordType = (0, keyword_type_1.getStepKeywordType)({
|
|
106
103
|
keyword,
|
|
107
104
|
language: gherkinDocument.feature.language,
|
|
108
105
|
previousKeywordType,
|
|
@@ -119,7 +116,7 @@ function parseTestCaseAttempt({ cwd, testCaseAttempt, snippetBuilder, supportCod
|
|
|
119
116
|
supportCodeLibrary,
|
|
120
117
|
testStep,
|
|
121
118
|
testStepResult,
|
|
122
|
-
testStepAttachments: value_checker_1.valueOrDefault(testCaseAttempt.stepAttachments[testStep.id], []),
|
|
119
|
+
testStepAttachments: (0, value_checker_1.valueOrDefault)(testCaseAttempt.stepAttachments[testStep.id], []),
|
|
123
120
|
});
|
|
124
121
|
parsedTestSteps.push(parsedStep);
|
|
125
122
|
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,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,YAAY;gBACd,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,OAAO;QACX,MAAM,EAAE,cAAc;KACvB,CAAA;IACD,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAClC,IAAI,cAAsC,CAAA;QAC1C,IAAI,YAAY,EAAE;YAChB,cAAc,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,IAAI,CACpE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,MAAM,CAChC,CAAA;SACF;aAAM;YACL,cAAc,GAAG,kBAAkB,CAAC,4BAA4B,CAAC,IAAI,CACnE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,MAAM,CAChC,CAAA;SACF;QACD,GAAG,CAAC,cAAc,GAAG;YACnB,GAAG,EAAE,cAAc,CAAC,GAAG;YACvB,IAAI,EAAE,cAAc,CAAC,IAAI;SAC1B,CAAA;KACF;IACD,IACE,IAAA,6BAAa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AC,QAAQ;gBAC1C,mBAAmB;aACpB,CAAC,CAAA;SACH;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;AAjED,oDAiEC","sourcesContent":["import { 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[];
|
|
@@ -18,23 +18,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
22
|
-
var t = {};
|
|
23
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
-
t[p] = s[p];
|
|
25
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
-
t[p[i]] = s[p[i]];
|
|
29
|
-
}
|
|
30
|
-
return t;
|
|
31
|
-
};
|
|
32
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
|
-
};
|
|
35
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
22
|
exports.getUsage = void 0;
|
|
37
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
38
23
|
const pickle_parser_1 = require("../pickle_parser");
|
|
39
24
|
const gherkin_document_parser_1 = require("../gherkin_document_parser");
|
|
40
25
|
const messages = __importStar(require("@cucumber/messages"));
|
|
@@ -58,13 +43,13 @@ const unexecutedStatuses = [
|
|
|
58
43
|
messages.TestStepResultStatus.SKIPPED,
|
|
59
44
|
messages.TestStepResultStatus.UNDEFINED,
|
|
60
45
|
];
|
|
61
|
-
function buildMapping({
|
|
46
|
+
function buildMapping({ stepDefinitions, eventDataCollector, }) {
|
|
62
47
|
const mapping = buildEmptyMapping(stepDefinitions);
|
|
63
|
-
|
|
64
|
-
const pickleStepMap = pickle_parser_1.getPickleStepMap(testCaseAttempt.pickle);
|
|
65
|
-
const gherkinStepMap = gherkin_document_parser_1.getGherkinStepMap(testCaseAttempt.gherkinDocument);
|
|
48
|
+
eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {
|
|
49
|
+
const pickleStepMap = (0, pickle_parser_1.getPickleStepMap)(testCaseAttempt.pickle);
|
|
50
|
+
const gherkinStepMap = (0, gherkin_document_parser_1.getGherkinStepMap)(testCaseAttempt.gherkinDocument);
|
|
66
51
|
testCaseAttempt.testCase.testSteps.forEach((testStep) => {
|
|
67
|
-
if (value_checker_1.doesHaveValue(testStep.pickleStepId) &&
|
|
52
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId) &&
|
|
68
53
|
testStep.stepDefinitionIds.length === 1) {
|
|
69
54
|
const stepDefinitionId = testStep.stepDefinitionIds[0];
|
|
70
55
|
const pickleStep = pickleStepMap[testStep.pickleStepId];
|
|
@@ -75,10 +60,10 @@ function buildMapping({ cwd, stepDefinitions, eventDataCollector, }) {
|
|
|
75
60
|
uri: testCaseAttempt.pickle.uri,
|
|
76
61
|
};
|
|
77
62
|
const { duration, status } = testCaseAttempt.stepResults[testStep.id];
|
|
78
|
-
if (!unexecutedStatuses.includes(status) && value_checker_1.doesHaveValue(duration)) {
|
|
63
|
+
if (!unexecutedStatuses.includes(status) && (0, value_checker_1.doesHaveValue)(duration)) {
|
|
79
64
|
match.duration = duration;
|
|
80
65
|
}
|
|
81
|
-
if (value_checker_1.doesHaveValue(mapping[stepDefinitionId])) {
|
|
66
|
+
if ((0, value_checker_1.doesHaveValue)(mapping[stepDefinitionId])) {
|
|
82
67
|
mapping[stepDefinitionId].matches.push(match);
|
|
83
68
|
}
|
|
84
69
|
}
|
|
@@ -86,35 +71,36 @@ function buildMapping({ cwd, stepDefinitions, eventDataCollector, }) {
|
|
|
86
71
|
});
|
|
87
72
|
return mapping;
|
|
88
73
|
}
|
|
89
|
-
function
|
|
90
|
-
if (
|
|
91
|
-
return
|
|
74
|
+
function normalizeDuration(duration) {
|
|
75
|
+
if (duration == null) {
|
|
76
|
+
return Number.MIN_SAFE_INTEGER;
|
|
92
77
|
}
|
|
93
|
-
return
|
|
78
|
+
return messages.TimeConversion.durationToMilliseconds(duration);
|
|
94
79
|
}
|
|
95
80
|
function buildResult(mapping) {
|
|
96
|
-
return
|
|
97
|
-
.map((
|
|
98
|
-
|
|
99
|
-
const sortedMatches =
|
|
100
|
-
(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
.
|
|
81
|
+
return Object.keys(mapping)
|
|
82
|
+
.map((stepDefinitionId) => {
|
|
83
|
+
const { matches, ...rest } = mapping[stepDefinitionId];
|
|
84
|
+
const sortedMatches = matches.sort((a, b) => {
|
|
85
|
+
if (a.duration === b.duration) {
|
|
86
|
+
return a.text < b.text ? -1 : 1;
|
|
87
|
+
}
|
|
88
|
+
return normalizeDuration(b.duration) - normalizeDuration(a.duration);
|
|
89
|
+
});
|
|
90
|
+
const result = { matches: sortedMatches, ...rest };
|
|
91
|
+
const durations = matches
|
|
92
|
+
.filter((m) => m.duration != null)
|
|
93
|
+
.map((m) => m.duration);
|
|
108
94
|
if (durations.length > 0) {
|
|
109
|
-
|
|
95
|
+
const totalMilliseconds = durations.reduce((acc, x) => acc + messages.TimeConversion.durationToMilliseconds(x), 0);
|
|
96
|
+
result.meanDuration = messages.TimeConversion.millisecondsToDuration(totalMilliseconds / durations.length);
|
|
110
97
|
}
|
|
111
98
|
return result;
|
|
112
99
|
})
|
|
113
|
-
.
|
|
114
|
-
.value();
|
|
100
|
+
.sort((a, b) => normalizeDuration(b.meanDuration) - normalizeDuration(a.meanDuration));
|
|
115
101
|
}
|
|
116
|
-
function getUsage({
|
|
117
|
-
const mapping = buildMapping({
|
|
102
|
+
function getUsage({ stepDefinitions, eventDataCollector, }) {
|
|
103
|
+
const mapping = buildMapping({ stepDefinitions, eventDataCollector });
|
|
118
104
|
return buildResult(mapping);
|
|
119
105
|
}
|
|
120
106
|
exports.getUsage = getUsage;
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAmD;AACnD,wEAA8D;AAC9D,6DAA8C;AAE9C,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,QAAQ,CAAC,oBAAoB,CAAC,SAAS;IACvC,QAAQ,CAAC,oBAAoB,CAAC,OAAO;IACrC,QAAQ,CAAC,o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IAAI,CAAC;aACjC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;QACzB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,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;SACF;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;AAND,4BAMC","sourcesContent":["import { getPickleStepMap } from '../pickle_parser'\nimport { getGherkinStepMap } from '../gherkin_document_parser'\nimport * as messages from '@cucumber/messages'\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"]}
|
|
@@ -12,17 +12,17 @@ const util_1 = require("util");
|
|
|
12
12
|
class HtmlFormatter extends _1.default {
|
|
13
13
|
constructor(options) {
|
|
14
14
|
super(options);
|
|
15
|
-
const cucumberHtmlStream = new html_formatter_1.default(resolve_pkg_1.default('@cucumber/html-formatter', { cwd: __dirname }) +
|
|
16
|
-
'/dist/main.css', resolve_pkg_1.default('@cucumber/html-formatter', { cwd: __dirname }) +
|
|
15
|
+
const cucumberHtmlStream = new html_formatter_1.default((0, resolve_pkg_1.default)('@cucumber/html-formatter', { cwd: __dirname }) +
|
|
16
|
+
'/dist/main.css', (0, resolve_pkg_1.default)('@cucumber/html-formatter', { cwd: __dirname }) +
|
|
17
17
|
'/dist/main.js');
|
|
18
18
|
options.eventBroadcaster.on('envelope', (envelope) => {
|
|
19
19
|
cucumberHtmlStream.write(envelope);
|
|
20
|
-
if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
|
|
20
|
+
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
|
|
21
21
|
cucumberHtmlStream.end();
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
cucumberHtmlStream.on('data', (chunk) => this.log(chunk));
|
|
25
|
-
this._finished = util_1.promisify(stream_1.finished)(cucumberHtmlStream);
|
|
25
|
+
this._finished = (0, util_1.promisify)(stream_1.finished)(cucumberHtmlStream);
|
|
26
26
|
}
|
|
27
27
|
async finished() {
|
|
28
28
|
await this._finished;
|
|
@@ -30,4 +30,5 @@ class HtmlFormatter extends _1.default {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.default = HtmlFormatter;
|
|
33
|
+
HtmlFormatter.documentation = 'Outputs HTML report';
|
|
33
34
|
//# sourceMappingURL=html_formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html_formatter.js","sourceRoot":"","sources":["../../src/formatter/html_formatter.ts"],"names":[],"mappings":";;;;;AAAA,yCAAgD;AAEhD,8DAAoC;AACpC,8EAAyD;AACzD,oDAAgD;AAChD,mCAAiC;AACjC,+BAAgC;AAEhC,MAAqB,aAAc,SAAQ,UAAS;
|
|
1
|
+
{"version":3,"file":"html_formatter.js","sourceRoot":"","sources":["../../src/formatter/html_formatter.ts"],"names":[],"mappings":";;;;;AAAA,yCAAgD;AAEhD,8DAAoC;AACpC,8EAAyD;AACzD,oDAAgD;AAChD,mCAAiC;AACjC,+BAAgC;AAEhC,MAAqB,aAAc,SAAQ,UAAS;IAIlD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,MAAM,kBAAkB,GAAG,IAAI,wBAAkB,CAC/C,IAAA,qBAAU,EAAC,0BAA0B,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YACxD,gBAAgB,EAClB,IAAA,qBAAU,EAAC,0BAA0B,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YACxD,eAAe,CAClB,CAAA;QACD,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE;YACtE,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;YAClC,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,kBAAkB,CAAC,GAAG,EAAE,CAAA;aACzB;QACH,CAAC,CAAC,CAAA;QACF,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;QACzD,IAAI,CAAC,SAAS,GAAG,IAAA,gBAAS,EAAC,iBAAQ,CAAC,CAAC,kBAAkB,CAAC,CAAA;IAC1D,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,SAAS,CAAA;QACpB,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAA;IACxB,CAAC;;AAzBH,gCA0BC;AAxBwB,2BAAa,GAAW,qBAAqB,CAAA","sourcesContent":["import Formatter, { IFormatterOptions } from '.'\nimport * as messages from '@cucumber/messages'\nimport resolvePkg from 'resolve-pkg'\nimport CucumberHtmlStream from '@cucumber/html-formatter'\nimport { doesHaveValue } from '../value_checker'\nimport { finished } from 'stream'\nimport { promisify } from 'util'\n\nexport default class HtmlFormatter extends Formatter {\n private readonly _finished: Promise<void>\n public static readonly documentation: string = 'Outputs HTML report'\n\n constructor(options: IFormatterOptions) {\n super(options)\n const cucumberHtmlStream = new CucumberHtmlStream(\n resolvePkg('@cucumber/html-formatter', { cwd: __dirname }) +\n '/dist/main.css',\n resolvePkg('@cucumber/html-formatter', { cwd: __dirname }) +\n '/dist/main.js'\n )\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n cucumberHtmlStream.write(envelope)\n if (doesHaveValue(envelope.testRunFinished)) {\n cucumberHtmlStream.end()\n }\n })\n cucumberHtmlStream.on('data', (chunk) => this.log(chunk))\n this._finished = promisify(finished)(cucumberHtmlStream)\n }\n\n async finished(): Promise<void> {\n await this._finished\n await super.finished()\n }\n}\n"]}
|