@cucumber/cucumber 7.2.0 → 7.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/lib/cli/argv_parser.d.ts +0 -1
  2. package/lib/cli/argv_parser.js +0 -1
  3. package/lib/cli/argv_parser.js.map +1 -1
  4. package/lib/cli/configuration_builder.d.ts +0 -1
  5. package/lib/cli/configuration_builder.js +5 -5
  6. package/lib/cli/configuration_builder.js.map +1 -1
  7. package/lib/cli/helpers.js +41 -22
  8. package/lib/cli/helpers.js.map +1 -1
  9. package/lib/cli/index.d.ts +1 -3
  10. package/lib/cli/index.js +27 -30
  11. package/lib/cli/index.js.map +1 -1
  12. package/lib/cli/profile_loader.d.ts +2 -5
  13. package/lib/cli/profile_loader.js +2 -3
  14. package/lib/cli/profile_loader.js.map +1 -1
  15. package/lib/cli/publish_banner.js +1 -1
  16. package/lib/cli/publish_banner.js.map +1 -1
  17. package/lib/formatter/builder.d.ts +4 -8
  18. package/lib/formatter/builder.js +17 -32
  19. package/lib/formatter/builder.js.map +1 -1
  20. package/lib/formatter/get_color_fns.d.ts +6 -2
  21. package/lib/formatter/get_color_fns.js +18 -12
  22. package/lib/formatter/get_color_fns.js.map +1 -1
  23. package/lib/formatter/helpers/event_data_collector.d.ts +14 -17
  24. package/lib/formatter/helpers/event_data_collector.js +14 -8
  25. package/lib/formatter/helpers/event_data_collector.js.map +1 -1
  26. package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -6
  27. package/lib/formatter/helpers/gherkin_document_parser.js +1 -4
  28. package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
  29. package/lib/formatter/helpers/issue_helpers.d.ts +6 -6
  30. package/lib/formatter/helpers/issue_helpers.js +5 -6
  31. package/lib/formatter/helpers/issue_helpers.js.map +1 -1
  32. package/lib/formatter/helpers/pickle_parser.d.ts +9 -10
  33. package/lib/formatter/helpers/pickle_parser.js.map +1 -1
  34. package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -2
  35. package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
  36. package/lib/formatter/helpers/summary_helpers.d.ts +2 -2
  37. package/lib/formatter/helpers/summary_helpers.js +32 -14
  38. package/lib/formatter/helpers/summary_helpers.js.map +1 -1
  39. package/lib/formatter/helpers/test_case_attempt_formatter.js +33 -14
  40. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
  41. package/lib/formatter/helpers/test_case_attempt_parser.d.ts +5 -5
  42. package/lib/formatter/helpers/test_case_attempt_parser.js +27 -9
  43. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
  44. package/lib/formatter/helpers/usage_helpers/index.d.ts +3 -3
  45. package/lib/formatter/helpers/usage_helpers/index.js +44 -15
  46. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
  47. package/lib/formatter/html_formatter.js +1 -1
  48. package/lib/formatter/html_formatter.js.map +1 -1
  49. package/lib/formatter/http_stream.js +1 -1
  50. package/lib/formatter/http_stream.js.map +1 -1
  51. package/lib/formatter/json_formatter.d.ts +21 -27
  52. package/lib/formatter/json_formatter.js +50 -23
  53. package/lib/formatter/json_formatter.js.map +1 -1
  54. package/lib/formatter/message_formatter.js +1 -1
  55. package/lib/formatter/message_formatter.js.map +1 -1
  56. package/lib/formatter/progress_bar_formatter.d.ts +6 -6
  57. package/lib/formatter/progress_bar_formatter.js +3 -3
  58. package/lib/formatter/progress_bar_formatter.js.map +1 -1
  59. package/lib/formatter/progress_formatter.d.ts +2 -2
  60. package/lib/formatter/progress_formatter.js +29 -10
  61. package/lib/formatter/progress_formatter.js.map +1 -1
  62. package/lib/formatter/rerun_formatter.js +22 -4
  63. package/lib/formatter/rerun_formatter.js.map +1 -1
  64. package/lib/formatter/snippets_formatter.js +21 -2
  65. package/lib/formatter/snippets_formatter.js.map +1 -1
  66. package/lib/formatter/step_definition_snippet_builder/index.d.ts +3 -3
  67. package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
  68. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
  69. package/lib/formatter/summary_formatter.d.ts +2 -2
  70. package/lib/formatter/summary_formatter.js.map +1 -1
  71. package/lib/formatter/usage_formatter.js +22 -3
  72. package/lib/formatter/usage_formatter.js.map +1 -1
  73. package/lib/formatter/usage_json_formatter.js.map +1 -1
  74. package/lib/index.d.ts +14 -12
  75. package/lib/index.js +3 -3
  76. package/lib/index.js.map +1 -1
  77. package/lib/models/data_table.d.ts +3 -4
  78. package/lib/models/data_table.js.map +1 -1
  79. package/lib/models/definition.d.ts +2 -2
  80. package/lib/models/definition.js.map +1 -1
  81. package/lib/models/test_case_hook_definition.d.ts +2 -2
  82. package/lib/models/test_case_hook_definition.js.map +1 -1
  83. package/lib/models/test_step_hook_definition.d.ts +2 -2
  84. package/lib/models/test_step_hook_definition.js.map +1 -1
  85. package/lib/pickle_filter.d.ts +9 -11
  86. package/lib/pickle_filter.js +4 -4
  87. package/lib/pickle_filter.js.map +1 -1
  88. package/lib/runtime/assemble_test_cases.d.ts +13 -0
  89. package/lib/runtime/assemble_test_cases.js +88 -0
  90. package/lib/runtime/assemble_test_cases.js.map +1 -0
  91. package/lib/runtime/attachment_manager/index.d.ts +2 -2
  92. package/lib/runtime/attachment_manager/index.js +23 -4
  93. package/lib/runtime/attachment_manager/index.js.map +1 -1
  94. package/lib/runtime/helpers.d.ts +2 -2
  95. package/lib/runtime/helpers.js.map +1 -1
  96. package/lib/runtime/index.d.ts +4 -3
  97. package/lib/runtime/index.js +31 -13
  98. package/lib/runtime/index.js.map +1 -1
  99. package/lib/runtime/parallel/command_types.d.ts +10 -9
  100. package/lib/runtime/parallel/command_types.js.map +1 -1
  101. package/lib/runtime/parallel/coordinator.d.ts +10 -9
  102. package/lib/runtime/parallel/coordinator.js +54 -43
  103. package/lib/runtime/parallel/coordinator.js.map +1 -1
  104. package/lib/runtime/parallel/worker.d.ts +2 -2
  105. package/lib/runtime/parallel/worker.js +8 -14
  106. package/lib/runtime/parallel/worker.js.map +1 -1
  107. package/lib/runtime/step_runner.d.ts +3 -3
  108. package/lib/runtime/step_runner.js +16 -12
  109. package/lib/runtime/step_runner.js.map +1 -1
  110. package/lib/runtime/stopwatch.d.ts +4 -4
  111. package/lib/runtime/stopwatch.js +21 -2
  112. package/lib/runtime/stopwatch.js.map +1 -1
  113. package/lib/runtime/{pickle_runner.d.ts → test_case_runner.d.ts} +16 -32
  114. package/lib/runtime/{pickle_runner.js → test_case_runner.js} +104 -147
  115. package/lib/runtime/test_case_runner.js.map +1 -0
  116. package/lib/step_arguments.d.ts +4 -4
  117. package/lib/step_arguments.js.map +1 -1
  118. package/lib/support_code_library_builder/index.d.ts +9 -7
  119. package/lib/support_code_library_builder/index.js +11 -10
  120. package/lib/support_code_library_builder/index.js.map +1 -1
  121. package/lib/support_code_library_builder/types.d.ts +21 -23
  122. package/lib/support_code_library_builder/types.js.map +1 -1
  123. package/lib/support_code_library_builder/validate_arguments.js +8 -8
  124. package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
  125. package/lib/support_code_library_builder/world.d.ts +7 -1
  126. package/lib/support_code_library_builder/world.js.map +1 -1
  127. package/lib/time.d.ts +2 -10
  128. package/lib/time.js +24 -48
  129. package/lib/time.js.map +1 -1
  130. package/package.json +38 -40
  131. package/CHANGELOG.md +0 -1874
  132. package/lib/importers.js +0 -17
  133. package/lib/runtime/pickle_runner.js.map +0 -1
  134. package/lib/status.d.ts +0 -3
  135. package/lib/status.js +0 -5
  136. package/lib/status.js.map +0 -1
  137. package/lib/wrapper.mjs +0 -38
