@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,9 +1,6 @@
1
- import { Dictionary } from 'lodash';
2
- import { IUserCodeImporter } from './index';
3
1
  export default class ProfileLoader {
4
2
  private readonly directory;
5
- private readonly importer;
6
- constructor(directory: string, importer: IUserCodeImporter);
7
- getDefinitions(): Promise<Dictionary<string>>;
3
+ constructor(directory: string);
4
+ getDefinitions(): Promise<Record<string, string>>;
8
5
  getArgv(profiles: string[]): Promise<string[]>;
9
6
  }
@@ -9,9 +9,8 @@ const path_1 = __importDefault(require("path"));
9
9
  const string_argv_1 = __importDefault(require("string-argv"));
10
10
  const value_checker_1 = require("../value_checker");
11
11
  class ProfileLoader {
12
- constructor(directory, importer) {
12
+ constructor(directory) {
13
13
  this.directory = directory;
14
- this.importer = importer;
15
14
  }
16
15
  async getDefinitions() {
17
16
  const definitionsFilePath = path_1.default.join(this.directory, 'cucumber.js');
@@ -19,7 +18,7 @@ class ProfileLoader {
19
18
  if (!exists) {
20
19
  return {};
21
20
  }
22
- const definitions = await this.importer(definitionsFilePath, true);
21
+ const definitions = require(definitionsFilePath); // eslint-disable-line @typescript-eslint/no-var-requires
23
22
  if (typeof definitions !== 'object') {
24
23
  throw new Error(`${definitionsFilePath} does not export an object`);
25
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"profile_loader.js","sourceRoot":"","sources":["../../src/cli/profile_loader.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsC;AACtC,+CAAsB;AACtB,gDAAuB;AACvB,8DAAoC;AACpC,oDAAkE;AAGlE,MAAqB,aAAa;IAChC,YACmB,SAAiB,EACjB,QAA2B;QAD3B,cAAS,GAAT,SAAS,CAAQ;QACjB,aAAQ,GAAR,QAAQ,CAAmB;IAC3C,CAAC;IAEJ,KAAK,CAAC,cAAc;QAClB,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;QACpE,MAAM,MAAM,GAAG,MAAM,YAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,EAAE,CAAA;SACV;QACD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAA;QAClE,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,GAAG,mBAAmB,4BAA4B,CAAC,CAAA;SACpE;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAkB;QAC9B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAA;QAC/C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,6BAAa,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;YAC/D,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;SACvB;QACD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,gCAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE;gBAC1C,MAAM,IAAI,KAAK,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAA;aACjD;YACD,OAAO,qBAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;QACzC,CAAC,CAAC,CAAA;QACF,OAAO,gBAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;CACF;AAhCD,gCAgCC","sourcesContent":["import _, { Dictionary } from 'lodash'\nimport fs from 'mz/fs'\nimport path from 'path'\nimport stringArgv from 'string-argv'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport { IUserCodeImporter } from './index'\n\nexport default class ProfileLoader {\n constructor(\n private readonly directory: string,\n private readonly importer: IUserCodeImporter\n ) {}\n\n async getDefinitions(): Promise<Dictionary<string>> {\n const definitionsFilePath = path.join(this.directory, 'cucumber.js')\n const exists = await fs.exists(definitionsFilePath)\n if (!exists) {\n return {}\n }\n const definitions = await this.importer(definitionsFilePath, true)\n if (typeof definitions !== 'object') {\n throw new Error(`${definitionsFilePath} does not export an object`)\n }\n return definitions\n }\n\n async getArgv(profiles: string[]): Promise<string[]> {\n const definitions = await this.getDefinitions()\n if (profiles.length === 0 && doesHaveValue(definitions.default)) {\n profiles = ['default']\n }\n const argvs = profiles.map((profile) => {\n if (doesNotHaveValue(definitions[profile])) {\n throw new Error(`Undefined profile: ${profile}`)\n }\n return stringArgv(definitions[profile])\n })\n return _.flatten(argvs)\n }\n}\n"]}
1
+ {"version":3,"file":"profile_loader.js","sourceRoot":"","sources":["../../src/cli/profile_loader.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,+CAAsB;AACtB,gDAAuB;AACvB,8DAAoC;AACpC,oDAAkE;AAElE,MAAqB,aAAa;IAGhC,YAAY,SAAiB;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;QACpE,MAAM,MAAM,GAAG,MAAM,YAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,EAAE,CAAA;SACV;QACD,MAAM,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA,CAAC,yDAAyD;QAC1G,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,GAAG,mBAAmB,4BAA4B,CAAC,CAAA;SACpE;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAkB;QAC9B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAA;QAC/C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,6BAAa,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;YAC/D,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;SACvB;QACD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,gCAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE;gBAC1C,MAAM,IAAI,KAAK,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAA;aACjD;YACD,OAAO,qBAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;QACzC,CAAC,CAAC,CAAA;QACF,OAAO,gBAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;CACF;AAjCD,gCAiCC","sourcesContent":["import _ from 'lodash'\nimport fs from 'mz/fs'\nimport path from 'path'\nimport stringArgv from 'string-argv'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\n\nexport default class ProfileLoader {\n private readonly directory: string\n\n constructor(directory: string) {\n this.directory = directory\n }\n\n async getDefinitions(): Promise<Record<string, string>> {\n const definitionsFilePath = path.join(this.directory, 'cucumber.js')\n const exists = await fs.exists(definitionsFilePath)\n if (!exists) {\n return {}\n }\n const definitions = require(definitionsFilePath) // eslint-disable-line @typescript-eslint/no-var-requires\n if (typeof definitions !== 'object') {\n throw new Error(`${definitionsFilePath} does not export an object`)\n }\n return definitions\n }\n\n async getArgv(profiles: string[]): Promise<string[]> {\n const definitions = await this.getDefinitions()\n if (profiles.length === 0 && doesHaveValue(definitions.default)) {\n profiles = ['default']\n }\n const argvs = profiles.map((profile) => {\n if (doesNotHaveValue(definitions[profile])) {\n throw new Error(`Undefined profile: ${profile}`)\n }\n return stringArgv(definitions[profile])\n })\n return _.flatten(argvs)\n }\n}\n"]}
@@ -8,7 +8,7 @@ const cli_table3_1 = __importDefault(require("cli-table3"));
8
8
  const underlineBoldCyan = (x) => safe_1.default.underline(safe_1.default.bold(safe_1.default.cyan(x)));
9
9
  const formattedReportUrl = underlineBoldCyan('https://reports.cucumber.io');
10
10
  const formattedEnv = safe_1.default.cyan('CUCUMBER_PUBLISH_ENABLED') + '=' + safe_1.default.cyan('true');
11
- const formattedMoreInfoUrl = underlineBoldCyan('https://reports.cucumber.io/docs/cucumber-js');
11
+ const formattedMoreInfoUrl = underlineBoldCyan('https://cucumber.io/docs/cucumber/environment-variables/');
12
12
  const text = `\
13
13
  Share your Cucumber Report with your team at ${formattedReportUrl}
14
14
 
@@ -1 +1 @@
1
- {"version":3,"file":"publish_banner.js","sourceRoot":"","sources":["../../src/cli/publish_banner.ts"],"names":[],"mappings":";;;;;AAAA,uDAAgC;AAChC,4DAA8B;AAE9B,MAAM,iBAAiB,GAAG,CAAC,CAAS,EAAU,EAAE,CAC9C,cAAM,CAAC,SAAS,CAAC,cAAM,CAAC,IAAI,CAAC,cAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE/C,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,6BAA6B,CAAC,CAAA;AAC3E,MAAM,YAAY,GAChB,cAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,GAAG,GAAG,GAAG,cAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACrE,MAAM,oBAAoB,GAAG,iBAAiB,CAC5C,8CAA8C,CAC/C,CAAA;AAED,MAAM,IAAI,GAAG;+CACkC,kBAAkB;;0BAEvC,cAAM,CAAC,IAAI,CAAC,WAAW,CAAC;0BACxB,YAAY;;sBAEhB,oBAAoB;;4CAEE,cAAM,CAAC,IAAI,CAAC,eAAe,CAAC;EACtE,cAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,EAAE,CAAA;AAElE,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;IACtB,KAAK,EAAE;QACL,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,CAAC,OAAO,CAAC;KAClB;CACF,CAAC,CAAA;AAEF,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;AAElB,kBAAe,KAAK,CAAC,QAAQ,EAAE,CAAA","sourcesContent":["import colors from 'colors/safe'\nimport Table from 'cli-table3'\n\nconst underlineBoldCyan = (x: string): string =>\n colors.underline(colors.bold(colors.cyan(x)))\n\nconst formattedReportUrl = underlineBoldCyan('https://reports.cucumber.io')\nconst formattedEnv =\n colors.cyan('CUCUMBER_PUBLISH_ENABLED') + '=' + colors.cyan('true')\nconst formattedMoreInfoUrl = underlineBoldCyan(\n 'https://reports.cucumber.io/docs/cucumber-js'\n)\n\nconst text = `\\\nShare your Cucumber Report with your team at ${formattedReportUrl}\n\nCommand line option: ${colors.cyan('--publish')}\nEnvironment variable: ${formattedEnv}\n\nMore information at ${formattedMoreInfoUrl}\n\nTo disable this message, add this to your ${colors.bold('./cucumber.js')}: \n${colors.bold(\"module.exports = { default: '--publish-quiet' }\")}`\n\nconst table = new Table({\n style: {\n head: [],\n border: ['green'],\n },\n})\n\ntable.push([text])\n\nexport default table.toString()\n"]}
1
+ {"version":3,"file":"publish_banner.js","sourceRoot":"","sources":["../../src/cli/publish_banner.ts"],"names":[],"mappings":";;;;;AAAA,uDAAgC;AAChC,4DAA8B;AAE9B,MAAM,iBAAiB,GAAG,CAAC,CAAS,EAAU,EAAE,CAC9C,cAAM,CAAC,SAAS,CAAC,cAAM,CAAC,IAAI,CAAC,cAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE/C,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,6BAA6B,CAAC,CAAA;AAC3E,MAAM,YAAY,GAChB,cAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,GAAG,GAAG,GAAG,cAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACrE,MAAM,oBAAoB,GAAG,iBAAiB,CAC5C,0DAA0D,CAC3D,CAAA;AAED,MAAM,IAAI,GAAG;+CACkC,kBAAkB;;0BAEvC,cAAM,CAAC,IAAI,CAAC,WAAW,CAAC;0BACxB,YAAY;;sBAEhB,oBAAoB;;4CAEE,cAAM,CAAC,IAAI,CAAC,eAAe,CAAC;EACtE,cAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,EAAE,CAAA;AAElE,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;IACtB,KAAK,EAAE;QACL,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,CAAC,OAAO,CAAC;KAClB;CACF,CAAC,CAAA;AAEF,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;AAElB,kBAAe,KAAK,CAAC,QAAQ,EAAE,CAAA","sourcesContent":["import colors from 'colors/safe'\nimport Table from 'cli-table3'\n\nconst underlineBoldCyan = (x: string): string =>\n colors.underline(colors.bold(colors.cyan(x)))\n\nconst formattedReportUrl = underlineBoldCyan('https://reports.cucumber.io')\nconst formattedEnv =\n colors.cyan('CUCUMBER_PUBLISH_ENABLED') + '=' + colors.cyan('true')\nconst formattedMoreInfoUrl = underlineBoldCyan(\n 'https://cucumber.io/docs/cucumber/environment-variables/'\n)\n\nconst text = `\\\nShare your Cucumber Report with your team at ${formattedReportUrl}\n\nCommand line option: ${colors.cyan('--publish')}\nEnvironment variable: ${formattedEnv}\n\nMore information at ${formattedMoreInfoUrl}\n\nTo disable this message, add this to your ${colors.bold('./cucumber.js')}: \n${colors.bold(\"module.exports = { default: '--publish-quiet' }\")}`\n\nconst table = new Table({\n style: {\n head: [],\n border: ['green'],\n },\n})\n\ntable.push([text])\n\nexport default table.toString()\n"]}
@@ -7,10 +7,8 @@ import EventDataCollector from './helpers/event_data_collector';
7
7
  import { Writable as WritableStream } from 'stream';
8
8
  import { IParsedArgvFormatOptions } from '../cli/argv_parser';
9
9
  import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax';
10
- import { IUserCodeImporter } from '../cli';
11
10
  interface IGetStepDefinitionSnippetBuilderOptions {
12
11
  cwd: string;
13
- importer: IUserCodeImporter;
14
12
  snippetInterface?: SnippetInterface;
15
13
  snippetSyntax?: string;
16
14
  supportCodeLibrary: ISupportCodeLibrary;
@@ -21,16 +19,14 @@ export interface IBuildOptions {
21
19
  eventDataCollector: EventDataCollector;
22
20
  log: IFormatterLogFn;
23
21
  parsedArgvOptions: IParsedArgvFormatOptions;
24
- importer: IUserCodeImporter;
25
22
  stream: WritableStream;
26
23
  cleanup: IFormatterCleanupFn;
27
24
  supportCodeLibrary: ISupportCodeLibrary;
28
25
  }
29
26
  declare const FormatterBuilder: {
30
- build(type: string, options: IBuildOptions): Promise<Formatter>;
31
- getConstructorByType(type: string, cwd: string, importer: IUserCodeImporter): Promise<typeof Formatter>;
32
- getStepDefinitionSnippetBuilder({ cwd, importer, snippetInterface, snippetSyntax, supportCodeLibrary, }: IGetStepDefinitionSnippetBuilderOptions): Promise<StepDefinitionSnippetBuilder>;
33
- loadCustomFormatter(customFormatterPath: string, cwd: string, importer: IUserCodeImporter): Promise<any>;
34
- resolveConstructor(ImportedCode: any): any;
27
+ build(type: string, options: IBuildOptions): Formatter;
28
+ getConstructorByType(type: string, cwd: string): typeof Formatter;
29
+ getStepDefinitionSnippetBuilder({ cwd, snippetInterface, snippetSyntax, supportCodeLibrary, }: IGetStepDefinitionSnippetBuilderOptions): StepDefinitionSnippetBuilder;
30
+ loadCustomFormatter(customFormatterPath: string, cwd: string): any;
35
31
  };
36
32
  export default FormatterBuilder;
@@ -19,24 +19,21 @@ const usage_json_formatter_1 = __importDefault(require("./usage_json_formatter")
19
19
  const value_checker_1 = require("../value_checker");
20
20
  const snippet_syntax_1 = require("./step_definition_snippet_builder/snippet_syntax");
21
21
  const html_formatter_1 = __importDefault(require("./html_formatter"));
22
+ const create_require_1 = __importDefault(require("create-require"));
22
23
  const FormatterBuilder = {
23
- async build(type, options) {
24
- const FormatterConstructor = await FormatterBuilder.getConstructorByType(type, options.cwd, options.importer);
24
+ build(type, options) {
25
+ const FormatterConstructor = FormatterBuilder.getConstructorByType(type, options.cwd);
25
26
  const colorFns = get_color_fns_1.default(options.parsedArgvOptions.colorsEnabled);
26
- const snippetBuilder = await FormatterBuilder.getStepDefinitionSnippetBuilder({
27
+ const snippetBuilder = FormatterBuilder.getStepDefinitionSnippetBuilder({
27
28
  cwd: options.cwd,
28
- importer: options.importer,
29
29
  snippetInterface: options.parsedArgvOptions.snippetInterface,
30
30
  snippetSyntax: options.parsedArgvOptions.snippetSyntax,
31
31
  supportCodeLibrary: options.supportCodeLibrary,
32
32
  });
33
- return new FormatterConstructor({
34
- colorFns,
35
- snippetBuilder,
36
- ...options,
37
- });
33
+ return new FormatterConstructor(Object.assign({ colorFns,
34
+ snippetBuilder }, options));
38
35
  },
39
- async getConstructorByType(type, cwd, importer) {
36
+ getConstructorByType(type, cwd) {
40
37
  switch (type) {
41
38
  case 'json':
42
39
  return json_formatter_1.default;
@@ -59,45 +56,33 @@ const FormatterBuilder = {
59
56
  case 'usage-json':
60
57
  return usage_json_formatter_1.default;
61
58
  default:
62
- return await FormatterBuilder.loadCustomFormatter(type, cwd, importer);
59
+ return FormatterBuilder.loadCustomFormatter(type, cwd);
63
60
  }
64
61
  },
65
- async getStepDefinitionSnippetBuilder({ cwd, importer, snippetInterface, snippetSyntax, supportCodeLibrary, }) {
62
+ getStepDefinitionSnippetBuilder({ cwd, snippetInterface, snippetSyntax, supportCodeLibrary, }) {
66
63
  if (value_checker_1.doesNotHaveValue(snippetInterface)) {
67
64
  snippetInterface = snippet_syntax_1.SnippetInterface.Synchronous;
68
65
  }
69
66
  let Syntax = javascript_snippet_syntax_1.default;
70
67
  if (value_checker_1.doesHaveValue(snippetSyntax)) {
71
68
  const fullSyntaxPath = path_1.default.resolve(cwd, snippetSyntax);
72
- Syntax = await importer(fullSyntaxPath, true);
73
- Syntax = FormatterBuilder.resolveConstructor(Syntax);
69
+ Syntax = require(fullSyntaxPath); // eslint-disable-line @typescript-eslint/no-var-requires
74
70
  }
75
71
  return new step_definition_snippet_builder_1.default({
76
72
  snippetSyntax: new Syntax(snippetInterface),
77
73
  parameterTypeRegistry: supportCodeLibrary.parameterTypeRegistry,
78
74
  });
79
75
  },
80
- async loadCustomFormatter(customFormatterPath, cwd, importer) {
81
- let CustomFormatter = customFormatterPath.startsWith(`.`)
82
- ? await importer(path_1.default.resolve(cwd, customFormatterPath), true)
83
- : await importer(customFormatterPath);
84
- CustomFormatter = FormatterBuilder.resolveConstructor(CustomFormatter);
85
- if (value_checker_1.doesHaveValue(CustomFormatter)) {
76
+ loadCustomFormatter(customFormatterPath, cwd) {
77
+ const CustomFormatter = create_require_1.default(cwd)(customFormatterPath);
78
+ if (typeof CustomFormatter === 'function') {
86
79
  return CustomFormatter;
87
80
  }
88
- else {
89
- throw new Error(`Custom formatter (${customFormatterPath}) does not export a function`);
90
- }
91
- },
92
- resolveConstructor(ImportedCode) {
93
- if (typeof ImportedCode === 'function') {
94
- return ImportedCode;
95
- }
96
- else if (value_checker_1.doesHaveValue(ImportedCode) &&
97
- typeof ImportedCode.default === 'function') {
98
- return ImportedCode.default;
81
+ else if (value_checker_1.doesHaveValue(CustomFormatter) &&
82
+ typeof CustomFormatter.default === 'function') {
83
+ return CustomFormatter.default;
99
84
  }
100
- return null;
85
+ throw new Error(`Custom formatter (${customFormatterPath}) does not export a function`);
101
86
  },
102
87
  };
103
88
  exports.default = FormatterBuilder;
@@ -1 +1 @@
1
- {"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/formatter/builder.ts"],"names":[],"mappings":";;;;;AAAA,oEAAyC;AACzC,4HAAiG;AACjG,sEAA4C;AAC5C,4EAAkD;AAClD,gDAAuB;AACvB,sFAA2D;AAC3D,8EAAoD;AACpD,wEAA8C;AAC9C,8EAAoD;AACpD,wGAA4E;AAC5E,4EAAkD;AAClD,wEAA8C;AAC9C,kFAAuD;AAGvD,oDAAkE;AAKlE,qFAAmF;AACnF,sEAA4C;AAuB5C,MAAM,gBAAgB,GAAG;IACvB,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,OAAsB;QAC9C,MAAM,oBAAoB,GAAG,MAAM,gBAAgB,CAAC,oBAAoB,CACtE,IAAI,EACJ,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,QAAQ,CACjB,CAAA;QACD,MAAM,QAAQ,GAAG,uBAAW,CAAC,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAA;QACrE,MAAM,cAAc,GAAG,MAAM,gBAAgB,CAAC,+BAA+B,CAC3E;YACE,GAAG,EAAE,OAAO,CAAC,GA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port JavascriptSnippetSyntax from './step_definition_snippet_builder/javascript_snippet_syntax'\nimport JsonFormatter from './json_formatter'\nimport MessageFormatter from './message_formatter'\nimport path from 'path'\nimport ProgressBarFormatter from './progress_bar_formatter'\nimport ProgressFormatter from './progress_formatter'\nimport RerunFormatter from './rerun_formatter'\nimport SnippetsFormatter from './snippets_formatter'\nimport StepDefinitionSnippetBuilder from './step_definition_snippet_builder'\nimport SummaryFormatter from './summary_formatter'\nimport UsageFormatter from './usage_formatter'\nimport UsageJsonFormatter from './usage_json_formatter'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport Formatter, { IFormatterCleanupFn, IFormatterLogFn } from '.'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport { EventEmitter } from 'events'\nimport EventDataCollector from './helpers/event_data_collector'\nimport { Writable as WritableStream } from 'stream'\nimport { IParsedArgvFormatOptions } from '../cli/argv_parser'\nimport { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax'\nimport HtmlFormatter from './html_formatter'\nimport { IUserCodeImporter } from '../cli'\n\ninterface IGetStepDefinitionSnippetBuilderOptions {\n cwd: string\n importer: IUserCodeImporter\n snippetInterface?: SnippetInterface\n snippetSyntax?: string\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport interface IBuildOptions {\n cwd: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n log: IFormatterLogFn\n parsedArgvOptions: IParsedArgvFormatOptions\n importer: IUserCodeImporter\n stream: WritableStream\n cleanup: IFormatterCleanupFn\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nconst FormatterBuilder = {\n async build(type: string, options: IBuildOptions): Promise<Formatter> {\n const FormatterConstructor = await FormatterBuilder.getConstructorByType(\n type,\n options.cwd,\n options.importer\n )\n const colorFns = getColorFns(options.parsedArgvOptions.colorsEnabled)\n const snippetBuilder = await FormatterBuilder.getStepDefinitionSnippetBuilder(\n {\n cwd: options.cwd,\n importer: options.importer,\n snippetInterface: options.parsedArgvOptions.snippetInterface,\n snippetSyntax: options.parsedArgvOptions.snippetSyntax,\n supportCodeLibrary: options.supportCodeLibrary,\n }\n )\n return new FormatterConstructor({\n colorFns,\n snippetBuilder,\n ...options,\n })\n },\n\n async getConstructorByType(\n type: string,\n cwd: string,\n importer: IUserCodeImporter\n ): Promise<typeof Formatter> {\n switch (type) {\n case 'json':\n return JsonFormatter\n case 'message':\n return MessageFormatter\n case 'html':\n return HtmlFormatter\n case 'progress':\n return ProgressFormatter\n case 'progress-bar':\n return ProgressBarFormatter\n case 'rerun':\n return RerunFormatter\n case 'snippets':\n return SnippetsFormatter\n case 'summary':\n return SummaryFormatter\n case 'usage':\n return UsageFormatter\n case 'usage-json':\n return UsageJsonFormatter\n default:\n return await FormatterBuilder.loadCustomFormatter(type, cwd, importer)\n }\n },\n\n async getStepDefinitionSnippetBuilder({\n cwd,\n importer,\n snippetInterface,\n snippetSyntax,\n supportCodeLibrary,\n }: IGetStepDefinitionSnippetBuilderOptions) {\n if (doesNotHaveValue(snippetInterface)) {\n snippetInterface = SnippetInterface.Synchronous\n }\n let Syntax = JavascriptSnippetSyntax\n if (doesHaveValue(snippetSyntax)) {\n const fullSyntaxPath = path.resolve(cwd, snippetSyntax)\n Syntax = await importer(fullSyntaxPath, true)\n Syntax = FormatterBuilder.resolveConstructor(Syntax)\n }\n return new StepDefinitionSnippetBuilder({\n snippetSyntax: new Syntax(snippetInterface),\n parameterTypeRegistry: supportCodeLibrary.parameterTypeRegistry,\n })\n },\n\n async loadCustomFormatter(\n customFormatterPath: string,\n cwd: string,\n importer: IUserCodeImporter\n ) {\n let CustomFormatter = customFormatterPath.startsWith(`.`)\n ? await importer(path.resolve(cwd, customFormatterPath), true)\n : await importer(customFormatterPath)\n CustomFormatter = FormatterBuilder.resolveConstructor(CustomFormatter)\n if (doesHaveValue(CustomFormatter)) {\n return CustomFormatter\n } else {\n throw new Error(\n `Custom formatter (${customFormatterPath}) does not export a function`\n )\n }\n },\n\n resolveConstructor(ImportedCode: any) {\n if (typeof ImportedCode === 'function') {\n return ImportedCode\n } else if (\n doesHaveValue(ImportedCode) &&\n typeof ImportedCode.default === 'function'\n ) {\n return ImportedCode.default\n }\n return null\n },\n}\n\nexport default FormatterBuilder\n"]}
1
+ {"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/formatter/builder.ts"],"names":[],"mappings":";;;;;AAAA,oEAAyC;AACzC,4HAAiG;AACjG,sEAA4C;AAC5C,4EAAkD;AAClD,gDAAuB;AACvB,sFAA2D;AAC3D,8EAAoD;AACpD,wEAA8C;AAC9C,8EAAoD;AACpD,wGAA4E;AAC5E,4EAAkD;AAClD,wEAA8C;AAC9C,kFAAuD;AAGvD,oDAAkE;AAKlE,qFAAmF;AACnF,sEAA4C;AAC5C,oEAA0C;AAoB1C,MAAM,gBAAgB,GAAG;IACvB,KAAK,CAAC,IAAY,EAAE,OAAsB;QACxC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,oBAAoB,CAChE,IAAI,EACJ,OAAO,CAAC,GAAG,CACZ,CAAA;QACD,MAAM,QAAQ,GAAG,uBAAW,CAAC,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAA;QACrE,MAAM,cAAc,GAAG,gBAAgB,CAAC,+BAA+B,CAAC;YACtE,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,gBAAgB,EAAE,OAAO,CAAC,iBAAiB,CAAC,gBAAgB;YAC5D,aAAa,EAAE,OAAO,CAAC,iBAAiB,CAAC,aAAa;YACtD,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;SAC/C,CAAC,CAAA;QACF,OAAO,IAAI,oBAAoB,iBAC7B,QAAQ;YACR,cAAc,IACX,OAAO,EACV,CAAA;IACJ,CAAC;IAED,oBAAoB,CAAC,IAAY,EAAE,GAAW;QAC5C,QAAQ,IAAI,EAAE;YACZ,KAAK,MAAM;gBACT,OAAO,wBAAa,CAAA;YACtB,KAAK,SAAS;gBACZ,OAAO,2BAAgB,CAAA;YACzB,KAAK,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C9B,OAAO,eAAe,CAAC,OAAO,KAAK,UAAU,EAC7C;YACA,OAAO,eAAe,CAAC,OAAO,CAAA;SAC/B;QACD,MAAM,IAAI,KAAK,CACb,qBAAqB,mBAAmB,8BAA8B,CACvE,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,gBAAgB,CAAA","sourcesContent":["import getColorFns from './get_color_fns'\nimport JavascriptSnippetSyntax from './step_definition_snippet_builder/javascript_snippet_syntax'\nimport JsonFormatter from './json_formatter'\nimport MessageFormatter from './message_formatter'\nimport path from 'path'\nimport ProgressBarFormatter from './progress_bar_formatter'\nimport ProgressFormatter from './progress_formatter'\nimport RerunFormatter from './rerun_formatter'\nimport SnippetsFormatter from './snippets_formatter'\nimport StepDefinitionSnippetBuilder from './step_definition_snippet_builder'\nimport SummaryFormatter from './summary_formatter'\nimport UsageFormatter from './usage_formatter'\nimport UsageJsonFormatter from './usage_json_formatter'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport Formatter, { IFormatterCleanupFn, IFormatterLogFn } from '.'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport { EventEmitter } from 'events'\nimport EventDataCollector from './helpers/event_data_collector'\nimport { Writable as WritableStream } from 'stream'\nimport { IParsedArgvFormatOptions } from '../cli/argv_parser'\nimport { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax'\nimport HtmlFormatter from './html_formatter'\nimport createRequire from 'create-require'\n\ninterface IGetStepDefinitionSnippetBuilderOptions {\n cwd: string\n snippetInterface?: SnippetInterface\n snippetSyntax?: string\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport interface IBuildOptions {\n cwd: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n log: IFormatterLogFn\n parsedArgvOptions: IParsedArgvFormatOptions\n stream: WritableStream\n cleanup: IFormatterCleanupFn\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nconst FormatterBuilder = {\n build(type: string, options: IBuildOptions): Formatter {\n const FormatterConstructor = FormatterBuilder.getConstructorByType(\n type,\n options.cwd\n )\n const colorFns = getColorFns(options.parsedArgvOptions.colorsEnabled)\n const snippetBuilder = FormatterBuilder.getStepDefinitionSnippetBuilder({\n cwd: options.cwd,\n snippetInterface: options.parsedArgvOptions.snippetInterface,\n snippetSyntax: options.parsedArgvOptions.snippetSyntax,\n supportCodeLibrary: options.supportCodeLibrary,\n })\n return new FormatterConstructor({\n colorFns,\n snippetBuilder,\n ...options,\n })\n },\n\n getConstructorByType(type: string, cwd: string): typeof Formatter {\n switch (type) {\n case 'json':\n return JsonFormatter\n case 'message':\n return MessageFormatter\n case 'html':\n return HtmlFormatter\n case 'progress':\n return ProgressFormatter\n case 'progress-bar':\n return ProgressBarFormatter\n case 'rerun':\n return RerunFormatter\n case 'snippets':\n return SnippetsFormatter\n case 'summary':\n return SummaryFormatter\n case 'usage':\n return UsageFormatter\n case 'usage-json':\n return UsageJsonFormatter\n default:\n return FormatterBuilder.loadCustomFormatter(type, cwd)\n }\n },\n\n getStepDefinitionSnippetBuilder({\n cwd,\n snippetInterface,\n snippetSyntax,\n supportCodeLibrary,\n }: IGetStepDefinitionSnippetBuilderOptions) {\n if (doesNotHaveValue(snippetInterface)) {\n snippetInterface = SnippetInterface.Synchronous\n }\n let Syntax = JavascriptSnippetSyntax\n if (doesHaveValue(snippetSyntax)) {\n const fullSyntaxPath = path.resolve(cwd, snippetSyntax)\n Syntax = require(fullSyntaxPath) // eslint-disable-line @typescript-eslint/no-var-requires\n }\n return new StepDefinitionSnippetBuilder({\n snippetSyntax: new Syntax(snippetInterface),\n parameterTypeRegistry: supportCodeLibrary.parameterTypeRegistry,\n })\n },\n\n loadCustomFormatter(customFormatterPath: string, cwd: string) {\n const CustomFormatter = createRequire(cwd)(customFormatterPath)\n\n if (typeof CustomFormatter === 'function') {\n return CustomFormatter\n } else if (\n doesHaveValue(CustomFormatter) &&\n typeof CustomFormatter.default === 'function'\n ) {\n return CustomFormatter.default\n }\n throw new Error(\n `Custom formatter (${customFormatterPath}) does not export a function`\n )\n },\n}\n\nexport default FormatterBuilder\n"]}
@@ -1,8 +1,12 @@
1
- import { messages } from '@cucumber/messages';
1
+ import { TestStepResultStatus } from '@cucumber/messages';
2
2
  export declare type IColorFn = (text: string) => string;
3
3
  export interface IColorFns {
4
- forStatus: (status: messages.TestStepFinished.TestStepResult.Status) => IColorFn;
4
+ forStatus: (status: TestStepResultStatus) => IColorFn;
5
5
  location: IColorFn;
6
6
  tag: IColorFn;
7
+ diffAdded: IColorFn;
8
+ diffRemoved: IColorFn;
9
+ errorMessage: IColorFn;
10
+ errorStack: IColorFn;
7
11
  }
8
12
  export default function getColorFns(enabled: boolean): IColorFns;
@@ -3,35 +3,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const lodash_1 = __importDefault(require("lodash"));
7
6
  const safe_1 = __importDefault(require("colors/safe"));
8
- const status_1 = __importDefault(require("../status"));
9
7
  safe_1.default.enable();
10
8
  function getColorFns(enabled) {
11
9
  if (enabled) {
12
10
  return {
13
11
  forStatus(status) {
14
12
  return {
15
- [status_1.default.AMBIGUOUS]: safe_1.default.red.bind(safe_1.default),
16
- [status_1.default.FAILED]: safe_1.default.red.bind(safe_1.default),
17
- [status_1.default.PASSED]: safe_1.default.green.bind(safe_1.default),
18
- [status_1.default.PENDING]: safe_1.default.yellow.bind(safe_1.default),
19
- [status_1.default.SKIPPED]: safe_1.default.cyan.bind(safe_1.default),
20
- [status_1.default.UNDEFINED]: safe_1.default.yellow.bind(safe_1.default),
21
- [status_1.default.UNKNOWN]: safe_1.default.yellow.bind(safe_1.default),
13
+ AMBIGUOUS: safe_1.default.red.bind(safe_1.default),
14
+ FAILED: safe_1.default.red.bind(safe_1.default),
15
+ PASSED: safe_1.default.green.bind(safe_1.default),
16
+ PENDING: safe_1.default.yellow.bind(safe_1.default),
17
+ SKIPPED: safe_1.default.cyan.bind(safe_1.default),
18
+ UNDEFINED: safe_1.default.yellow.bind(safe_1.default),
19
+ UNKNOWN: safe_1.default.yellow.bind(safe_1.default),
22
20
  }[status];
23
21
  },
24
22
  location: safe_1.default.gray.bind(safe_1.default),
25
23
  tag: safe_1.default.cyan.bind(safe_1.default),
24
+ diffAdded: safe_1.default.green.bind(safe_1.default),
25
+ diffRemoved: safe_1.default.red.bind(safe_1.default),
26
+ errorMessage: safe_1.default.red.bind(safe_1.default),
27
+ errorStack: safe_1.default.grey.bind(safe_1.default),
26
28
  };
27
29
  }
28
30
  else {
29
31
  return {
30
32
  forStatus(status) {
31
- return lodash_1.default.identity;
33
+ return (x) => x;
32
34
  },
33
- location: lodash_1.default.identity,
34
- tag: lodash_1.default.identity,
35
+ location: (x) => x,
36
+ tag: (x) => x,
37
+ diffAdded: (x) => x,
38
+ diffRemoved: (x) => x,
39
+ errorMessage: (x) => x,
40
+ errorStack: (x) => x,
35
41
  };
36
42
  }
37
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get_color_fns.js","sourceRoot":"","sources":["../../src/formatter/get_color_fns.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,uDAAgC;AAChC,uDAA8B;AAG9B,cAAM,CAAC,MAAM,EAAE,CAAA;AAYf,SAAwB,WAAW,CAAC,OAAgB;IAClD,IAAI,OAAO,EAAE;QACX,OAAO;YACL,SAAS,CAAC,MAAuD;gBAC/D,OAAO;oBACL,CAAC,gBAAM,CAAC,SAAS,CAAC,EAAE,cAAM,CAAC,GAAG,CAAC,IAAI,CAAC,cAAM,CAAC;oBAC3C,CAAC,gBAAM,CAAC,MAAM,CAAC,EAAE,cAAM,CAAC,GAAG,CAAC,IAAI,CAAC,cAAM,CAAC;oBACxC,CAAC,gBAAM,CAAC,MAAM,CAAC,EAAE,cAAM,CAAC,KAAK,CAAC,IAAI,CAAC,cAAM,CAAC;oBAC1C,CAAC,gBAAM,CAAC,OAAO,CAAC,EAAE,cAAM,CAAC,MAAM,CAAC,IAAI,CAAC,cAAM,CAAC;oBAC5C,CAAC,gBAAM,CAAC,OAAO,CAAC,EAAE,cAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAM,CAAC;oBAC1C,CAAC,gBAAM,CAAC,SAAS,CAAC,EAAE,cAAM,CAAC,MAAM,CAAC,IAAI,CAAC,cAAM,CAAC;oBAC9C,CAAC,gBAAM,CAAC,OAAO,CAAC,EAAE,cAAM,CAAC,MAAM,CAAC,IAAI,CAAC,cAAM,CAAC;iBAC7C,CAAC,MAAM,CAAC,CAAA;YACX,CAAC;YACD,QAAQ,EAAE,cAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAM,CAAC;YAClC,GAAG,EAAE,cAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAM,CAAC;SAC9B,CAAA;KACF;SAAM;QACL,OAAO;YACL,SAAS,CAAC,MAAuD;gBAC/D,OAAO,gBAAC,CAAC,QAAQ,CAAA;YACnB,CAAC;YACD,QAAQ,EAAE,gBAAC,CAAC,QAAQ;YACpB,GAAG,EAAE,gBAAC,CAAC,QAAQ;SAChB,CAAA;KACF;AACH,CAAC;AA1BD,8BA0BC","sourcesContent":["import _ from 'lodash'\nimport colors from 'colors/safe'\nimport Status from '../status'\nimport { messages } from '@cucumber/messages'\n\ncolors.enable()\n\nexport type IColorFn = (text: string) => string\n\nexport interface IColorFns {\n forStatus: (\n status: messages.TestStepFinished.TestStepResult.Status\n ) => IColorFn\n location: IColorFn\n tag: IColorFn\n}\n\nexport default function getColorFns(enabled: boolean): IColorFns {\n if (enabled) {\n return {\n forStatus(status: messages.TestStepFinished.TestStepResult.Status) {\n return {\n [Status.AMBIGUOUS]: colors.red.bind(colors),\n [Status.FAILED]: colors.red.bind(colors),\n [Status.PASSED]: colors.green.bind(colors),\n [Status.PENDING]: colors.yellow.bind(colors),\n [Status.SKIPPED]: colors.cyan.bind(colors),\n [Status.UNDEFINED]: colors.yellow.bind(colors),\n [Status.UNKNOWN]: colors.yellow.bind(colors),\n }[status]\n },\n location: colors.gray.bind(colors),\n tag: colors.cyan.bind(colors),\n }\n } else {\n return {\n forStatus(status: messages.TestStepFinished.TestStepResult.Status) {\n return _.identity\n },\n location: _.identity,\n tag: _.identity,\n }\n }\n}\n"]}
1
+ {"version":3,"file":"get_color_fns.js","sourceRoot":"","sources":["../../src/formatter/get_color_fns.ts"],"names":[],"mappings":";;;;;AAAA,uDAAgC;AAGhC,cAAM,CAAC,MAAM,EAAE,CAAA;AAcf,SAAwB,WAAW,CAAC,OAAgB;IAClD,IAAI,OAAO,EAAE;QACX,OAAO;YACL,SAAS,CAAC,MAA4B;gBACpC,OAAO;oBACL,SAAS,EAAE,cAAM,CAAC,GAAG,CAAC,IAAI,CAAC,cAAM,CAAC;oBAClC,MAAM,EAAE,cAAM,CAAC,GAAG,CAAC,IAAI,CAAC,cAAM,CAAC;oBAC/B,MAAM,EAAE,cAAM,CAAC,KAAK,CAAC,IAAI,CAAC,cAAM,CAAC;oBACjC,OAAO,EAAE,cAAM,CAAC,MAAM,CAAC,IAAI,CAAC,cAAM,CAAC;oBACnC,OAAO,EAAE,cAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAM,CAAC;oBACjC,SAAS,EAAE,cAAM,CAAC,MAAM,CAAC,IAAI,CAAC,cAAM,CAAC;oBACrC,OAAO,EAAE,cAAM,CAAC,MAAM,CAAC,IAAI,CAAC,cAAM,CAAC;iBACpC,CAAC,MAAM,CAAC,CAAA;YACX,CAAC;YACD,QAAQ,EAAE,cAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAM,CAAC;YAClC,GAAG,EAAE,cAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAM,CAAC;YAC7B,SAAS,EAAE,cAAM,CAAC,KAAK,CAAC,IAAI,CAAC,cAAM,CAAC;YACpC,WAAW,EAAE,cAAM,CAAC,GAAG,CAAC,IAAI,CAAC,cAAM,CAAC;YACpC,YAAY,EAAE,cAAM,CAAC,GAAG,CAAC,IAAI,CAAC,cAAM,CAAC;YACrC,UAAU,EAAE,cAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAM,CAAC;SACrC,CAAA;KACF;SAAM;QACL,OAAO;YACL,SAAS,CAAC,MAA4B;gBACpC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;YACjB,CAAC;YACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAClB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACb,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACrB,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtB,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACrB,CAAA;KACF;AACH,CAAC;AAlCD,8BAkCC","sourcesContent":["import colors from 'colors/safe'\nimport { TestStepResultStatus } from '@cucumber/messages'\n\ncolors.enable()\n\nexport type IColorFn = (text: string) => string\n\nexport interface IColorFns {\n forStatus: (status: TestStepResultStatus) => IColorFn\n location: IColorFn\n tag: IColorFn\n diffAdded: IColorFn\n diffRemoved: IColorFn\n errorMessage: IColorFn\n errorStack: IColorFn\n}\n\nexport default function getColorFns(enabled: boolean): IColorFns {\n if (enabled) {\n return {\n forStatus(status: TestStepResultStatus) {\n return {\n AMBIGUOUS: colors.red.bind(colors),\n FAILED: colors.red.bind(colors),\n PASSED: colors.green.bind(colors),\n PENDING: colors.yellow.bind(colors),\n SKIPPED: colors.cyan.bind(colors),\n UNDEFINED: colors.yellow.bind(colors),\n UNKNOWN: colors.yellow.bind(colors),\n }[status]\n },\n location: colors.gray.bind(colors),\n tag: colors.cyan.bind(colors),\n diffAdded: colors.green.bind(colors),\n diffRemoved: colors.red.bind(colors),\n errorMessage: colors.red.bind(colors),\n errorStack: colors.grey.bind(colors),\n }\n } else {\n return {\n forStatus(status: TestStepResultStatus) {\n return (x) => x\n },\n location: (x) => x,\n tag: (x) => x,\n diffAdded: (x) => x,\n diffRemoved: (x) => x,\n errorMessage: (x) => x,\n errorStack: (x) => x,\n }\n }\n}\n"]}
@@ -1,32 +1,29 @@
1
1
  /// <reference types="node" />
2
- import { Dictionary } from 'lodash';
3
- import { messages } from '@cucumber/messages';
2
+ import * as messages from '@cucumber/messages';
4
3
  import { EventEmitter } from 'events';
5
- import { Query } from '@cucumber/query';
6
4
  export interface ITestCaseAttempt {
7
5
  attempt: number;
8
- gherkinDocument: messages.IGherkinDocument;
9
- pickle: messages.IPickle;
10
- stepAttachments: Dictionary<messages.IAttachment[]>;
11
- stepResults: Dictionary<messages.TestStepFinished.ITestStepResult>;
12
- testCase: messages.ITestCase;
13
- worstTestStepResult: messages.TestStepFinished.ITestStepResult;
6
+ gherkinDocument: messages.GherkinDocument;
7
+ pickle: messages.Pickle;
8
+ stepAttachments: Record<string, messages.Attachment[]>;
9
+ stepResults: Record<string, messages.TestStepResult>;
10
+ testCase: messages.TestCase;
11
+ worstTestStepResult: messages.TestStepResult;
14
12
  }
15
13
  export default class EventDataCollector {
16
14
  private gherkinDocumentMap;
17
15
  private pickleMap;
18
16
  private testCaseMap;
19
17
  private testCaseAttemptDataMap;
20
- readonly undefinedParameterTypes: messages.IUndefinedParameterType[];
21
- readonly query: Query;
18
+ readonly undefinedParameterTypes: messages.UndefinedParameterType[];
22
19
  constructor(eventBroadcaster: EventEmitter);
23
- getGherkinDocument(uri: string): messages.IGherkinDocument;
24
- getPickle(pickleId: string): messages.IPickle;
20
+ getGherkinDocument(uri: string): messages.GherkinDocument;
21
+ getPickle(pickleId: string): messages.Pickle;
25
22
  getTestCaseAttempts(): ITestCaseAttempt[];
26
23
  getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt;
27
24
  parseEnvelope(envelope: messages.Envelope): void;
28
- initTestCaseAttempt(testCaseStarted: messages.ITestCaseStarted): void;
29
- storeAttachment({ testCaseStartedId, testStepId, body, mediaType, }: messages.IAttachment): void;
30
- storeTestStepResult({ testCaseStartedId, testStepId, testStepResult, }: messages.ITestStepFinished): void;
31
- storeTestCaseResult({ testCaseStartedId }: messages.ITestCaseFinished): void;
25
+ private initTestCaseAttempt;
26
+ storeAttachment(attachment: messages.Attachment): void;
27
+ storeTestStepResult({ testCaseStartedId, testStepId, testStepResult, }: messages.TestStepFinished): void;
28
+ storeTestCaseResult({ testCaseStartedId }: messages.TestCaseFinished): void;
32
29
  }
@@ -20,8 +20,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  const lodash_1 = __importStar(require("lodash"));
23
+ const messages = __importStar(require("@cucumber/messages"));
23
24
  const value_checker_1 = require("../../value_checker");
24
- const query_1 = require("@cucumber/query");
25
25
  class EventDataCollector {
26
26
  constructor(eventBroadcaster) {
27
27
  this.gherkinDocumentMap = {};
@@ -29,7 +29,6 @@ class EventDataCollector {
29
29
  this.testCaseMap = {};
30
30
  this.testCaseAttemptDataMap = {};
31
31
  this.undefinedParameterTypes = [];
32
- this.query = new query_1.Query();
33
32
  eventBroadcaster.on('envelope', this.parseEnvelope.bind(this));
34
33
  }
35
34
  getGherkinDocument(uri) {
@@ -58,7 +57,6 @@ class EventDataCollector {
58
57
  };
59
58
  }
60
59
  parseEnvelope(envelope) {
61
- this.query.update(envelope);
62
60
  if (value_checker_1.doesHaveValue(envelope.gherkinDocument)) {
63
61
  this.gherkinDocumentMap[envelope.gherkinDocument.uri] =
64
62
  envelope.gherkinDocument;
@@ -91,24 +89,32 @@ class EventDataCollector {
91
89
  testCaseId: testCaseStarted.testCaseId,
92
90
  stepAttachments: {},
93
91
  stepResults: {},
94
- worstTestStepResult: {},
92
+ worstTestStepResult: {
93
+ willBeRetried: false,
94
+ duration: { seconds: 0, nanos: 0 },
95
+ status: messages.TestStepResultStatus.UNKNOWN,
96
+ },
95
97
  };
96
98
  }
97
- storeAttachment({ testCaseStartedId, testStepId, body, mediaType, }) {
99
+ storeAttachment(attachment) {
100
+ const { testCaseStartedId, testStepId } = attachment;
101
+ // TODO: we shouldn't have to check if these properties have values - they are non-nullable
98
102
  if (value_checker_1.doesHaveValue(testCaseStartedId) && value_checker_1.doesHaveValue(testStepId)) {
99
103
  const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId];
100
104
  if (value_checker_1.doesNotHaveValue(stepAttachments[testStepId])) {
101
105
  stepAttachments[testStepId] = [];
102
106
  }
103
- stepAttachments[testStepId].push({ body, mediaType });
107
+ stepAttachments[testStepId].push(attachment);
104
108
  }
105
109
  }
106
110
  storeTestStepResult({ testCaseStartedId, testStepId, testStepResult, }) {
107
- this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] = testStepResult;
111
+ this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] =
112
+ testStepResult;
108
113
  }
109
114
  storeTestCaseResult({ testCaseStartedId }) {
110
115
  const stepResults = lodash_1.values(this.testCaseAttemptDataMap[testCaseStartedId].stepResults);
111
- this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult = this.query.getWorstTestStepResult(stepResults);
116
+ this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult =
117
+ messages.getWorstTestStepResult(stepResults);
112
118
  }
113
119
  }
114
120
  exports.default = EventDataCollector;
@@ -1 +1 @@
1
- {"version":3,"file":"event_data_collector.js","sourceRoot":"","sources":["../../../src/formatter/helpers/event_data_collector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,iDAA8C;AAE9C,uDAAqE;AAErE,2CAAuC;AAoBvC,MAAqB,kBAAkB;IAQrC,YAAY,gBAA8B;QAPlC,uBAAkB,GAA0C,EAAE,CAAA;QAC9D,cAAS,GAAiC,EAAE,CAAA;QAC5C,gBAAW,GAAmC,EAAE,CAAA;QAChD,2BAAsB,GAAqC,EAAE,CAAA;QAC5D,4BAAuB,GAAuC,EAAE,CAAA;QAChE,UAAK,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AAe,CAAC,OAAO;YAChC,UAAU,EAAE,eAAe,CAAC,UAAU;YACtC,eAAe,EAAE,EAAE;YACnB,WAAW,EAAE,EAAE;YACf,mBAAmB,EAAE,EAAE;SACxB,CAAA;IACH,CAAC;IAED,eAAe,CAAC,EACd,iBAAiB,EACjB,UAAU,EACV,IAAI,EACJ,SAAS,GACY;QACrB,IAAI,6BAAa,CAAC,iBAAiB,CAAC,IAAI,6BAAa,CAAC,UAAU,CAAC,EAAE;YACjE,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAA;YAC1E,IAAI,gCAAgB,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,EAAE;gBACjD,eAAe,CAAC,UAAU,CAAC,GAAG,EAAE,CAAA;aACjC;YACD,eAAe,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;SACtD;IACH,CAAC;IAED,mBAAmB,CAAC,EAClB,iBAAiB,EACjB,UAAU,EACV,cAAc,GACa;QAC3B,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CACxD,UAAU,CACX,GAAG,cAAc,CAAA;IACpB,CAAC;IAED,mBAAmB,CAAC,EAAE,iBAAiB,EAA8B;QACnE,MAAM,WAAW,GAAG,eAAM,CACxB,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAC3D,CAAA;QACD,IAAI,CAAC,sBAAsB,CACzB,iBAAiB,CAClB,CAAC,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAA;IACxE,CAAC;CACF;AA1GD,qCA0GC","sourcesContent":["import _, { Dictionary, values } from 'lodash'\nimport { messages } from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\nimport { EventEmitter } from 'events'\nimport { Query } from '@cucumber/query'\n\ninterface ITestCaseAttemptData {\n attempt: number\n testCaseId: string\n stepAttachments: Dictionary<messages.IAttachment[]>\n stepResults: Dictionary<messages.TestStepFinished.ITestStepResult>\n worstTestStepResult: messages.TestStepFinished.ITestStepResult\n}\n\nexport interface ITestCaseAttempt {\n attempt: number\n gherkinDocument: messages.IGherkinDocument\n pickle: messages.IPickle\n stepAttachments: Dictionary<messages.IAttachment[]>\n stepResults: Dictionary<messages.TestStepFinished.ITestStepResult>\n testCase: messages.ITestCase\n worstTestStepResult: messages.TestStepFinished.ITestStepResult\n}\n\nexport default class EventDataCollector {\n private gherkinDocumentMap: Dictionary<messages.IGherkinDocument> = {}\n private pickleMap: Dictionary<messages.IPickle> = {}\n private testCaseMap: Dictionary<messages.ITestCase> = {}\n private testCaseAttemptDataMap: Dictionary<ITestCaseAttemptData> = {}\n readonly undefinedParameterTypes: messages.IUndefinedParameterType[] = []\n readonly query = new Query()\n\n constructor(eventBroadcaster: EventEmitter) {\n eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n }\n\n getGherkinDocument(uri: string): messages.IGherkinDocument {\n return this.gherkinDocumentMap[uri]\n }\n\n getPickle(pickleId: string): messages.IPickle {\n return this.pickleMap[pickleId]\n }\n\n getTestCaseAttempts(): ITestCaseAttempt[] {\n return _.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {\n return this.getTestCaseAttempt(testCaseStartedId)\n })\n }\n\n getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\n const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId]\n const testCase = this.testCaseMap[testCaseAttemptData.testCaseId]\n const pickle = this.pickleMap[testCase.pickleId]\n return {\n gherkinDocument: this.gherkinDocumentMap[pickle.uri],\n pickle,\n testCase,\n attempt: testCaseAttemptData.attempt,\n stepAttachments: testCaseAttemptData.stepAttachments,\n stepResults: testCaseAttemptData.stepResults,\n worstTestStepResult: testCaseAttemptData.worstTestStepResult,\n }\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n this.query.update(envelope)\n if (doesHaveValue(envelope.gherkinDocument)) {\n this.gherkinDocumentMap[envelope.gherkinDocument.uri] =\n envelope.gherkinDocument\n } else if (doesHaveValue(envelope.pickle)) {\n this.pickleMap[envelope.pickle.id] = envelope.pickle\n } else if (doesHaveValue(envelope.undefinedParameterType)) {\n this.undefinedParameterTypes.push(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.testCaseMap[envelope.testCase.id] = envelope.testCase\n } else if (doesHaveValue(envelope.testCaseStarted)) {\n this.initTestCaseAttempt(envelope.testCaseStarted)\n } else if (doesHaveValue(envelope.attachment)) {\n this.storeAttachment(envelope.attachment)\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.storeTestStepResult(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.storeTestCaseResult(envelope.testCaseFinished)\n }\n }\n\n initTestCaseAttempt(testCaseStarted: messages.ITestCaseStarted): void {\n this.testCaseAttemptDataMap[testCaseStarted.id] = {\n attempt: testCaseStarted.attempt,\n testCaseId: testCaseStarted.testCaseId,\n stepAttachments: {},\n stepResults: {},\n worstTestStepResult: {},\n }\n }\n\n storeAttachment({\n testCaseStartedId,\n testStepId,\n body,\n mediaType,\n }: messages.IAttachment): void {\n if (doesHaveValue(testCaseStartedId) && doesHaveValue(testStepId)) {\n const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId]\n if (doesNotHaveValue(stepAttachments[testStepId])) {\n stepAttachments[testStepId] = []\n }\n stepAttachments[testStepId].push({ body, mediaType })\n }\n }\n\n storeTestStepResult({\n testCaseStartedId,\n testStepId,\n testStepResult,\n }: messages.ITestStepFinished): void {\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults[\n testStepId\n ] = testStepResult\n }\n\n storeTestCaseResult({ testCaseStartedId }: messages.ITestCaseFinished): void {\n const stepResults = values(\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults\n )\n this.testCaseAttemptDataMap[\n testCaseStartedId\n ].worstTestStepResult = this.query.getWorstTestStepResult(stepResults)\n }\n}\n"]}
1
+ {"version":3,"file":"event_data_collector.js","sourceRoot":"","sources":["../../../src/formatter/helpers/event_data_collector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,iDAAkC;AAClC,6DAA8C;AAC9C,uDAAqE;AAqBrE,MAAqB,kBAAkB;IAOrC,YAAY,gBAA8B;QANlC,uBAAkB,GAA6C,EAAE,CAAA;QACjE,cAAS,GAAoC,EAAE,CAAA;QAC/C,gBAAW,GAAsC,EAAE,CAAA;QACnD,2BAAsB,GAAyC,EAAE,CAAA;QAChE,4BAAuB,GAAsC,EAAE,CAAA;QAGtE,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAChE,CAAC;IAED,kBAAkB,CAAC,GAAW;QAC5B,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;IAED,SAAS,CAAC,QAAgB;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IACjC,CAAC;IAED,mBAAmB;QACjB,OAAO,gBAAC,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE;YACnE,OAAO,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,kBAAkB,CAAC,iBAAyB;QAC1C,MAAM,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAA;QAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAA;QACjE,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAChD,OAAO;YACL,eAAe,EAAE,IAAI,CAAC,k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AA;IAClB,CAAC;IAED,mBAAmB,CAAC,EAAE,iBAAiB,EAA6B;QAClE,MAAM,WAAW,GAAG,eAAM,CACxB,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAC3D,CAAA;QACD,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,mBAAmB;YAChE,QAAQ,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAA;IAChD,CAAC;CACF;AAvGD,qCAuGC","sourcesContent":["import _, { values } from 'lodash'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\nimport { EventEmitter } from 'events'\n\ninterface ITestCaseAttemptData {\n attempt: number\n testCaseId: string\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n worstTestStepResult: messages.TestStepResult\n}\n\nexport interface ITestCaseAttempt {\n attempt: number\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n testCase: messages.TestCase\n worstTestStepResult: messages.TestStepResult\n}\n\nexport default class EventDataCollector {\n private gherkinDocumentMap: Record<string, messages.GherkinDocument> = {}\n private pickleMap: Record<string, messages.Pickle> = {}\n private testCaseMap: Record<string, messages.TestCase> = {}\n private testCaseAttemptDataMap: Record<string, ITestCaseAttemptData> = {}\n readonly undefinedParameterTypes: messages.UndefinedParameterType[] = []\n\n constructor(eventBroadcaster: EventEmitter) {\n eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n }\n\n getGherkinDocument(uri: string): messages.GherkinDocument {\n return this.gherkinDocumentMap[uri]\n }\n\n getPickle(pickleId: string): messages.Pickle {\n return this.pickleMap[pickleId]\n }\n\n getTestCaseAttempts(): ITestCaseAttempt[] {\n return _.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {\n return this.getTestCaseAttempt(testCaseStartedId)\n })\n }\n\n getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\n const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId]\n const testCase = this.testCaseMap[testCaseAttemptData.testCaseId]\n const pickle = this.pickleMap[testCase.pickleId]\n return {\n gherkinDocument: this.gherkinDocumentMap[pickle.uri],\n pickle,\n testCase,\n attempt: testCaseAttemptData.attempt,\n stepAttachments: testCaseAttemptData.stepAttachments,\n stepResults: testCaseAttemptData.stepResults,\n worstTestStepResult: testCaseAttemptData.worstTestStepResult,\n }\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n if (doesHaveValue(envelope.gherkinDocument)) {\n this.gherkinDocumentMap[envelope.gherkinDocument.uri] =\n envelope.gherkinDocument\n } else if (doesHaveValue(envelope.pickle)) {\n this.pickleMap[envelope.pickle.id] = envelope.pickle\n } else if (doesHaveValue(envelope.undefinedParameterType)) {\n this.undefinedParameterTypes.push(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.testCaseMap[envelope.testCase.id] = envelope.testCase\n } else if (doesHaveValue(envelope.testCaseStarted)) {\n this.initTestCaseAttempt(envelope.testCaseStarted)\n } else if (doesHaveValue(envelope.attachment)) {\n this.storeAttachment(envelope.attachment)\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.storeTestStepResult(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.storeTestCaseResult(envelope.testCaseFinished)\n }\n }\n\n private initTestCaseAttempt(testCaseStarted: messages.TestCaseStarted): void {\n this.testCaseAttemptDataMap[testCaseStarted.id] = {\n attempt: testCaseStarted.attempt,\n testCaseId: testCaseStarted.testCaseId,\n stepAttachments: {},\n stepResults: {},\n worstTestStepResult: {\n willBeRetried: false,\n duration: { seconds: 0, nanos: 0 },\n status: messages.TestStepResultStatus.UNKNOWN,\n },\n }\n }\n\n storeAttachment(attachment: messages.Attachment): void {\n const { testCaseStartedId, testStepId } = attachment\n // TODO: we shouldn't have to check if these properties have values - they are non-nullable\n if (doesHaveValue(testCaseStartedId) && doesHaveValue(testStepId)) {\n const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId]\n if (doesNotHaveValue(stepAttachments[testStepId])) {\n stepAttachments[testStepId] = []\n }\n stepAttachments[testStepId].push(attachment)\n }\n }\n\n storeTestStepResult({\n testCaseStartedId,\n testStepId,\n testStepResult,\n }: messages.TestStepFinished): void {\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] =\n testStepResult\n }\n\n storeTestCaseResult({ testCaseStartedId }: messages.TestCaseFinished): void {\n const stepResults = values(\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults\n )\n this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult =\n messages.getWorstTestStepResult(stepResults)\n }\n}\n"]}
@@ -1,6 +1,5 @@
1
- import { Dictionary } from 'lodash';
2
- import { messages } from '@cucumber/messages';
3
- export declare function getGherkinStepMap(gherkinDocument: messages.IGherkinDocument): Dictionary<messages.GherkinDocument.Feature.IStep>;
4
- export declare function getGherkinScenarioMap(gherkinDocument: messages.IGherkinDocument): Dictionary<messages.GherkinDocument.Feature.IScenario>;
5
- export declare function getGherkinExampleRuleMap(gherkinDocument: messages.IGherkinDocument): Dictionary<messages.GherkinDocument.Feature.FeatureChild.IRule>;
6
- export declare function getGherkinScenarioLocationMap(gherkinDocument: messages.IGherkinDocument): Dictionary<messages.ILocation>;
1
+ import * as messages from '@cucumber/messages';
2
+ export declare function getGherkinStepMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Step>;
3
+ export declare function getGherkinScenarioMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Scenario>;
4
+ export declare function getGherkinExampleRuleMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Rule>;
5
+ export declare function getGherkinScenarioLocationMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Location>;
@@ -39,10 +39,7 @@ function getGherkinScenarioMap(gherkinDocument) {
39
39
  .flatten()
40
40
  .filter('scenario')
41
41
  .map('scenario')
42
- .map((scenario) => [
43
- scenario.id,
44
- scenario,
45
- ])
42
+ .map((scenario) => [scenario.id, scenario])
46
43
  .fromPairs()
47
44
  .value();
48
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/gherkin_document_parser.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsC;AAEtC,uDAAmD;AAEnD,SAAgB,iBAAiB,CAC/B,eAA0C;IAE1C,OAAO,gBAAC,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC7C,GAAG,CAAC,qBAAqB,CAAC;SAC1B,OAAO,EAAE;SACT,GAAG,CAAC,OAAO,CAAC;SACZ,OAAO,EAAE;SACT,GAAG,CAAC,CAAC,IAA4C,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;SACtE,SAAS,EAAE;SACX,KAAK,EAAE,CAAA;AACZ,CAAC;AAXD,8CAWC;AAED,SAAS,qBAAqB,CAC5B,KAAqD;IAKrD,IAAI,6BAAa,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;QACnC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;KAC1B;SAAM,IAAI,6BAAa,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACpC,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAC3C,6BAAa,CAAC,SAAS,CAAC,UAAU,CAAC;YACjC,CAAC,CAAC,SAAS,CAAC,UAAU;YACtB,CAAC,CAAC,SAAS,CAAC,QAAQ,CACvB,CAAA;KACF;IACD,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;AACzB,CAAC;AAED,SAAgB,qBAAqB,CACnC,eAA0C;IAE1C,OAAO,gBAAC,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC7C,GAAG,CAAC,CAAC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W,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAA;QACnC,IAAI,6BAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACpC,gBAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;iBACvB,GAAG,CAAC,WAAW,CAAC;iBAChB,OAAO,EAAE;iBACT,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACpB,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAA;YAC9C,CAAC,CAAC;iBACD,KAAK,EAAE,CAAA;SACX;IACH,CAAC,CACF,CAAA;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAtBD,sEAsBC","sourcesContent":["import _, { Dictionary } from 'lodash'\nimport { messages } from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport function getGherkinStepMap(\n gherkinDocument: messages.IGherkinDocument\n): Dictionary<messages.GherkinDocument.Feature.IStep> {\n return _.chain(gherkinDocument.feature.children)\n .map(extractStepContainers)\n .flatten()\n .map('steps')\n .flatten()\n .map((step: messages.GherkinDocument.Feature.IStep) => [step.id, step])\n .fromPairs()\n .value()\n}\n\nfunction extractStepContainers(\n child: messages.GherkinDocument.Feature.IFeatureChild\n): Array<\n | messages.GherkinDocument.Feature.IScenario\n | messages.GherkinDocument.Feature.IBackground\n> {\n if (doesHaveValue(child.background)) {\n return [child.background]\n } else if (doesHaveValue(child.rule)) {\n return child.rule.children.map((ruleChild) =>\n doesHaveValue(ruleChild.background)\n ? ruleChild.background\n : ruleChild.scenario\n )\n }\n return [child.scenario]\n}\n\nexport function getGherkinScenarioMap(\n gherkinDocument: messages.IGherkinDocument\n): Dictionary<messages.GherkinDocument.Feature.IScenario> {\n return _.chain(gherkinDocument.feature.children)\n .map((child: messages.GherkinDocument.Feature.IFeatureChild) => {\n if (doesHaveValue(child.rule)) {\n return child.rule.children\n }\n return [child]\n })\n .flatten()\n .filter('scenario')\n .map('scenario')\n .map((scenario: messages.GherkinDocument.Feature.IScenario) => [\n scenario.id,\n scenario,\n ])\n .fromPairs()\n .value()\n}\n\nexport function getGherkinExampleRuleMap(\n gherkinDocument: messages.IGherkinDocument\n): Dictionary<messages.GherkinDocument.Feature.FeatureChild.IRule> {\n return _.chain(gherkinDocument.feature.children)\n .filter('rule')\n .map('rule')\n .map((rule) => {\n return rule.children\n .filter((child) => doesHaveValue(child.scenario))\n .map((child) => [child.scenario.id, rule])\n })\n .flatten()\n .fromPairs()\n .value()\n}\n\nexport function getGherkinScenarioLocationMap(\n gherkinDocument: messages.IGherkinDocument\n): Dictionary<messages.ILocation> {\n const locationMap: Dictionary<messages.ILocation> = {}\n const scenarioMap: Dictionary<messages.GherkinDocument.Feature.IScenario> = getGherkinScenarioMap(\n gherkinDocument\n )\n _.entries<messages.GherkinDocument.Feature.IScenario>(scenarioMap).forEach(\n ([id, scenario]) => {\n locationMap[id] = scenario.location\n if (doesHaveValue(scenario.examples)) {\n _.chain(scenario.examples)\n .map('tableBody')\n .flatten()\n .forEach((tableRow) => {\n locationMap[tableRow.id] = tableRow.location\n })\n .value()\n }\n }\n )\n return locationMap\n}\n"]}
1
+ {"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/gherkin_document_parser.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsB;AAEtB,uDAAmD;AAEnD,SAAgB,iBAAiB,CAC/B,eAAyC;IAEzC,OAAO,gBAAC,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC7C,GAAG,CAAC,qBAAqB,CAAC;SAC1B,OAAO,EAAE;SACT,GAAG,CAAC,OAAO,CAAC;SACZ,OAAO,EAAE;SACT,GAAG,CAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;SAC7C,SAAS,EAAE;SACX,KAAK,EAAE,CAAA;AACZ,CAAC;AAX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AG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,OAAO,IAAI,CAAC,QAAQ;aACjB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,6BAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;aAChD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;IAC9C,CAAC,CAAC;SACD,OAAO,EAAE;SACT,SAAS,EAAE;SACX,KAAK,EAAE,CAAA;AACZ,CAAC;AAdD,4DAcC;AAED,SAAgB,6BAA6B,CAC3C,eAAyC;IAEzC,MAAM,WAAW,GAAsC,EAAE,CAAA;IACzD,MAAM,WAAW,GACf,qBAAqB,CAAC,eAAe,CAAC,CAAA;IACxC,gBAAC,CAAC,OAAO,CAAoB,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE;QACnE,WAAW,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAA;QACnC,IAAI,6BAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACpC,gBAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;iBACvB,GAAG,CAAC,WAAW,CAAC;iBAChB,OAAO,EAAE;iBACT,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACpB,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAA;YAC9C,CAAC,CAAC;iBACD,KAAK,EAAE,CAAA;SACX;IACH,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC;AAnBD,sEAmBC","sourcesContent":["import _ from 'lodash'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport function getGherkinStepMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Step> {\n return _.chain(gherkinDocument.feature.children)\n .map(extractStepContainers)\n .flatten()\n .map('steps')\n .flatten()\n .map((step: messages.Step) => [step.id, step])\n .fromPairs()\n .value()\n}\n\nfunction extractStepContainers(\n child: messages.FeatureChild\n): Array<messages.Scenario | messages.Background> {\n if (doesHaveValue(child.background)) {\n return [child.background]\n } else if (doesHaveValue(child.rule)) {\n return child.rule.children.map((ruleChild) =>\n doesHaveValue(ruleChild.background)\n ? ruleChild.background\n : ruleChild.scenario\n )\n }\n return [child.scenario]\n}\n\nexport function getGherkinScenarioMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Scenario> {\n return _.chain(gherkinDocument.feature.children)\n .map((child: messages.FeatureChild) => {\n if (doesHaveValue(child.rule)) {\n return child.rule.children\n }\n return [child]\n })\n .flatten()\n .filter('scenario')\n .map('scenario')\n .map((scenario: messages.Scenario) => [scenario.id, scenario])\n .fromPairs()\n .value()\n}\n\nexport function getGherkinExampleRuleMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Rule> {\n return _.chain(gherkinDocument.feature.children)\n .filter('rule')\n .map('rule')\n .map((rule) => {\n return rule.children\n .filter((child) => doesHaveValue(child.scenario))\n .map((child) => [child.scenario.id, rule])\n })\n .flatten()\n .fromPairs()\n .value()\n}\n\nexport function getGherkinScenarioLocationMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Location> {\n const locationMap: Record<string, messages.Location> = {}\n const scenarioMap: Record<string, messages.Scenario> =\n getGherkinScenarioMap(gherkinDocument)\n _.entries<messages.Scenario>(scenarioMap).forEach(([id, scenario]) => {\n locationMap[id] = scenario.location\n if (doesHaveValue(scenario.examples)) {\n _.chain(scenario.examples)\n .map('tableBody')\n .flatten()\n .forEach((tableRow) => {\n locationMap[tableRow.id] = tableRow.location\n })\n .value()\n }\n })\n return locationMap\n}\n"]}
@@ -1,11 +1,11 @@
1
- import { messages } from '@cucumber/messages';
1
+ import * as messages from '@cucumber/messages';
2
2
  import { IColorFns } from '../get_color_fns';
3
3
  import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
4
4
  import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
5
5
  import { ITestCaseAttempt } from './event_data_collector';
6
- export declare function isFailure(result: messages.TestStepFinished.ITestStepResult): boolean;
7
- export declare function isWarning(result: messages.TestStepFinished.ITestStepResult): boolean;
8
- export declare function isIssue(result: messages.TestStepFinished.ITestStepResult): boolean;
6
+ export declare function isFailure(result: messages.TestStepResult): boolean;
7
+ export declare function isWarning(result: messages.TestStepResult): boolean;
8
+ export declare function isIssue(result: messages.TestStepResult): boolean;
9
9
  export interface IFormatIssueRequest {
10
10
  colorFns: IColorFns;
11
11
  cwd: string;
@@ -15,5 +15,5 @@ export interface IFormatIssueRequest {
15
15
  supportCodeLibrary: ISupportCodeLibrary;
16
16
  }
17
17
  export declare function formatIssue({ colorFns, cwd, number, snippetBuilder, testCaseAttempt, supportCodeLibrary, }: IFormatIssueRequest): string;
18
- export declare function formatUndefinedParameterTypes(undefinedParameterTypes: messages.IUndefinedParameterType[]): string;
19
- export declare function formatUndefinedParameterType(parameterType: messages.IUndefinedParameterType): string;
18
+ export declare function formatUndefinedParameterTypes(undefinedParameterTypes: messages.UndefinedParameterType[]): string;
19
+ export declare function formatUndefinedParameterType(parameterType: messages.UndefinedParameterType): string;
@@ -5,17 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.formatUndefinedParameterType = exports.formatUndefinedParameterTypes = exports.formatIssue = exports.isIssue = exports.isWarning = exports.isFailure = void 0;
7
7
  const indent_string_1 = __importDefault(require("indent-string"));
8
- const status_1 = __importDefault(require("../../status"));
9
8
  const test_case_attempt_formatter_1 = require("./test_case_attempt_formatter");
10
9
  function isFailure(result) {
11
- return (result.status === status_1.default.AMBIGUOUS ||
12
- result.status === status_1.default.UNDEFINED ||
13
- (result.status === status_1.default.FAILED && !result.willBeRetried));
10
+ return (result.status === 'AMBIGUOUS' ||
11
+ result.status === 'UNDEFINED' ||
12
+ (result.status === 'FAILED' && !result.willBeRetried));
14
13
  }
15
14
  exports.isFailure = isFailure;
16
15
  function isWarning(result) {
17
- return (result.status === status_1.default.PENDING ||
18
- (result.status === status_1.default.FAILED && result.willBeRetried));
16
+ return (result.status === 'PENDING' ||
17
+ (result.status === 'FAILED' && result.willBeRetried));
19
18
  }
20
19
  exports.isWarning = isWarning;
21
20
  function isIssue(result) {