@@ -1 +1 @@
1
- {"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;AACxC,0DAAiC;AACjC,+EAAqE;AAQrE,SAAgB,SAAS,CACvB,MAAiD;IAEjD,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,gBAAM,CAAC,SAAS;QAClC,M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AA6B,CAC3C,uBAA2D;IAE3D,MAAM,MAAM,GAAG,CAAC,gCAAgC,CAAC,CAAA;IACjD,MAAM,UAAU,GAAiD,EAAE,CAAA;IACnE,uBAAuB,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;QAChD,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAA;IAChD,CAAC,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;SACtB,GAAG,CACF,CAAC,aAAa,EAAE,EAAE,CAAC,KAAK,4BAA4B,CAAC,aAAa,CAAC,EAAE,CACtE;SACA,IAAI,CAAC,IAAI,CAAC,CACd,CAAA;IACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACnB,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxB,CAAC;AAjBD,sEAiBC;AAED,SAAgB,4BAA4B,CAC1C,aAA+C;IAE/C,OAAO,IAAI,aAAa,CAAC,IAAI,YAAY,aAAa,CAAC,UAAU,IAAI,CAAA;AACvE,CAAC;AAJD,oEAIC","sourcesContent":["import indentString from 'indent-string'\nimport Status from '../../status'\nimport { formatTestCaseAttempt } from './test_case_attempt_formatter'\nimport { messages } from '@cucumber/messages'\nimport { IColorFns } from '../get_color_fns'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { ITestCaseAttempt } from './event_data_collector'\nimport { Dictionary } from 'lodash'\n\nexport function isFailure(\n result: messages.TestStepFinished.ITestStepResult\n): boolean {\n return (\n result.status === Status.AMBIGUOUS ||\n result.status === Status.UNDEFINED ||\n (result.status === Status.FAILED && !result.willBeRetried)\n )\n}\n\nexport function isWarning(\n result: messages.TestStepFinished.ITestStepResult\n): boolean {\n return (\n result.status === Status.PENDING ||\n (result.status === Status.FAILED && result.willBeRetried)\n )\n}\n\nexport function isIssue(\n result: messages.TestStepFinished.ITestStepResult\n): boolean {\n return isFailure(result) || isWarning(result)\n}\n\nexport interface IFormatIssueRequest {\n colorFns: IColorFns\n cwd: string\n number: number\n snippetBuilder: StepDefinitionSnippetBuilder\n testCaseAttempt: ITestCaseAttempt\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport function formatIssue({\n colorFns,\n cwd,\n number,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n}: IFormatIssueRequest): string {\n const prefix = `${number.toString()}) `\n const formattedTestCaseAttempt = formatTestCaseAttempt({\n colorFns,\n cwd,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n })\n const lines = formattedTestCaseAttempt.split('\\n')\n const updatedLines = lines.map((line, index) => {\n if (index === 0) {\n return `${prefix}${line}`\n }\n return indentString(line, prefix.length)\n })\n return updatedLines.join('\\n')\n}\n\nexport function formatUndefinedParameterTypes(\n undefinedParameterTypes: messages.IUndefinedParameterType[]\n): string {\n const output = [`Undefined parameter types:\\n\\n`]\n const withLatest: Dictionary<messages.IUndefinedParameterType> = {}\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.IUndefinedParameterType\n): string {\n return `\"${parameterType.name}\" e.g. \\`${parameterType.expression}\\``\n}\n"]}
1
+ {"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;AACxC,+EAAqE;AAOrE,SAAgB,SAAS,CAAC,MAA+B;IACvD,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,MAA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CAAC,aAAa,EAAE,EAAE;QAChD,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAA;IAChD,CAAC,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;SACtB,GAAG,CACF,CAAC,aAAa,EAAE,EAAE,CAAC,KAAK,4BAA4B,CAAC,aAAa,CAAC,EAAE,CACtE;SACA,IAAI,CAAC,IAAI,CAAC,CACd,CAAA;IACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACnB,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxB,CAAC;AAjBD,sEAiBC;AAED,SAAgB,4BAA4B,CAC1C,aAA8C;IAE9C,OAAO,IAAI,aAAa,CAAC,IAAI,YAAY,aAAa,CAAC,UAAU,IAAI,CAAA;AACvE,CAAC;AAJD,oEAIC","sourcesContent":["import indentString from 'indent-string'\nimport { formatTestCaseAttempt } from './test_case_attempt_formatter'\nimport * as messages from '@cucumber/messages'\nimport { IColorFns } from '../get_color_fns'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { ITestCaseAttempt } from './event_data_collector'\n\nexport function isFailure(result: messages.TestStepResult): boolean {\n return (\n result.status === 'AMBIGUOUS' ||\n result.status === 'UNDEFINED' ||\n (result.status === 'FAILED' && !result.willBeRetried)\n )\n}\n\nexport function isWarning(result: messages.TestStepResult): boolean {\n return (\n result.status === 'PENDING' ||\n (result.status === 'FAILED' && result.willBeRetried)\n )\n}\n\nexport function isIssue(result: messages.TestStepResult): boolean {\n return isFailure(result) || isWarning(result)\n}\n\nexport interface IFormatIssueRequest {\n colorFns: IColorFns\n cwd: string\n number: number\n snippetBuilder: StepDefinitionSnippetBuilder\n testCaseAttempt: ITestCaseAttempt\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport function formatIssue({\n colorFns,\n cwd,\n number,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n}: IFormatIssueRequest): string {\n const prefix = `${number.toString()}) `\n const formattedTestCaseAttempt = formatTestCaseAttempt({\n colorFns,\n cwd,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n })\n const lines = formattedTestCaseAttempt.split('\\n')\n const updatedLines = lines.map((line, index) => {\n if (index === 0) {\n return `${prefix}${line}`\n }\n return indentString(line, prefix.length)\n })\n return updatedLines.join('\\n')\n}\n\nexport function formatUndefinedParameterTypes(\n undefinedParameterTypes: messages.UndefinedParameterType[]\n): string {\n const output = [`Undefined parameter types:\\n\\n`]\n const withLatest: Record<string, messages.UndefinedParameterType> = {}\n undefinedParameterTypes.forEach((parameterType) => {\n withLatest[parameterType.name] = parameterType\n })\n output.push(\n Object.values(withLatest)\n .map(\n (parameterType) => `- ${formatUndefinedParameterType(parameterType)}`\n )\n .join('\\n')\n )\n output.push('\\n\\n')\n return output.join('')\n}\n\nexport function formatUndefinedParameterType(\n parameterType: messages.UndefinedParameterType\n): string {\n return `\"${parameterType.name}\" e.g. \\`${parameterType.expression}\\``\n}\n"]}
@@ -1,18 +1,17 @@
1
- import { Dictionary } from 'lodash';
2
- import { messages } from '@cucumber/messages';
1
+ import * as messages from '@cucumber/messages';
3
2
  export interface IGetPickleLocationRequest {
4
- gherkinDocument: messages.IGherkinDocument;
5
- pickle: messages.IPickle;
3
+ gherkinDocument: messages.GherkinDocument;
4
+ pickle: messages.Pickle;
6
5
  }
7
6
  export interface IGetStepKeywordRequest {
8
- pickleStep: messages.Pickle.IPickleStep;
9
- gherkinStepMap: Dictionary<messages.GherkinDocument.Feature.IStep>;
7
+ pickleStep: messages.PickleStep;
8
+ gherkinStepMap: Record<string, messages.Step>;
10
9
  }
11
10
  export interface IGetScenarioDescriptionRequest {
12
- pickle: messages.IPickle;
13
- gherkinScenarioMap: Dictionary<messages.GherkinDocument.Feature.IScenario>;
11
+ pickle: messages.Pickle;
12
+ gherkinScenarioMap: Record<string, messages.Scenario>;
14
13
  }
15
14
  export declare function getScenarioDescription({ pickle, gherkinScenarioMap, }: IGetScenarioDescriptionRequest): string;
16
15
  export declare function getStepKeyword({ pickleStep, gherkinStepMap, }: IGetStepKeywordRequest): string;
17
- export declare function getPickleStepMap(pickle: messages.IPickle): Dictionary<messages.Pickle.IPickleStep>;
18
- export declare function getPickleLocation({ gherkinDocument, pickle, }: IGetPickleLocationRequest): messages.ILocation;
16
+ export declare function getPickleStepMap(pickle: messages.Pickle): Record<string, messages.PickleStep>;
17
+ export declare function getPickleLocation({ gherkinDocument, pickle, }: IGetPickleLocationRequest): messages.Location;
@@ -1 +1 @@
1
- {"version":3,"file":"pickle_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/pickle_parser.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsC;AACtC,uEAAyE;AAkBzE,SAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,kBAAkB,GACa;IAC/B,OAAO,gBAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;SAC9B,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;SACnC,OAAO,EAAE;SACT,KAAK,EAAE;SACP,KAAK,EAAE,CAAC,WAAW,CAAA;AACxB,CAAC;AATD,wDASC;AAED,SAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,cAAc,GACS;IACvB,OAAO,gBAAC,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC;SAClC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;SAC/B,OAAO,EAAE;SACT,KAAK,EAAE;SACP,KAAK,EAAE,CAAC,OAAO,CAAA;AACpB,CAAC;AATD,wCASC;AAED,SAAgB,gBAAgB,CAC9B,MAAwB;IAExB,OAAO,gBAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;SACzB,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;SAChD,SAAS,EAAE;SACX,KAAK,EAAE,CAAA;AACZ,CAAC;AAPD,4CAOC;AAED,SAAgB,iBAAiB,CAAC,EAChC,eAAe,EACf,MAAM,GACoB;IAC1B,MAAM,0BAA0B,GAAG,uDAA6B,CAC9D,eAAe,CAChB,CAAA;IACD,OAAO,0BAA0B,CAAC,gBAAC,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;AAC9D,CAAC;AARD,8CAQC","sourcesContent":["import _, { Dictionary } from 'lodash'\nimport { getGherkinScenarioLocationMap } from './gherkin_document_parser'\nimport { messages } from '@cucumber/messages'\n\nexport interface IGetPickleLocationRequest {\n gherkinDocument: messages.IGherkinDocument\n pickle: messages.IPickle\n}\n\nexport interface IGetStepKeywordRequest {\n pickleStep: messages.Pickle.IPickleStep\n gherkinStepMap: Dictionary<messages.GherkinDocument.Feature.IStep>\n}\n\nexport interface IGetScenarioDescriptionRequest {\n pickle: messages.IPickle\n gherkinScenarioMap: Dictionary<messages.GherkinDocument.Feature.IScenario>\n}\n\nexport function getScenarioDescription({\n pickle,\n gherkinScenarioMap,\n}: IGetScenarioDescriptionRequest): string {\n return _.chain(pickle.astNodeIds)\n .map((id) => gherkinScenarioMap[id])\n .compact()\n .first()\n .value().description\n}\n\nexport function getStepKeyword({\n pickleStep,\n gherkinStepMap,\n}: IGetStepKeywordRequest): string {\n return _.chain(pickleStep.astNodeIds)\n .map((id) => gherkinStepMap[id])\n .compact()\n .first()\n .value().keyword\n}\n\nexport function getPickleStepMap(\n pickle: messages.IPickle\n): Dictionary<messages.Pickle.IPickleStep> {\n return _.chain(pickle.steps)\n .map((pickleStep) => [pickleStep.id, pickleStep])\n .fromPairs()\n .value()\n}\n\nexport function getPickleLocation({\n gherkinDocument,\n pickle,\n}: IGetPickleLocationRequest): messages.ILocation {\n const gherkinScenarioLocationMap = getGherkinScenarioLocationMap(\n gherkinDocument\n )\n return gherkinScenarioLocationMap[_.last(pickle.astNodeIds)]\n}\n"]}
1
+ {"version":3,"file":"pickle_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/pickle_parser.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsB;AACtB,uEAAyE;AAkBzE,SAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,kBAAkB,GACa;IAC/B,OAAO,gBAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;SAC9B,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;SACnC,OAAO,EAAE;SACT,KAAK,EAAE;SACP,KAAK,EAAE,CAAC,WAAW,CAAA;AACxB,CAAC;AATD,wDASC;AAED,SAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,cAAc,GACS;IACvB,OAAO,gBAAC,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC;SAClC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;SAC/B,OAAO,EAAE;SACT,KAAK,EAAE;SACP,KAAK,EAAE,CAAC,OAAO,CAAA;AACpB,CAAC;AATD,wCASC;AAED,SAAgB,gBAAgB,CAC9B,MAAuB;IAEvB,OAAO,gBAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;SACzB,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;SAChD,SAAS,EAAE;SACX,KAAK,EAAE,CAAA;AACZ,CAAC;AAPD,4CAOC;AAED,SAAgB,iBAAiB,CAAC,EAChC,eAAe,EACf,MAAM,GACoB;IAC1B,MAAM,0BAA0B,GAC9B,uDAA6B,CAAC,eAAe,CAAC,CAAA;IAChD,OAAO,0BAA0B,CAAC,gBAAC,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;AAC9D,CAAC;AAPD,8CAOC","sourcesContent":["import _ from 'lodash'\nimport { getGherkinScenarioLocationMap } from './gherkin_document_parser'\nimport * as messages from '@cucumber/messages'\n\nexport interface IGetPickleLocationRequest {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n}\n\nexport interface IGetStepKeywordRequest {\n pickleStep: messages.PickleStep\n gherkinStepMap: Record<string, messages.Step>\n}\n\nexport interface IGetScenarioDescriptionRequest {\n pickle: messages.Pickle\n gherkinScenarioMap: Record<string, messages.Scenario>\n}\n\nexport function getScenarioDescription({\n pickle,\n gherkinScenarioMap,\n}: IGetScenarioDescriptionRequest): string {\n return _.chain(pickle.astNodeIds)\n .map((id) => gherkinScenarioMap[id])\n .compact()\n .first()\n .value().description\n}\n\nexport function getStepKeyword({\n pickleStep,\n gherkinStepMap,\n}: IGetStepKeywordRequest): string {\n return _.chain(pickleStep.astNodeIds)\n .map((id) => gherkinStepMap[id])\n .compact()\n .first()\n .value().keyword\n}\n\nexport function getPickleStepMap(\n pickle: messages.Pickle\n): Record<string, messages.PickleStep> {\n return _.chain(pickle.steps)\n .map((pickleStep) => [pickleStep.id, pickleStep])\n .fromPairs()\n .value()\n}\n\nexport function getPickleLocation({\n gherkinDocument,\n pickle,\n}: IGetPickleLocationRequest): messages.Location {\n const gherkinScenarioLocationMap =\n getGherkinScenarioLocationMap(gherkinDocument)\n return gherkinScenarioLocationMap[_.last(pickle.astNodeIds)]\n}\n"]}
@@ -1,2 +1,2 @@
1
- import { messages } from '@cucumber/messages';
2
- export declare function formatStepArgument(arg: messages.IPickleStepArgument): string;
1
+ import * as messages from '@cucumber/messages';
2
+ export declare function formatStepArgument(arg: messages.PickleStepArgument): string;
@@ -1 +1 @@
1
- {"version":3,"file":"step_argument_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/step_argument_formatter.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAC9B,yDAAwD;AAGxD,SAAS,eAAe,CACtB,SAAmD;IAEnD,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,CACtB,SAAuD;IAEvD,OAAO,QAAQ,SAAS,CAAC,OAAO,OAAO,CAAA;AACzC,CAAC;AAED,SAAgB,kBAAkB,CAAC,GAAiC;IAClE,OAAO,kCAAiB,CAAC,GAAG,EAAE;QAC5B,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,eAAe;KAC3B,CAAC,CAAA;AACJ,CAAC;AALD,gDAKC","sourcesContent":["import Table from 'cli-table3'\nimport { parseStepArgument } from '../../step_arguments'\nimport { messages } from '@cucumber/messages'\n\nfunction formatDataTable(\n dataTable: messages.PickleStepArgument.IPickleTable\n): 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(\n docString: messages.PickleStepArgument.IPickleDocString\n): string {\n return `\"\"\"\\n${docString.content}\\n\"\"\"`\n}\n\nexport function formatStepArgument(arg: messages.IPickleStepArgument): string {\n return parseStepArgument(arg, {\n dataTable: formatDataTable,\n docString: formatDocString,\n })\n}\n"]}
1
+ {"version":3,"file":"step_argument_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/step_argument_formatter.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAC9B,yDAAwD;AAGxD,SAAS,eAAe,CAAC,SAA+B;IACtD,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;QACtB,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,aAAa,EAAE,EAAE;YACjB,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,EAAE;YAClB,IAAI,EAAE,GAAG;YACT,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,EAAE;YACf,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,EAAE;SAChB;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,cAAc,EAAE,CAAC;YACjB,eAAe,EAAE,CAAC;SACnB;KACF,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACtC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACrB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACxD,CACF,CAAA;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;IACnB,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAA;AACzB,CAAC;AAED,SAAS,eAAe,CAAC,SAAmC;IAC1D,OAAO,QAAQ,SAAS,CAAC,OAAO,OAAO,CAAA;AACzC,CAAC;AAED,SAAgB,kBAAkB,CAAC,GAAgC;IACjE,OAAO,kCAAiB,CAAC,GAAG,EAAE;QAC5B,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,eAAe;KAC3B,CAAC,CAAA;AACJ,CAAC;AALD,gDAKC","sourcesContent":["import Table from 'cli-table3'\nimport { parseStepArgument } from '../../step_arguments'\nimport * as messages from '@cucumber/messages'\n\nfunction formatDataTable(dataTable: messages.PickleTable): string {\n const table = new Table({\n chars: {\n bottom: '',\n 'bottom-left': '',\n 'bottom-mid': '',\n 'bottom-right': '',\n left: '|',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n middle: '|',\n right: '|',\n 'right-mid': '',\n top: '',\n 'top-left': '',\n 'top-mid': '',\n 'top-right': '',\n },\n style: {\n border: [],\n 'padding-left': 1,\n 'padding-right': 1,\n },\n })\n const rows = dataTable.rows.map((row) =>\n row.cells.map((cell) =>\n cell.value.replace(/\\\\/g, '\\\\\\\\').replace(/\\n/g, '\\\\n')\n )\n )\n table.push(...rows)\n return table.toString()\n}\n\nfunction formatDocString(docString: messages.PickleDocString): string {\n return `\"\"\"\\n${docString.content}\\n\"\"\"`\n}\n\nexport function formatStepArgument(arg: messages.PickleStepArgument): string {\n return parseStepArgument(arg, {\n dataTable: formatDataTable,\n docString: formatDocString,\n })\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import { IColorFns } from '../get_color_fns';
2
2
  import { ITestCaseAttempt } from './event_data_collector';
3
- import { messages } from '@cucumber/messages';
3
+ import * as messages from '@cucumber/messages';
4
4
  export interface IFormatSummaryRequest {
5
5
  colorFns: IColorFns;
6
6
  testCaseAttempts: ITestCaseAttempt[];
7
- testRunDuration: messages.IDuration;
7
+ testRunDuration: messages.Duration;
8
8
  }
9
9
  export declare function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }: IFormatSummaryRequest): string;
@@ -1,4 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
23
  };
@@ -6,29 +25,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
25
  exports.formatSummary = void 0;
7
26
  const lodash_1 = __importDefault(require("lodash"));
8
27
  const duration_1 = __importDefault(require("duration"));
9
- const status_1 = __importDefault(require("../../status"));
10
- const time_1 = require("../../time");
11
- const messages_1 = require("@cucumber/messages");
28
+ const messages = __importStar(require("@cucumber/messages"));
29
+ const value_checker_1 = require("../../value_checker");
12
30
  const STATUS_REPORT_ORDER = [
13
- status_1.default.FAILED,
14
- status_1.default.AMBIGUOUS,
15
- status_1.default.UNDEFINED,
16
- status_1.default.PENDING,
17
- status_1.default.SKIPPED,
18
- status_1.default.PASSED,
31
+ messages.TestStepResultStatus.FAILED,
32
+ messages.TestStepResultStatus.AMBIGUOUS,
33
+ messages.TestStepResultStatus.UNDEFINED,
34
+ messages.TestStepResultStatus.PENDING,
35
+ messages.TestStepResultStatus.SKIPPED,
36
+ messages.TestStepResultStatus.PASSED,
19
37
  ];
20
38
  function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }) {
21
39
  const testCaseResults = [];
22
40
  const testStepResults = [];
23
- let totalStepDuration = time_1.getZeroDuration();
41
+ let totalStepDuration = messages.TimeConversion.millisecondsToDuration(0);
24
42
  testCaseAttempts.forEach(({ testCase, worstTestStepResult, stepResults }) => {
25
43
  Object.values(stepResults).forEach((stepResult) => {
26
- totalStepDuration = time_1.addDurations(totalStepDuration, stepResult.duration);
44
+ totalStepDuration = messages.TimeConversion.addDurations(totalStepDuration, stepResult.duration);
27
45
  });
28
46
  if (!worstTestStepResult.willBeRetried) {
29
47
  testCaseResults.push(worstTestStepResult);
30
48
  lodash_1.default.each(testCase.testSteps, (testStep) => {
31
- if (testStep.pickleStepId !== '') {
49
+ if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
32
50
  testStepResults.push(stepResults[testStep.id]);
33
51
  }
34
52
  });
@@ -56,7 +74,7 @@ function getCountSummary({ colorFns, objects, type, }) {
56
74
  const details = [];
57
75
  STATUS_REPORT_ORDER.forEach((status) => {
58
76
  if (counts[status] > 0) {
59
- details.push(colorFns.forStatus(status)(`${counts[status].toString()} ${status_1.default[status].toLowerCase()}`));
77
+ details.push(colorFns.forStatus(status)(`${counts[status].toString()} ${status.toLowerCase()}`));
60
78
  }
61
79
  });
62
80
  text += ` (${details.join(', ')})`;
@@ -65,7 +83,7 @@ function getCountSummary({ colorFns, objects, type, }) {
65
83
  }
66
84
  function getDurationSummary(durationMsg) {
67
85
  const start = new Date(0);
68
- const end = new Date(messages_1.TimeConversion.durationToMilliseconds(durationMsg));
86
+ const end = new Date(messages.TimeConversion.durationToMilliseconds(durationMsg));
69
87
  const duration = new duration_1.default(start, end);
70
88
  // Use spaces in toString method for readability and to avoid %Ls which is a format
71
89
  return duration.toString('%Ms m %S . %L s').replace(/ /g, '');
@@ -1 +1 @@
1
- {"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsB;AACtB,wDAA+B;AAC/B,0DAAiC;AACjC,qCAA0D;AAG1D,iDAA6D;AAE7D,MAAM,mBAAmB,GAAG;IAC1B,gBAAM,CAAC,MAAM;IACb,gBAAM,CAAC,SAAS;IAChB,gBAAM,CAAC,SAAS;IAChB,gBAAM,CAAC,OAAO;IACd,gBAAM,CAAC,OAAO;IACd,gBAAM,CAAC,MAAM;CACd,CAAA;AAQD,SAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,gBAAgB,EAChB,eAAe,GACO;IACtB,MAAM,eAAe,GAAgD,EAAE,CAAA;IACvE,MAAM,eAAe,GAAgD,EAAE,CAAA;IACvE,IAAI,iBAAiB,GAAG,sBAAe,EAAE,CAAA;IACzC,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,mBAAmB,EAAE,WAAW,EAAE,EAAE,EAAE;QAC1E,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAChD,iBAAiB,GAAG,mBAAY,CAAC,iBAAiB,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;QAC1E,CAAC,CAAC,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AK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;IACjE,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,MAAM,OAAO,GAAa,EAAE,CAAA;QAC5B,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACrC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;gBACtB,OAAO,CAAC,IAAI,CACV,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CACxB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,IAAI,gBAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAC/D,CACF,CAAA;aACF;QACH,CAAC,CAAC,CAAA;QACF,IAAI,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;KACnC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,kBAAkB,CAAC,WAA+B;IACzD,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAA;IACzB,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,yBAAc,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAA;IACxE,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 _ from 'lodash'\nimport Duration from 'duration'\nimport Status from '../../status'\nimport { addDurations, getZeroDuration } from '../../time'\nimport { IColorFns } from '../get_color_fns'\nimport { ITestCaseAttempt } from './event_data_collector'\nimport { messages, TimeConversion } from '@cucumber/messages'\n\nconst STATUS_REPORT_ORDER = [\n Status.FAILED,\n Status.AMBIGUOUS,\n Status.UNDEFINED,\n Status.PENDING,\n Status.SKIPPED,\n Status.PASSED,\n]\n\nexport interface IFormatSummaryRequest {\n colorFns: IColorFns\n testCaseAttempts: ITestCaseAttempt[]\n testRunDuration: messages.IDuration\n}\n\nexport function formatSummary({\n colorFns,\n testCaseAttempts,\n testRunDuration,\n}: IFormatSummaryRequest): string {\n const testCaseResults: messages.TestStepFinished.ITestStepResult[] = []\n const testStepResults: messages.TestStepFinished.ITestStepResult[] = []\n let totalStepDuration = getZeroDuration()\n testCaseAttempts.forEach(({ testCase, worstTestStepResult, stepResults }) => {\n Object.values(stepResults).forEach((stepResult) => {\n totalStepDuration = addDurations(totalStepDuration, stepResult.duration)\n })\n if (!worstTestStepResult.willBeRetried) {\n testCaseResults.push(worstTestStepResult)\n _.each(testCase.testSteps, (testStep) => {\n if (testStep.pickleStepId !== '') {\n testStepResults.push(stepResults[testStep.id])\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.TestStepFinished.ITestStepResult[]\n type: string\n}\n\nfunction getCountSummary({\n colorFns,\n objects,\n type,\n}: IGetCountSummaryRequest): string {\n const counts = _.chain(objects).groupBy('status').mapValues('length').value()\n const total = _.chain(counts).values().sum().value()\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[status].toLowerCase()}`\n )\n )\n }\n })\n text += ` (${details.join(', ')})`\n }\n return text\n}\n\nfunction getDurationSummary(durationMsg: messages.IDuration): string {\n const start = new Date(0)\n const end = new Date(TimeConversion.durationToMilliseconds(durationMsg))\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"]}
1
+ {"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsB;AACtB,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,CAAC,OAAO;IACrC,QAAQ,CAAC,oBAAoB,CAAC,MAAM;CACrC,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,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAA;IACzE,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,mBAAmB,EAAE,WAAW,EAAE,EAAE,EAAE;QAC1E,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAChD,iBAAiB,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CACtD,iBAAiB,EACjB,UAAU,CAAC,QAAQ,CACpB,CAAA;QACH,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE;YACtC,eAAe,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;YACzC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G,CAAC,EAAE;QACb,MAAM,OAAO,GAAa,EAAE,CAAA;QAC5B,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACrC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;gBACtB,OAAO,CAAC,IAAI,CACV,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CACxB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CACvD,CACF,CAAA;aACF;QACH,CAAC,CAAC,CAAA;QACF,IAAI,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;KACnC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,kBAAkB,CAAC,WAA8B;IACxD,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAA;IACzB,MAAM,GAAG,GAAG,IAAI,IAAI,CAClB,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAC5D,CAAA;IACD,MAAM,QAAQ,GAAG,IAAI,kBAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACzC,mFAAmF;IACnF,OAAO,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AAC/D,CAAC","sourcesContent":["import _ from 'lodash'\nimport 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(({ testCase, worstTestStepResult, stepResults }) => {\n Object.values(stepResults).forEach((stepResult) => {\n totalStepDuration = messages.TimeConversion.addDurations(\n totalStepDuration,\n stepResult.duration\n )\n })\n if (!worstTestStepResult.willBeRetried) {\n testCaseResults.push(worstTestStepResult)\n _.each(testCase.testSteps, (testStep) => {\n if (doesHaveValue(testStep.pickleStepId)) {\n testStepResults.push(stepResults[testStep.id])\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 = _.chain(objects).groupBy('status').mapValues('length').value()\n const total = _.chain(counts).values().sum().value()\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"]}
@@ -1,32 +1,51 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
23
  };
5
24
  Object.defineProperty(exports, "__esModule", { value: true });
6
25
  exports.formatTestCaseAttempt = void 0;
7
26
  const indent_string_1 = __importDefault(require("indent-string"));
8
- const status_1 = __importDefault(require("../../status"));
27
+ const messages = __importStar(require("@cucumber/messages"));
9
28
  const figures_1 = __importDefault(require("figures"));
10
29
  const location_helpers_1 = require("./location_helpers");
11
30
  const test_case_attempt_parser_1 = require("./test_case_attempt_parser");
12
31
  const step_argument_formatter_1 = require("./step_argument_formatter");
13
32
  const value_checker_1 = require("../../value_checker");
14
- const CHARACTERS = {
15
- [status_1.default.AMBIGUOUS]: figures_1.default.cross,
16
- [status_1.default.FAILED]: figures_1.default.cross,
17
- [status_1.default.PASSED]: figures_1.default.tick,
18
- [status_1.default.PENDING]: '?',
19
- [status_1.default.SKIPPED]: '-',
20
- [status_1.default.UNDEFINED]: '?',
21
- };
33
+ const CHARACTERS = new Map([
34
+ [messages.TestStepResultStatus.AMBIGUOUS, figures_1.default.cross],
35
+ [messages.TestStepResultStatus.FAILED, figures_1.default.cross],
36
+ [messages.TestStepResultStatus.PASSED, figures_1.default.tick],
37
+ [messages.TestStepResultStatus.PENDING, '?'],
38
+ [messages.TestStepResultStatus.SKIPPED, '-'],
39
+ [messages.TestStepResultStatus.UNDEFINED, '?'],
40
+ ]);
22
41
  function getStepMessage(testStep) {
23
42
  switch (testStep.result.status) {
24
- case status_1.default.AMBIGUOUS:
25
- case status_1.default.FAILED:
43
+ case messages.TestStepResultStatus.AMBIGUOUS:
44
+ case messages.TestStepResultStatus.FAILED:
26
45
  return testStep.result.message;
27
- case status_1.default.UNDEFINED:
46
+ case messages.TestStepResultStatus.UNDEFINED:
28
47
  return `${'Undefined. Implement with the following snippet:' + '\n\n'}${indent_string_1.default(testStep.snippet, 2)}\n`;
29
- case status_1.default.PENDING:
48
+ case messages.TestStepResultStatus.PENDING:
30
49
  return 'Pending';
31
50
  }
32
51
  return '';
@@ -35,7 +54,7 @@ function formatStep({ colorFns, testStep }) {
35
54
  const { result: { status }, actionLocation, attachments, } = testStep;
36
55
  const colorFn = colorFns.forStatus(status);
37
56
  const identifier = testStep.keyword + value_checker_1.valueOrDefault(testStep.text, '');
38
- let text = colorFn(`${CHARACTERS[status]} ${identifier}`);
57
+ let text = colorFn(`${CHARACTERS.get(status)} ${identifier}`);
39
58
  if (value_checker_1.doesHaveValue(actionLocation)) {
40
59
  text += ` # ${colorFns.location(location_helpers_1.formatLocation(actionLocation))}`;
41
60
  }
@@ -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,0DAAiC;AACjC,sDAA6B;AAC7B,yDAAmD;AACnD,yEAGmC;AACnC,uEAA8D;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c,CACpB,MAAM,CAAC,QAAQ,CAAC,OAAO,EACvB,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,aAAa,CAClD,CAAA;IACD,IAAI,IAAI,MAAM,QAAQ,CAAC,QAAQ,CAC7B,iCAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAC/C,IAAI,CAAA;IACL,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACpC,IAAI,IAAI,UAAU,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,IAAI,IAAI,CAAA;AACpB,CAAC;AAzBD,sDAyBC;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 Status from '../../status'\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: { [status: number]: string } = {\n [Status.AMBIGUOUS]: figures.cross,\n [Status.FAILED]: figures.cross,\n [Status.PASSED]: figures.tick,\n [Status.PENDING]: '?',\n [Status.SKIPPED]: '-',\n [Status.UNDEFINED]: '?',\n}\n\nfunction getStepMessage(testStep: IParsedTestStep): string {\n switch (testStep.result.status) {\n case Status.AMBIGUOUS:\n case Status.FAILED:\n return testStep.result.message\n case Status.UNDEFINED:\n return `${\n 'Undefined. Implement with the following snippet:' + '\\n\\n'\n }${indentString(testStep.snippet, 2)}\\n`\n case Status.PENDING:\n return 'Pending'\n }\n return ''\n}\n\ninterface IFormatStepRequest {\n colorFns: IColorFns\n testStep: IParsedTestStep\n}\n\nfunction formatStep({ colorFns, testStep }: IFormatStepRequest): string {\n const {\n result: { status },\n actionLocation,\n attachments,\n } = testStep\n const colorFn = colorFns.forStatus(status)\n const identifier = testStep.keyword + valueOrDefault(testStep.text, '')\n let text = colorFn(`${CHARACTERS[status]} ${identifier}`)\n if (doesHaveValue(actionLocation)) {\n text += ` # ${colorFns.location(formatLocation(actionLocation))}`\n }\n text += '\\n'\n if (doesHaveValue(testStep.argument)) {\n const argumentsText = formatStepArgument(testStep.argument)\n text += indentString(`${colorFn(argumentsText)}\\n`, 4)\n }\n attachments.forEach(({ body, mediaType }) => {\n const message = mediaType === 'text/plain' ? `: ${body}` : ''\n text += indentString(`Attachment (${mediaType})${message}\\n`, 4)\n })\n const message = getStepMessage(testStep)\n if (message !== '') {\n text += `${indentString(colorFn(message), 4)}\\n`\n }\n return text\n}\n\nexport interface IFormatTestCaseAttemptRequest {\n colorFns: IColorFns\n cwd: string\n testCaseAttempt: ITestCaseAttempt\n snippetBuilder: StepDefinitionSnippetBuilder\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport function formatTestCaseAttempt({\n colorFns,\n cwd,\n snippetBuilder,\n supportCodeLibrary,\n testCaseAttempt,\n}: IFormatTestCaseAttemptRequest): string {\n const parsed = parseTestCaseAttempt({\n cwd,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n })\n let text = `Scenario: ${parsed.testCase.name}`\n text += getAttemptText(\n parsed.testCase.attempt,\n parsed.testCase.worstTestStepResult.willBeRetried\n )\n text += ` # ${colorFns.location(\n formatLocation(parsed.testCase.sourceLocation)\n )}\\n`\n parsed.testSteps.forEach((testStep) => {\n text += formatStep({ colorFns, testStep })\n })\n return `${text}\\n`\n}\n\nfunction getAttemptText(attempt: number, willBeRetried: boolean): string {\n if (attempt > 0 || willBeRetried) {\n const numberStr = (attempt + 1).toString()\n const retriedStr = willBeRetried ? ', retried' : ''\n return ` (attempt ${numberStr}${retriedStr})`\n }\n return ''\n}\n"]}
1
+ {"version":3,"file":"test_case_attempt_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAwC;AACxC,6DAA8C;AAC9C,sDAA6B;AAC7B,yDAAmD;AACnD,yEAGmC;AACnC,uEAA8D;AAE9D,uDAAmE;AAKnE,MAAM,UAAU,GAA+C,IAAI,GAAG,CAAC;IACrE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,iBAAO,CAAC,KAAK,CAAC;IACxD,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,iBAAO,CAAC,KAAK,CAAC;IACrD,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,iBAAO,CAAC,IAAI,CAAC;IACpD,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC;IAC5C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC;IAC5C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,GAAG,CAAC;CAC/C,CAAC,CAAA;AAEF,SAAS,cAAc,CAAC,QAAyB;IAC/C,QAAQ,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAC9B,KAAK,QAAQ,CAAC,oBAAoB,CAAC,SAAS,CAAC;QAC7C,KAAK,QAAQ,CAAC,oBAAoB,CAAC,MAAM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,IAAI,OAAO,GAAG,CAAC,IAAI,aAAa,EAAE;QAChC,MAAM,SAAS,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;QAC1C,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;QACnD,OAAO,aAAa,SAAS,GAAG,UAAU,GAAG,CAAA;KAC9C;IACD,OAAO,EAAE,CAAA;AACX,CAAC","sourcesContent":["import indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport figures from 'figures'\nimport { formatLocation } from './location_helpers'\nimport {\n IParsedTestStep,\n parseTestCaseAttempt,\n} from './test_case_attempt_parser'\nimport { formatStepArgument } from './step_argument_formatter'\nimport { IColorFns } from '../get_color_fns'\nimport { doesHaveValue, valueOrDefault } from '../../value_checker'\nimport { ITestCaseAttempt } from './event_data_collector'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\n\nconst CHARACTERS: Map<messages.TestStepResultStatus, string> = new Map([\n [messages.TestStepResultStatus.AMBIGUOUS, figures.cross],\n [messages.TestStepResultStatus.FAILED, figures.cross],\n [messages.TestStepResultStatus.PASSED, figures.tick],\n [messages.TestStepResultStatus.PENDING, '?'],\n [messages.TestStepResultStatus.SKIPPED, '-'],\n [messages.TestStepResultStatus.UNDEFINED, '?'],\n])\n\nfunction getStepMessage(testStep: IParsedTestStep): string {\n switch (testStep.result.status) {\n case messages.TestStepResultStatus.AMBIGUOUS:\n case messages.TestStepResultStatus.FAILED:\n return testStep.result.message\n case messages.TestStepResultStatus.UNDEFINED:\n return `${\n 'Undefined. Implement with the following snippet:' + '\\n\\n'\n }${indentString(testStep.snippet, 2)}\\n`\n case messages.TestStepResultStatus.PENDING:\n return 'Pending'\n }\n return ''\n}\n\ninterface IFormatStepRequest {\n colorFns: IColorFns\n testStep: IParsedTestStep\n}\n\nfunction formatStep({ colorFns, testStep }: IFormatStepRequest): string {\n const {\n result: { status },\n actionLocation,\n attachments,\n } = testStep\n const colorFn = colorFns.forStatus(status)\n const identifier = testStep.keyword + valueOrDefault(testStep.text, '')\n let text = colorFn(`${CHARACTERS.get(status)} ${identifier}`)\n if (doesHaveValue(actionLocation)) {\n text += ` # ${colorFns.location(formatLocation(actionLocation))}`\n }\n text += '\\n'\n if (doesHaveValue(testStep.argument)) {\n const argumentsText = formatStepArgument(testStep.argument)\n text += indentString(`${colorFn(argumentsText)}\\n`, 4)\n }\n attachments.forEach(({ body, mediaType }) => {\n const message = mediaType === 'text/plain' ? `: ${body}` : ''\n text += indentString(`Attachment (${mediaType})${message}\\n`, 4)\n })\n const message = getStepMessage(testStep)\n if (message !== '') {\n text += `${indentString(colorFn(message), 4)}\\n`\n }\n return text\n}\n\nexport interface IFormatTestCaseAttemptRequest {\n colorFns: IColorFns\n cwd: string\n testCaseAttempt: ITestCaseAttempt\n snippetBuilder: StepDefinitionSnippetBuilder\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport function formatTestCaseAttempt({\n colorFns,\n cwd,\n snippetBuilder,\n supportCodeLibrary,\n testCaseAttempt,\n}: IFormatTestCaseAttemptRequest): string {\n const parsed = parseTestCaseAttempt({\n cwd,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n })\n let text = `Scenario: ${parsed.testCase.name}`\n text += getAttemptText(\n parsed.testCase.attempt,\n parsed.testCase.worstTestStepResult.willBeRetried\n )\n text += ` # ${colorFns.location(\n formatLocation(parsed.testCase.sourceLocation)\n )}\\n`\n parsed.testSteps.forEach((testStep) => {\n text += formatStep({ colorFns, testStep })\n })\n return `${text}\\n`\n}\n\nfunction getAttemptText(attempt: number, willBeRetried: boolean): string {\n if (attempt > 0 || willBeRetried) {\n const numberStr = (attempt + 1).toString()\n const retriedStr = willBeRetried ? ', retried' : ''\n return ` (attempt ${numberStr}${retriedStr})`\n }\n return ''\n}\n"]}
@@ -1,14 +1,14 @@
1
- import { messages } from '@cucumber/messages';
1
+ import * as messages from '@cucumber/messages';
2
2
  import { ITestCaseAttempt } from './event_data_collector';
3
3
  import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
4
4
  import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
5
5
  import { ILineAndUri } from '../../types';
6
6
  export interface IParsedTestStep {
7
7
  actionLocation?: ILineAndUri;
8
- argument?: messages.IPickleStepArgument;
9
- attachments: messages.IAttachment[];
8
+ argument?: messages.PickleStepArgument;
9
+ attachments: messages.Attachment[];
10
10
  keyword: string;
11
- result: messages.TestStepFinished.ITestStepResult;
11
+ result: messages.TestStepResult;
12
12
  snippet?: string;
13
13
  sourceLocation?: ILineAndUri;
14
14
  text?: string;
@@ -17,7 +17,7 @@ export interface IParsedTestCase {
17
17
  attempt: number;
18
18
  name: string;
19
19
  sourceLocation?: ILineAndUri;
20
- worstTestStepResult: messages.TestStepFinished.ITestStepResult;
20
+ worstTestStepResult: messages.TestStepResult;
21
21
  }
22
22
  export interface IParsedTestCaseAttempt {
23
23
  testCase: IParsedTestCase;
@@ -1,27 +1,45 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
23
  };
5
24
  Object.defineProperty(exports, "__esModule", { value: true });
6
25
  exports.parseTestCaseAttempt = void 0;
7
26
  const lodash_1 = __importDefault(require("lodash"));
8
- const status_1 = __importDefault(require("../../status"));
9
27
  const keyword_type_1 = require("./keyword_type");
10
28
  const gherkin_document_parser_1 = require("./gherkin_document_parser");
11
29
  const pickle_parser_1 = require("./pickle_parser");
12
- const path_1 = __importDefault(require("path"));
30
+ const messages = __importStar(require("@cucumber/messages"));
13
31
  const value_checker_1 = require("../../value_checker");
14
32
  function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleStep, pickleUri, snippetBuilder, supportCodeLibrary, testStep, testStepResult, testStepAttachments, }) {
15
33
  const out = {
16
34
  attachments: testStepAttachments,
17
- keyword: testStep.pickleStepId !== ''
35
+ keyword: value_checker_1.doesHaveValue(testStep.pickleStepId)
18
36
  ? keyword
19
37
  : isBeforeHook
20
38
  ? 'Before'
21
39
  : 'After',
22
40
  result: testStepResult,
23
41
  };
24
- if (testStep.hookId !== '') {
42
+ if (value_checker_1.doesHaveValue(testStep.hookId)) {
25
43
  let hookDefinition;
26
44
  if (isBeforeHook) {
27
45
  hookDefinition = supportCodeLibrary.beforeTestCaseHookDefinitions.find((x) => x.id === testStep.hookId);
@@ -42,7 +60,7 @@ function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleS
42
60
  line: stepDefinition.line,
43
61
  };
44
62
  }
45
- if (testStep.pickleStepId !== '') {
63
+ if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
46
64
  out.sourceLocation = {
47
65
  uri: pickleUri,
48
66
  line: gherkinStepMap[pickleStep.astNodeIds[0]].location.line,
@@ -52,7 +70,7 @@ function parseStep({ isBeforeHook, gherkinStepMap, keyword, keywordType, pickleS
52
70
  out.argument = pickleStep.argument;
53
71
  }
54
72
  }
55
- if (testStepResult.status === status_1.default.UNDEFINED) {
73
+ if (testStepResult.status === messages.TestStepResultStatus.UNDEFINED) {
56
74
  out.snippet = snippetBuilder.build({ keywordType, pickleStep });
57
75
  }
58
76
  return out;
@@ -64,7 +82,7 @@ function parseTestCaseAttempt({ cwd, testCaseAttempt, snippetBuilder, supportCod
64
82
  const gherkinStepMap = gherkin_document_parser_1.getGherkinStepMap(gherkinDocument);
65
83
  const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
66
84
  const pickleStepMap = pickle_parser_1.getPickleStepMap(pickle);
67
- const relativePickleUri = path_1.default.relative(cwd, pickle.uri);
85
+ const relativePickleUri = pickle.uri;
68
86
  const parsedTestCase = {
69
87
  attempt: testCaseAttempt.attempt,
70
88
  name: pickle.name,
@@ -79,9 +97,9 @@ function parseTestCaseAttempt({ cwd, testCaseAttempt, snippetBuilder, supportCod
79
97
  let previousKeywordType = keyword_type_1.KeywordType.Precondition;
80
98
  lodash_1.default.each(testCase.testSteps, (testStep) => {
81
99
  const testStepResult = testCaseAttempt.stepResults[testStep.id];
82
- isBeforeHook = isBeforeHook && testStep.hookId !== '';
100
+ isBeforeHook = isBeforeHook && value_checker_1.doesHaveValue(testStep.hookId);
83
101
  let keyword, keywordType, pickleStep;
84
- if (testStep.pickleStepId !== '') {
102
+ if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
85
103
  pickleStep = pickleStepMap[testStep.pickleStepId];
86
104
  keyword = pickle_parser_1.getStepKeyword({ pickleStep, gherkinStepMap });
87
105
  keywordType = keyword_type_1.getStepKeywordType({
@@ -1 +1 @@
1
- {"version":3,"file":"test_case_attempt_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_parser.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsC;AACtC,0DAAiC;AACjC,iDAAgE;AAChE,uEAGkC;AAClC,mDAAkE;AAClE,gDAAuB;AAKvB,uDAAmE;AAyCnE,SAAS,SAAS,CAAC,EACjB,YAAY,EACZ,cAA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CAAC,CAAC,CAAA;IACF,OAAO;QACL,QAAQ,EAAE,cAAc;QACxB,SAAS,EAAE,eAAe;KAC3B,CAAA;AACH,CAAC;AA7DD,oDA6DC","sourcesContent":["import _, { Dictionary } from 'lodash'\nimport Status from '../../status'\nimport { getStepKeywordType, KeywordType } from './keyword_type'\nimport {\n getGherkinScenarioLocationMap,\n getGherkinStepMap,\n} from './gherkin_document_parser'\nimport { getPickleStepMap, getStepKeyword } from './pickle_parser'\nimport path from 'path'\nimport { 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'\n\nexport interface IParsedTestStep {\n actionLocation?: ILineAndUri\n argument?: messages.IPickleStepArgument\n attachments: messages.IAttachment[]\n keyword: string\n result: messages.TestStepFinished.ITestStepResult\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.TestStepFinished.ITestStepResult\n}\n\nexport interface IParsedTestCaseAttempt {\n testCase: IParsedTestCase\n testSteps: IParsedTestStep[]\n}\n\ninterface IParseStepRequest {\n isBeforeHook: boolean\n gherkinStepMap: Dictionary<messages.GherkinDocument.Feature.IStep>\n keyword: string\n keywordType: KeywordType\n pickleStep: messages.Pickle.IPickleStep\n pickleUri: string\n snippetBuilder: StepDefinitionSnippetBuilder\n supportCodeLibrary: ISupportCodeLibrary\n testStep: messages.TestCase.ITestStep\n testStepResult: messages.TestStepFinished.ITestStepResult\n testStepAttachments: messages.IAttachment[]\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:\n testStep.pickleStepId !== ''\n ? keyword\n : isBeforeHook\n ? 'Before'\n : 'After',\n result: testStepResult,\n }\n if (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 (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 === Status.UNDEFINED) {\n out.snippet = snippetBuilder.build({ keywordType, pickleStep })\n }\n return out\n}\n\nexport interface IParseTestCaseAttemptRequest {\n cwd: string\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 cwd,\n testCaseAttempt,\n snippetBuilder,\n supportCodeLibrary,\n}: IParseTestCaseAttemptRequest): IParsedTestCaseAttempt {\n const { testCase, pickle, gherkinDocument } = testCaseAttempt\n const gherkinStepMap = getGherkinStepMap(gherkinDocument)\n const gherkinScenarioLocationMap = getGherkinScenarioLocationMap(\n gherkinDocument\n )\n const pickleStepMap = getPickleStepMap(pickle)\n const relativePickleUri = path.relative(cwd, pickle.uri)\n const parsedTestCase: IParsedTestCase = {\n attempt: testCaseAttempt.attempt,\n name: pickle.name,\n sourceLocation: {\n uri: relativePickleUri,\n line: gherkinScenarioLocationMap[_.last(pickle.astNodeIds)].line,\n },\n worstTestStepResult: testCaseAttempt.worstTestStepResult,\n }\n const parsedTestSteps: IParsedTestStep[] = []\n let isBeforeHook = true\n let previousKeywordType = KeywordType.Precondition\n _.each(testCase.testSteps, (testStep) => {\n const testStepResult = testCaseAttempt.stepResults[testStep.id]\n isBeforeHook = isBeforeHook && testStep.hookId !== ''\n let keyword, keywordType, pickleStep\n if (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"]}
1
+ {"version":3,"file":"test_case_attempt_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_parser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsB;AACtB,iDAAgE;AAChE,uEAGkC;AAClC,mDAAkE;AAClE,6DAA8C;AAI9C,uDAAmE;AAyCnE,SAAS,SAAS,CAAC,EACjB,YAAY,EACZ,cAAc,EACd,OAAO,EACP,WAAW,EACX,UAAU,EACV,SAAS,EACT,cAAc,EACd,kBAAkB,EA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,EAAE,eAAe;KAC3B,CAAA;AACH,CAAC;AA5DD,oDA4DC","sourcesContent":["import _ from 'lodash'\nimport { 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'\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 cwd: string\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 cwd,\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[_.last(pickle.astNodeIds)].line,\n },\n worstTestStepResult: testCaseAttempt.worstTestStepResult,\n }\n const parsedTestSteps: IParsedTestStep[] = []\n let isBeforeHook = true\n let previousKeywordType = KeywordType.Precondition\n _.each(testCase.testSteps, (testStep) => {\n const testStepResult = testCaseAttempt.stepResults[testStep.id]\n isBeforeHook = isBeforeHook && doesHaveValue(testStep.hookId)\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"]}
@@ -1,8 +1,8 @@
1
- import { messages } from '@cucumber/messages';
1
+ import * as messages from '@cucumber/messages';
2
2
  import StepDefinition from '../../../models/step_definition';
3
3
  import EventDataCollector from '../event_data_collector';
4
4
  export interface IUsageMatch {
5
- duration?: messages.IDuration;
5
+ duration?: messages.Duration;
6
6
  line: number;
7
7
  text: string;
8
8
  uri: string;
@@ -11,7 +11,7 @@ export interface IUsage {
11
11
  code: string;
12
12
  line: number;
13
13
  matches: IUsageMatch[];
14
- meanDuration?: messages.IDuration;
14
+ meanDuration?: messages.Duration;
15
15
  pattern: string;
16
16
  patternType: string;
17
17
  uri: string;