@cucumber/cucumber 7.2.1 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/lib/cli/configuration_builder.js +3 -3
  3. package/lib/cli/configuration_builder.js.map +1 -1
  4. package/lib/cli/helpers.js +40 -18
  5. package/lib/cli/helpers.js.map +1 -1
  6. package/lib/cli/index.js +23 -15
  7. package/lib/cli/index.js.map +1 -1
  8. package/lib/cli/profile_loader.d.ts +1 -2
  9. package/lib/cli/profile_loader.js.map +1 -1
  10. package/lib/formatter/get_color_fns.d.ts +2 -2
  11. package/lib/formatter/get_color_fns.js +7 -8
  12. package/lib/formatter/get_color_fns.js.map +1 -1
  13. package/lib/formatter/helpers/event_data_collector.d.ts +14 -17
  14. package/lib/formatter/helpers/event_data_collector.js +14 -8
  15. package/lib/formatter/helpers/event_data_collector.js.map +1 -1
  16. package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -6
  17. package/lib/formatter/helpers/gherkin_document_parser.js +1 -4
  18. package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
  19. package/lib/formatter/helpers/issue_helpers.d.ts +6 -6
  20. package/lib/formatter/helpers/issue_helpers.js +5 -6
  21. package/lib/formatter/helpers/issue_helpers.js.map +1 -1
  22. package/lib/formatter/helpers/pickle_parser.d.ts +9 -10
  23. package/lib/formatter/helpers/pickle_parser.js.map +1 -1
  24. package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -2
  25. package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
  26. package/lib/formatter/helpers/summary_helpers.d.ts +2 -2
  27. package/lib/formatter/helpers/summary_helpers.js +32 -14
  28. package/lib/formatter/helpers/summary_helpers.js.map +1 -1
  29. package/lib/formatter/helpers/test_case_attempt_formatter.js +33 -14
  30. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
  31. package/lib/formatter/helpers/test_case_attempt_parser.d.ts +5 -5
  32. package/lib/formatter/helpers/test_case_attempt_parser.js +27 -9
  33. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
  34. package/lib/formatter/helpers/usage_helpers/index.d.ts +3 -3
  35. package/lib/formatter/helpers/usage_helpers/index.js +30 -13
  36. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
  37. package/lib/formatter/html_formatter.js +1 -1
  38. package/lib/formatter/html_formatter.js.map +1 -1
  39. package/lib/formatter/json_formatter.d.ts +21 -27
  40. package/lib/formatter/json_formatter.js +50 -23
  41. package/lib/formatter/json_formatter.js.map +1 -1
  42. package/lib/formatter/message_formatter.js +1 -1
  43. package/lib/formatter/message_formatter.js.map +1 -1
  44. package/lib/formatter/progress_bar_formatter.d.ts +6 -6
  45. package/lib/formatter/progress_bar_formatter.js +3 -3
  46. package/lib/formatter/progress_bar_formatter.js.map +1 -1
  47. package/lib/formatter/progress_formatter.d.ts +2 -2
  48. package/lib/formatter/progress_formatter.js +29 -10
  49. package/lib/formatter/progress_formatter.js.map +1 -1
  50. package/lib/formatter/rerun_formatter.js +22 -4
  51. package/lib/formatter/rerun_formatter.js.map +1 -1
  52. package/lib/formatter/snippets_formatter.js +21 -2
  53. package/lib/formatter/snippets_formatter.js.map +1 -1
  54. package/lib/formatter/step_definition_snippet_builder/index.d.ts +3 -3
  55. package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
  56. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
  57. package/lib/formatter/summary_formatter.d.ts +2 -2
  58. package/lib/formatter/summary_formatter.js.map +1 -1
  59. package/lib/formatter/usage_formatter.js +22 -3
  60. package/lib/formatter/usage_formatter.js.map +1 -1
  61. package/lib/formatter/usage_json_formatter.js.map +1 -1
  62. package/lib/index.d.ts +14 -12
  63. package/lib/index.js +3 -3
  64. package/lib/index.js.map +1 -1
  65. package/lib/models/data_table.d.ts +3 -4
  66. package/lib/models/data_table.js.map +1 -1
  67. package/lib/models/definition.d.ts +2 -2
  68. package/lib/models/definition.js.map +1 -1
  69. package/lib/models/test_case_hook_definition.d.ts +2 -2
  70. package/lib/models/test_case_hook_definition.js.map +1 -1
  71. package/lib/models/test_step_hook_definition.d.ts +2 -2
  72. package/lib/models/test_step_hook_definition.js.map +1 -1
  73. package/lib/pickle_filter.d.ts +9 -11
  74. package/lib/pickle_filter.js +4 -4
  75. package/lib/pickle_filter.js.map +1 -1
  76. package/lib/runtime/assemble_test_cases.d.ts +13 -0
  77. package/lib/runtime/assemble_test_cases.js +88 -0
  78. package/lib/runtime/assemble_test_cases.js.map +1 -0
  79. package/lib/runtime/attachment_manager/index.d.ts +2 -2
  80. package/lib/runtime/attachment_manager/index.js +23 -4
  81. package/lib/runtime/attachment_manager/index.js.map +1 -1
  82. package/lib/runtime/helpers.d.ts +2 -2
  83. package/lib/runtime/helpers.js.map +1 -1
  84. package/lib/runtime/index.d.ts +4 -3
  85. package/lib/runtime/index.js +31 -13
  86. package/lib/runtime/index.js.map +1 -1
  87. package/lib/runtime/parallel/command_types.d.ts +10 -9
  88. package/lib/runtime/parallel/command_types.js.map +1 -1
  89. package/lib/runtime/parallel/coordinator.d.ts +10 -9
  90. package/lib/runtime/parallel/coordinator.js +54 -43
  91. package/lib/runtime/parallel/coordinator.js.map +1 -1
  92. package/lib/runtime/parallel/worker.d.ts +2 -2
  93. package/lib/runtime/parallel/worker.js +8 -14
  94. package/lib/runtime/parallel/worker.js.map +1 -1
  95. package/lib/runtime/step_runner.d.ts +3 -3
  96. package/lib/runtime/step_runner.js +16 -12
  97. package/lib/runtime/step_runner.js.map +1 -1
  98. package/lib/runtime/stopwatch.d.ts +4 -4
  99. package/lib/runtime/stopwatch.js +21 -2
  100. package/lib/runtime/stopwatch.js.map +1 -1
  101. package/lib/runtime/{pickle_runner.d.ts → test_case_runner.d.ts} +16 -32
  102. package/lib/runtime/{pickle_runner.js → test_case_runner.js} +104 -147
  103. package/lib/runtime/test_case_runner.js.map +1 -0
  104. package/lib/step_arguments.d.ts +4 -4
  105. package/lib/step_arguments.js.map +1 -1
  106. package/lib/support_code_library_builder/index.d.ts +9 -7
  107. package/lib/support_code_library_builder/index.js +10 -10
  108. package/lib/support_code_library_builder/index.js.map +1 -1
  109. package/lib/support_code_library_builder/types.d.ts +20 -22
  110. package/lib/support_code_library_builder/types.js.map +1 -1
  111. package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
  112. package/lib/support_code_library_builder/world.d.ts +7 -1
  113. package/lib/support_code_library_builder/world.js.map +1 -1
  114. package/lib/time.d.ts +2 -10
  115. package/lib/time.js +24 -48
  116. package/lib/time.js.map +1 -1
  117. package/package.json +33 -33
  118. package/lib/runtime/pickle_runner.js.map +0 -1
  119. package/lib/status.d.ts +0 -3
  120. package/lib/status.js +0 -5
  121. package/lib/status.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"message_formatter.js","sourceRoot":"","sources":["../../src/formatter/message_formatter.ts"],"names":[],"mappings":";;;;;AAAA,yCAAgD;AAGhD,MAAqB,gBAAiB,SAAQ,UAAS;IACrD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE,CACtE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CACnD,CAAA;IACH,CAAC;CACF;AAPD,mCAOC","sourcesContent":["import Formatter, { IFormatterOptions } from '.'\nimport { messages } from '@cucumber/messages'\n\nexport default class MessageFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) =>\n this.log(JSON.stringify(envelope.toJSON()) + '\\n')\n )\n }\n}\n"]}
1
+ {"version":3,"file":"message_formatter.js","sourceRoot":"","sources":["../../src/formatter/message_formatter.ts"],"names":[],"mappings":";;;;;AAAA,yCAAgD;AAGhD,MAAqB,gBAAiB,SAAQ,UAAS;IACrD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE,CACtE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAC1C,CAAA;IACH,CAAC;CACF;AAPD,mCAOC","sourcesContent":["import Formatter, { IFormatterOptions } from '.'\nimport * as messages from '@cucumber/messages'\n\nexport default class MessageFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) =>\n this.log(JSON.stringify(envelope) + '\\n')\n )\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import Formatter, { IFormatterOptions } from './';
2
2
  import ProgressBar from 'progress';
3
- import { messages } from '@cucumber/messages';
3
+ import * as messages from '@cucumber/messages';
4
4
  export default class ProgressBarFormatter extends Formatter {
5
5
  private numberOfSteps;
6
6
  private testRunStarted;
@@ -9,9 +9,9 @@ export default class ProgressBarFormatter extends Formatter {
9
9
  constructor(options: IFormatterOptions);
10
10
  incrementStepCount(pickleId: string): void;
11
11
  initializeProgressBar(): void;
12
- logProgress({ testStepId, testCaseStartedId, }: messages.ITestStepFinished): void;
13
- logUndefinedParametertype(parameterType: messages.IUndefinedParameterType): void;
14
- logErrorIfNeeded(testCaseFinished: messages.ITestCaseFinished): void;
15
- logSummary(testRunFinished: messages.ITestRunFinished): void;
16
- parseEnvelope(envelope: messages.IEnvelope): void;
12
+ logProgress({ testStepId, testCaseStartedId, }: messages.TestStepFinished): void;
13
+ logUndefinedParametertype(parameterType: messages.UndefinedParameterType): void;
14
+ logErrorIfNeeded(testCaseFinished: messages.TestCaseFinished): void;
15
+ logSummary(testRunFinished: messages.TestRunFinished): void;
16
+ parseEnvelope(envelope: messages.Envelope): void;
17
17
  }
@@ -36,7 +36,7 @@ class ProgressBarFormatter extends _1.default {
36
36
  logProgress({ testStepId, testCaseStartedId, }) {
37
37
  const { testCase } = this.eventDataCollector.getTestCaseAttempt(testCaseStartedId);
38
38
  const testStep = testCase.testSteps.find((s) => s.id === testStepId);
39
- if (testStep.pickleStepId !== '') {
39
+ if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
40
40
  this.progressBar.tick();
41
41
  }
42
42
  }
@@ -74,8 +74,8 @@ class ProgressBarFormatter extends _1.default {
74
74
  if (value_checker_1.doesHaveValue(envelope.undefinedParameterType)) {
75
75
  this.logUndefinedParametertype(envelope.undefinedParameterType);
76
76
  }
77
- else if (value_checker_1.doesHaveValue(envelope.pickle)) {
78
- this.incrementStepCount(envelope.pickle.id);
77
+ else if (value_checker_1.doesHaveValue(envelope.testCase)) {
78
+ this.incrementStepCount(envelope.testCase.pickleId);
79
79
  }
80
80
  else if (value_checker_1.doesHaveValue(envelope.testStepStarted)) {
81
81
  this.initializeProgressBar();
@@ -1 +1 @@
1
- {"version":3,"file":"progress_bar_formatter.js","sourceRoot":"","sources":["../../src/formatter/progress_bar_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAA+D;AAC/D,0CAAiD;AACjD,wDAAkC;AAGlC,oDAAgE;AAChE,2DAAsE;AACtE,kCAAmD;AAEnD,qGAAqG;AACrG,MAAqB,oBAAqB,SAAQ,UAAS;IAMzD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QACtE,IAAI,CAAC,aAAa,GAAG,CAAC,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAA;IACrB,CAAC;IAED,kBAAkB,CAAC,QAAgB;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,QAAQ,CA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AClD,IAAI,CAAC,qBAAqB,EAAE,CAAA;SAC7B;aAAM,IAAI,6BAAa,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;YACnD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;SAC5C;aAAM,IAAI,6BAAa,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;YACnD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;SACjD;aAAM,IAAI,6BAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;YACjD,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAA;SAC9C;aAAM,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;YAClD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;SAC1C;IACH,CAAC;CACF;AA/GD,uCA+GC","sourcesContent":["import { formatIssue, formatSummary, isIssue } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport ProgressBar from 'progress'\nimport { WriteStream as TtyWriteStream } from 'tty'\nimport { messages } from '@cucumber/messages'\nimport { doesHaveValue, valueOrDefault } from '../value_checker'\nimport { formatUndefinedParameterType } from './helpers/issue_helpers'\nimport { durationBetweenTimestamps } from '../time'\n\n// Inspired by https://github.com/thekompanee/fuubar and https://github.com/martinciu/fuubar-cucumber\nexport default class ProgressBarFormatter extends Formatter {\n private numberOfSteps: number\n private testRunStarted: messages.ITestRunStarted\n private issueCount: number\n public progressBar: ProgressBar\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n this.numberOfSteps = 0\n this.issueCount = 0\n }\n\n incrementStepCount(pickleId: string): void {\n const pickle = this.eventDataCollector.getPickle(pickleId)\n this.numberOfSteps += pickle.steps.length\n }\n\n initializeProgressBar(): void {\n if (doesHaveValue(this.progressBar)) {\n return\n }\n this.progressBar = new ProgressBar(':current/:total steps [:bar] ', {\n clear: true,\n incomplete: ' ',\n stream: this.stream,\n total: this.numberOfSteps,\n width: valueOrDefault((this.stream as TtyWriteStream).columns, 80),\n })\n }\n\n logProgress({\n testStepId,\n testCaseStartedId,\n }: messages.ITestStepFinished): void {\n const { testCase } = this.eventDataCollector.getTestCaseAttempt(\n testCaseStartedId\n )\n const testStep = testCase.testSteps.find((s) => s.id === testStepId)\n if (testStep.pickleStepId !== '') {\n this.progressBar.tick()\n }\n }\n\n logUndefinedParametertype(\n parameterType: messages.IUndefinedParameterType\n ): void {\n this.log(\n `Undefined parameter type: ${formatUndefinedParameterType(\n parameterType\n )}\\n`\n )\n }\n\n logErrorIfNeeded(testCaseFinished: messages.ITestCaseFinished): void {\n const { worstTestStepResult } = this.eventDataCollector.getTestCaseAttempt(\n testCaseFinished.testCaseStartedId\n )\n if (isIssue(worstTestStepResult)) {\n this.issueCount += 1\n const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(\n testCaseFinished.testCaseStartedId\n )\n this.progressBar.interrupt(\n formatIssue({\n colorFns: this.colorFns,\n cwd: this.cwd,\n number: this.issueCount,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n )\n if (worstTestStepResult.willBeRetried) {\n const stepsToRetry = testCaseAttempt.pickle.steps.length\n this.progressBar.tick(-stepsToRetry)\n }\n }\n }\n\n logSummary(testRunFinished: messages.ITestRunFinished): void {\n const testRunDuration = durationBetweenTimestamps(\n this.testRunStarted.timestamp,\n testRunFinished.timestamp\n )\n this.log(\n formatSummary({\n colorFns: this.colorFns,\n testCaseAttempts: this.eventDataCollector.getTestCaseAttempts(),\n testRunDuration,\n })\n )\n }\n\n parseEnvelope(envelope: messages.IEnvelope): void {\n if (doesHaveValue(envelope.undefinedParameterType)) {\n this.logUndefinedParametertype(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.pickle)) {\n this.incrementStepCount(envelope.pickle.id)\n } else if (doesHaveValue(envelope.testStepStarted)) {\n this.initializeProgressBar()\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.logProgress(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.logErrorIfNeeded(envelope.testCaseFinished)\n } else if (doesHaveValue(envelope.testRunStarted)) {\n this.testRunStarted = envelope.testRunStarted\n } else if (doesHaveValue(envelope.testRunFinished)) {\n this.logSummary(envelope.testRunFinished)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"progress_bar_formatter.js","sourceRoot":"","sources":["../../src/formatter/progress_bar_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAA+D;AAC/D,0CAAiD;AACjD,wDAAkC;AAGlC,oDAAgE;AAChE,2DAAsE;AACtE,kCAAmD;AAEnD,qGAAqG;AACrG,MAAqB,oBAAqB,SAAQ,UAAS;IAMzD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QACtE,IAAI,CAAC,aAAa,GAAG,CAAC,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAA;IACrB,CAAC;IAED,kBAAkB,CAAC,QAAgB;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;QAC1D,IAAI,CAAC,aAAa,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAA;IAC3C,CAAC;IAED,qBAAqB;QACnB,IAAI,6BAAa,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YACnC,OAAM;SACP;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,kBAAW,CAAC,+BAA+B,EAAE;YAClE,KAAK,EAAE,IAAI;YACX,UAAU,EAAE,GAAG;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI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QAAQ,CAAC,cAAc,CAAC,EAAE;YACjD,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAA;SAC9C;aAAM,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;YAClD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;SAC1C;IACH,CAAC;CACF;AA9GD,uCA8GC","sourcesContent":["import { formatIssue, formatSummary, isIssue } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport ProgressBar from 'progress'\nimport { WriteStream as TtyWriteStream } from 'tty'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue, valueOrDefault } from '../value_checker'\nimport { formatUndefinedParameterType } from './helpers/issue_helpers'\nimport { durationBetweenTimestamps } from '../time'\n\n// Inspired by https://github.com/thekompanee/fuubar and https://github.com/martinciu/fuubar-cucumber\nexport default class ProgressBarFormatter extends Formatter {\n private numberOfSteps: number\n private testRunStarted: messages.TestRunStarted\n private issueCount: number\n public progressBar: ProgressBar\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n this.numberOfSteps = 0\n this.issueCount = 0\n }\n\n incrementStepCount(pickleId: string): void {\n const pickle = this.eventDataCollector.getPickle(pickleId)\n this.numberOfSteps += pickle.steps.length\n }\n\n initializeProgressBar(): void {\n if (doesHaveValue(this.progressBar)) {\n return\n }\n this.progressBar = new ProgressBar(':current/:total steps [:bar] ', {\n clear: true,\n incomplete: ' ',\n stream: this.stream,\n total: this.numberOfSteps,\n width: valueOrDefault((this.stream as TtyWriteStream).columns, 80),\n })\n }\n\n logProgress({\n testStepId,\n testCaseStartedId,\n }: messages.TestStepFinished): void {\n const { testCase } =\n this.eventDataCollector.getTestCaseAttempt(testCaseStartedId)\n const testStep = testCase.testSteps.find((s) => s.id === testStepId)\n if (doesHaveValue(testStep.pickleStepId)) {\n this.progressBar.tick()\n }\n }\n\n logUndefinedParametertype(\n parameterType: messages.UndefinedParameterType\n ): void {\n this.log(\n `Undefined parameter type: ${formatUndefinedParameterType(\n parameterType\n )}\\n`\n )\n }\n\n logErrorIfNeeded(testCaseFinished: messages.TestCaseFinished): void {\n const { worstTestStepResult } = this.eventDataCollector.getTestCaseAttempt(\n testCaseFinished.testCaseStartedId\n )\n if (isIssue(worstTestStepResult)) {\n this.issueCount += 1\n const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(\n testCaseFinished.testCaseStartedId\n )\n this.progressBar.interrupt(\n formatIssue({\n colorFns: this.colorFns,\n cwd: this.cwd,\n number: this.issueCount,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n )\n if (worstTestStepResult.willBeRetried) {\n const stepsToRetry = testCaseAttempt.pickle.steps.length\n this.progressBar.tick(-stepsToRetry)\n }\n }\n }\n\n logSummary(testRunFinished: messages.TestRunFinished): void {\n const testRunDuration = durationBetweenTimestamps(\n this.testRunStarted.timestamp,\n testRunFinished.timestamp\n )\n this.log(\n formatSummary({\n colorFns: this.colorFns,\n testCaseAttempts: this.eventDataCollector.getTestCaseAttempts(),\n testRunDuration,\n })\n )\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n if (doesHaveValue(envelope.undefinedParameterType)) {\n this.logUndefinedParametertype(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.incrementStepCount(envelope.testCase.pickleId)\n } else if (doesHaveValue(envelope.testStepStarted)) {\n this.initializeProgressBar()\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.logProgress(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.logErrorIfNeeded(envelope.testCaseFinished)\n } else if (doesHaveValue(envelope.testRunStarted)) {\n this.testRunStarted = envelope.testRunStarted\n } else if (doesHaveValue(envelope.testRunFinished)) {\n this.logSummary(envelope.testRunFinished)\n }\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import SummaryFormatter from './summary_formatter';
2
2
  import { IFormatterOptions } from './index';
3
- import { messages } from '@cucumber/messages';
4
- import ITestStepFinished = messages.ITestStepFinished;
3
+ import * as messages from '@cucumber/messages';
4
+ import ITestStepFinished = messages.TestStepFinished;
5
5
  export default class ProgressFormatter extends SummaryFormatter {
6
6
  constructor(options: IFormatterOptions);
7
7
  logProgress({ testStepResult: { status } }: ITestStepFinished): void;
@@ -1,19 +1,38 @@
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
  const summary_formatter_1 = __importDefault(require("./summary_formatter"));
7
- const status_1 = __importDefault(require("../status"));
8
26
  const value_checker_1 = require("../value_checker");
9
- const STATUS_CHARACTER_MAPPING = {
10
- [status_1.default.AMBIGUOUS]: 'A',
11
- [status_1.default.FAILED]: 'F',
12
- [status_1.default.PASSED]: '.',
13
- [status_1.default.PENDING]: 'P',
14
- [status_1.default.SKIPPED]: '-',
15
- [status_1.default.UNDEFINED]: 'U',
16
- };
27
+ const messages = __importStar(require("@cucumber/messages"));
28
+ const STATUS_CHARACTER_MAPPING = new Map([
29
+ [messages.TestStepResultStatus.AMBIGUOUS, 'A'],
30
+ [messages.TestStepResultStatus.FAILED, 'F'],
31
+ [messages.TestStepResultStatus.PASSED, '.'],
32
+ [messages.TestStepResultStatus.PENDING, 'P'],
33
+ [messages.TestStepResultStatus.SKIPPED, '-'],
34
+ [messages.TestStepResultStatus.UNDEFINED, 'U'],
35
+ ]);
17
36
  class ProgressFormatter extends summary_formatter_1.default {
18
37
  constructor(options) {
19
38
  options.eventBroadcaster.on('envelope', (envelope) => {
@@ -27,7 +46,7 @@ class ProgressFormatter extends summary_formatter_1.default {
27
46
  super(options);
28
47
  }
29
48
  logProgress({ testStepResult: { status } }) {
30
- const character = this.colorFns.forStatus(status)(STATUS_CHARACTER_MAPPING[status]);
49
+ const character = this.colorFns.forStatus(status)(STATUS_CHARACTER_MAPPING.get(status));
31
50
  this.log(character);
32
51
  }
33
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"progress_formatter.js","sourceRoot":"","sources":["../../src/formatter/progress_formatter.ts"],"names":[],"mappings":";;;;;AAAA,4EAAkD;AAClD,uDAA8B;AAC9B,oDAAgD;AAMhD,MAAM,wBAAwB,GAA8B;IAC1D,CAAC,gBAAM,CAAC,SAAS,CAAC,EAAE,GAAG;IACvB,CAAC,gBAAM,CAAC,MAAM,CAAC,EAAE,GAAG;IACpB,CAAC,gBAAM,CAAC,MAAM,CAAC,EAAE,GAAG;IACpB,CAAC,gBAAM,CAAC,OAAO,CAAC,EAAE,GAAG;IACrB,CAAC,gBAAM,CAAC,OAAO,CAAC,EAAE,GAAG;IACrB,CAAC,gBAAM,CAAC,SAAS,CAAC,EAAE,GAAG;CACxB,CAAA;AAED,MAAqB,iBAAkB,SAAQ,2BAAgB;IAC7D,YAAY,OAA0B;QACpC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;aACjB;iBAAM,IAAI,6BAAa,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;gBACnD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;aAC5C;QACH,CAAC,CAAC,CAAA;QACF,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;IAED,WAAW,CAAC,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,EAAqB;QAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAC/C,wBAAwB,CAAC,MAAM,CAAC,CACjC,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACrB,CAAC;CACF;AAlBD,oCAkBC","sourcesContent":["import SummaryFormatter from './summary_formatter'\nimport Status from '../status'\nimport { doesHaveValue } from '../value_checker'\nimport { IFormatterOptions } from './index'\nimport { messages } from '@cucumber/messages'\nimport IEnvelope = messages.IEnvelope\nimport ITestStepFinished = messages.ITestStepFinished\n\nconst STATUS_CHARACTER_MAPPING: { [key: number]: string } = {\n [Status.AMBIGUOUS]: 'A',\n [Status.FAILED]: 'F',\n [Status.PASSED]: '.',\n [Status.PENDING]: 'P',\n [Status.SKIPPED]: '-',\n [Status.UNDEFINED]: 'U',\n}\n\nexport default class ProgressFormatter extends SummaryFormatter {\n constructor(options: IFormatterOptions) {\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.log('\\n\\n')\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.logProgress(envelope.testStepFinished)\n }\n })\n super(options)\n }\n\n logProgress({ testStepResult: { status } }: ITestStepFinished): void {\n const character = this.colorFns.forStatus(status)(\n STATUS_CHARACTER_MAPPING[status]\n )\n this.log(character)\n }\n}\n"]}
1
+ {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AAC,CACrC,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACrB,CAAC;CACF;AAlBD,oCAkBC","sourcesContent":["import SummaryFormatter from './summary_formatter'\nimport { doesHaveValue } from '../value_checker'\nimport { IFormatterOptions } from './index'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\nimport ITestStepFinished = messages.TestStepFinished\n\nconst STATUS_CHARACTER_MAPPING: Map<messages.TestStepResultStatus, string> =\n new Map([\n [messages.TestStepResultStatus.AMBIGUOUS, 'A'],\n [messages.TestStepResultStatus.FAILED, 'F'],\n [messages.TestStepResultStatus.PASSED, '.'],\n [messages.TestStepResultStatus.PENDING, 'P'],\n [messages.TestStepResultStatus.SKIPPED, '-'],\n [messages.TestStepResultStatus.UNDEFINED, 'U'],\n ])\n\nexport default class ProgressFormatter extends SummaryFormatter {\n constructor(options: IFormatterOptions) {\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.log('\\n\\n')\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.logProgress(envelope.testStepFinished)\n }\n })\n super(options)\n }\n\n logProgress({ testStepResult: { status } }: ITestStepFinished): void {\n const character = this.colorFns.forStatus(status)(\n STATUS_CHARACTER_MAPPING.get(status)\n )\n this.log(character)\n }\n}\n"]}
@@ -1,14 +1,32 @@
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
  const lodash_1 = __importDefault(require("lodash"));
7
26
  const _1 = __importDefault(require("./"));
8
- const status_1 = __importDefault(require("../status"));
9
- const path_1 = __importDefault(require("path"));
10
27
  const gherkin_document_parser_1 = require("./helpers/gherkin_document_parser");
11
28
  const value_checker_1 = require("../value_checker");
29
+ const messages = __importStar(require("@cucumber/messages"));
12
30
  const DEFAULT_SEPARATOR = '\n';
13
31
  class RerunFormatter extends _1.default {
14
32
  constructor(options) {
@@ -24,8 +42,8 @@ class RerunFormatter extends _1.default {
24
42
  logFailedTestCases() {
25
43
  const mapping = {};
26
44
  lodash_1.default.each(this.eventDataCollector.getTestCaseAttempts(), ({ gherkinDocument, pickle, worstTestStepResult }) => {
27
- if (worstTestStepResult.status !== status_1.default.PASSED) {
28
- const relativeUri = path_1.default.relative(this.cwd, pickle.uri);
45
+ if (worstTestStepResult.status !== messages.TestStepResultStatus.PASSED) {
46
+ const relativeUri = pickle.uri;
29
47
  const line = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument)[lodash_1.default.last(pickle.astNodeIds)].line;
30
48
  if (value_checker_1.doesNotHaveValue(mapping[relativeUri])) {
31
49
  mapping[relativeUri] = [];
@@ -1 +1 @@
1
- {"version":3,"file":"rerun_formatter.js","sourceRoot":"","sources":["../../src/formatter/rerun_formatter.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,0CAAiD;AACjD,uDAA8B;AAC9B,gDAAuB;AACvB,+EAAiF;AACjF,oDAIyB;AAGzB,MAAM,iBAAiB,GAA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GAAG,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC;aAC1B,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;aAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;aACpB,KAAK,EAAE,CAAA;QACV,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC;CACF;AArCD,iCAqCC","sourcesContent":["import _ from 'lodash'\nimport Formatter, { IFormatterOptions } from './'\nimport Status from '../status'\nimport path from 'path'\nimport { getGherkinScenarioLocationMap } from './helpers/gherkin_document_parser'\nimport {\n doesHaveValue,\n doesNotHaveValue,\n valueOrDefault,\n} from '../value_checker'\nimport { messages } from '@cucumber/messages'\n\nconst DEFAULT_SEPARATOR = '\\n'\n\ninterface UriToLinesMap {\n [uri: string]: number[]\n}\n\nexport default class RerunFormatter extends Formatter {\n private readonly separator: string\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: messages.IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logFailedTestCases()\n }\n })\n const rerunOptions = valueOrDefault(options.parsedArgvOptions.rerun, {})\n this.separator = valueOrDefault(rerunOptions.separator, DEFAULT_SEPARATOR)\n }\n\n logFailedTestCases(): void {\n const mapping: UriToLinesMap = {}\n _.each(\n this.eventDataCollector.getTestCaseAttempts(),\n ({ gherkinDocument, pickle, worstTestStepResult }) => {\n if (worstTestStepResult.status !== Status.PASSED) {\n const relativeUri = path.relative(this.cwd, pickle.uri)\n const line = getGherkinScenarioLocationMap(gherkinDocument)[\n _.last(pickle.astNodeIds)\n ].line\n if (doesNotHaveValue(mapping[relativeUri])) {\n mapping[relativeUri] = []\n }\n mapping[relativeUri].push(line)\n }\n }\n )\n const text = _.chain(mapping)\n .map((lines, uri) => `${uri}:${lines.join(':')}`)\n .join(this.separator)\n .value()\n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AAC,CAAC,EAAE;oBAC1C,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;iBAC1B;gBACD,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aAChC;QACH,CAAC,CACF,CAAA;QACD,MAAM,IAAI,GAAG,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC;aAC1B,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;aAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;aACpB,KAAK,EAAE,CAAA;QACV,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC;CACF;AAxCD,iCAwCC","sourcesContent":["import _ from 'lodash'\nimport Formatter, { IFormatterOptions } from './'\nimport { getGherkinScenarioLocationMap } from './helpers/gherkin_document_parser'\nimport {\n doesHaveValue,\n doesNotHaveValue,\n valueOrDefault,\n} from '../value_checker'\nimport * as messages from '@cucumber/messages'\n\nconst DEFAULT_SEPARATOR = '\\n'\n\ninterface UriToLinesMap {\n [uri: string]: number[]\n}\n\nexport default class RerunFormatter extends Formatter {\n private readonly separator: string\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logFailedTestCases()\n }\n })\n const rerunOptions = valueOrDefault(options.parsedArgvOptions.rerun, {})\n this.separator = valueOrDefault(rerunOptions.separator, DEFAULT_SEPARATOR)\n }\n\n logFailedTestCases(): void {\n const mapping: UriToLinesMap = {}\n _.each(\n this.eventDataCollector.getTestCaseAttempts(),\n ({ gherkinDocument, pickle, worstTestStepResult }) => {\n if (\n worstTestStepResult.status !== messages.TestStepResultStatus.PASSED\n ) {\n const relativeUri = pickle.uri\n const line =\n getGherkinScenarioLocationMap(gherkinDocument)[\n _.last(pickle.astNodeIds)\n ].line\n if (doesNotHaveValue(mapping[relativeUri])) {\n mapping[relativeUri] = []\n }\n mapping[relativeUri].push(line)\n }\n }\n )\n const text = _.chain(mapping)\n .map((lines, uri) => `${uri}:${lines.join(':')}`)\n .join(this.separator)\n .value()\n this.log(text)\n }\n}\n"]}
@@ -1,12 +1,31 @@
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
  const _1 = __importDefault(require("./"));
7
- const status_1 = __importDefault(require("../status"));
8
26
  const helpers_1 = require("./helpers");
9
27
  const value_checker_1 = require("../value_checker");
28
+ const messages = __importStar(require("@cucumber/messages"));
10
29
  class SnippetsFormatter extends _1.default {
11
30
  constructor(options) {
12
31
  super(options);
@@ -26,7 +45,7 @@ class SnippetsFormatter extends _1.default {
26
45
  testCaseAttempt,
27
46
  });
28
47
  parsed.testSteps.forEach((testStep) => {
29
- if (testStep.result.status === status_1.default.UNDEFINED) {
48
+ if (testStep.result.status === messages.TestStepResultStatus.UNDEFINED) {
30
49
  snippets.push(testStep.snippet);
31
50
  }
32
51
  });
@@ -1 +1 @@
1
- {"version":3,"file":"snippets_formatter.js","sourceRoot":"","sources":["../../src/formatter/snippets_formatter.ts"],"names":[],"mappings":";;;;;AAAA,0CAAiD;AACjD,uDAA8B;AAC9B,uCAAgD;AAChD,oDAAgD;AAIhD,MAAqB,iBAAkB,SAAQ,UAAS;IACtD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,WAAW,EAAE,CAAA;aACnB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,WAAW;QACT,MAAM,QAAQ,GAAa,EAAE,CAAA;QAC7B,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE;YACxE,MAAM,MAAM,GAAG,8BAAoB,CAAC;gBAClC,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;aAChB,CAAC,CAAA;YACF,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACpC,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,gBAAM,CAAC,SAAS,EAAE;oBAC/C,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;iBAChC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,CAAC;CACF;AA3BD,oCA2BC","sourcesContent":["import Formatter, { IFormatterOptions } from './'\nimport Status from '../status'\nimport { parseTestCaseAttempt } from './helpers'\nimport { doesHaveValue } from '../value_checker'\nimport { messages } from '@cucumber/messages'\nimport IEnvelope = messages.IEnvelope\n\nexport default class SnippetsFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logSnippets()\n }\n })\n }\n\n logSnippets(): void {\n const snippets: string[] = []\n this.eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {\n const parsed = parseTestCaseAttempt({\n cwd: this.cwd,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n parsed.testSteps.forEach((testStep) => {\n if (testStep.result.status === Status.UNDEFINED) {\n snippets.push(testStep.snippet)\n }\n })\n })\n this.log(snippets.join('\\n\\n'))\n }\n}\n"]}
1
+ {"version":3,"file":"snippets_formatter.js","sourceRoot":"","sources":["../../src/formatter/snippets_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAiD;AACjD,uCAAgD;AAChD,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,iBAAkB,SAAQ,UAAS;IACtD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,WAAW,EAAE,CAAA;aACnB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,WAAW;QACT,MAAM,QAAQ,GAAa,EAAE,CAAA;QAC7B,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE;YACxE,MAAM,MAAM,GAAG,8BAAoB,CAAC;gBAClC,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;aAChB,CAAC,CAAA;YACF,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACpC,IACE,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAClE;oBACA,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;iBAChC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,CAAC;CACF;AA7BD,oCA6BC","sourcesContent":["import Formatter, { IFormatterOptions } from './'\nimport { parseTestCaseAttempt } from './helpers'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class SnippetsFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logSnippets()\n }\n })\n }\n\n logSnippets(): void {\n const snippets: string[] = []\n this.eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {\n const parsed = parseTestCaseAttempt({\n cwd: this.cwd,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n parsed.testSteps.forEach((testStep) => {\n if (\n testStep.result.status === messages.TestStepResultStatus.UNDEFINED\n ) {\n snippets.push(testStep.snippet)\n }\n })\n })\n this.log(snippets.join('\\n\\n'))\n }\n}\n"]}
@@ -1,14 +1,14 @@
1
1
  import { KeywordType } from '../helpers';
2
2
  import { ISnippetSnytax } from './snippet_syntax';
3
3
  import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions';
4
- import { messages } from '@cucumber/messages';
4
+ import * as messages from '@cucumber/messages';
5
5
  export interface INewStepDefinitionSnippetBuilderOptions {
6
6
  snippetSyntax: ISnippetSnytax;
7
7
  parameterTypeRegistry: ParameterTypeRegistry;
8
8
  }
9
9
  export interface IBuildRequest {
10
10
  keywordType: KeywordType;
11
- pickleStep: messages.Pickle.IPickleStep;
11
+ pickleStep: messages.PickleStep;
12
12
  }
13
13
  export default class StepDefinitionSnippetBuilder {
14
14
  private readonly snippetSyntax;
@@ -16,5 +16,5 @@ export default class StepDefinitionSnippetBuilder {
16
16
  constructor({ snippetSyntax, parameterTypeRegistry, }: INewStepDefinitionSnippetBuilderOptions);
17
17
  build({ keywordType, pickleStep }: IBuildRequest): string;
18
18
  getFunctionName(keywordType: KeywordType): string;
19
- getStepParameterNames(step: messages.Pickle.IPickleStep): string[];
19
+ getStepParameterNames(step: messages.PickleStep): string[];
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/index.ts"],"names":[],"mappings":";;AAAA,wCAAwC;AACxC,yDAAwD;AAExD,yEAGuC;AAEvC,uDAAmD;AAYnD,MAAqB,4BAA4B;IAI/C,YAAY,EACV,aAAa,EACb,qBAAqB,GACmB;QACxC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,2BAA2B,GAAG,IAAI,kDAA2B,CAChE,GAAG,EAAE,CAAC,qBAAqB,CAAC,cAAc,CAC3C,CAAA;IACH,CAAC;IAED,KAAK,CAAC,EAAE,WAAW,EAAE,UAAU,EAAiB;QAC9C,MAAM,OAAO,GACX,mEAAmE,CAAA;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QACtD,MAAM,oBAAoB,GAAG,IAAI,CAAC,2BAA2B,CAAC,mBAAmB,CAC/E,UAAU,CAAC,IAAI,CAChB,CAAA;QACD,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAA;QACjE,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YAC9B,OAAO;YACP,YAAY;YACZ,oBAAoB;YACpB,kBAAkB;SACnB,CAAC,CAAA;IACJ,CAAC;IAED,eAAe,CAAC,WAAwB;QACtC,QAAQ,WAAW,EAAE;YACnB,KAAK,qBAAW,CAAC,KAAK;gBACpB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,OAAO;gBACtB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,YAAY;gBAC3B,OAAO,OAAO,CAAA;SACjB;IACH,CAAC;IAED,qBAAqB,CAAC,IAAiC;QACrD,IAAI,6BAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAChC,MAAM,YAAY,GAAG,kCAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE;gBACpD,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;gBAC5B,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;aAC7B,CAAC,CAAA;YACF,OAAO,CAAC,YAAY,CAAC,CAAA;SACtB;QACD,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAnDD,+CAmDC","sourcesContent":["import { KeywordType } from '../helpers'\nimport { parseStepArgument } from '../../step_arguments'\nimport { ISnippetSnytax } from './snippet_syntax'\nimport {\n CucumberExpressionGenerator,\n ParameterTypeRegistry,\n} from '@cucumber/cucumber-expressions'\nimport { messages } from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport interface INewStepDefinitionSnippetBuilderOptions {\n snippetSyntax: ISnippetSnytax\n parameterTypeRegistry: ParameterTypeRegistry\n}\n\nexport interface IBuildRequest {\n keywordType: KeywordType\n pickleStep: messages.Pickle.IPickleStep\n}\n\nexport default class StepDefinitionSnippetBuilder {\n private readonly snippetSyntax: ISnippetSnytax\n private readonly cucumberExpressionGenerator: CucumberExpressionGenerator\n\n constructor({\n snippetSyntax,\n parameterTypeRegistry,\n }: INewStepDefinitionSnippetBuilderOptions) {\n this.snippetSyntax = snippetSyntax\n this.cucumberExpressionGenerator = new CucumberExpressionGenerator(\n () => parameterTypeRegistry.parameterTypes\n )\n }\n\n build({ keywordType, pickleStep }: IBuildRequest): string {\n const comment =\n 'Write code here that turns the phrase above into concrete actions'\n const functionName = this.getFunctionName(keywordType)\n const generatedExpressions = this.cucumberExpressionGenerator.generateExpressions(\n pickleStep.text\n )\n const stepParameterNames = this.getStepParameterNames(pickleStep)\n return this.snippetSyntax.build({\n comment,\n functionName,\n generatedExpressions,\n stepParameterNames,\n })\n }\n\n getFunctionName(keywordType: KeywordType): string {\n switch (keywordType) {\n case KeywordType.Event:\n return 'When'\n case KeywordType.Outcome:\n return 'Then'\n case KeywordType.Precondition:\n return 'Given'\n }\n }\n\n getStepParameterNames(step: messages.Pickle.IPickleStep): string[] {\n if (doesHaveValue(step.argument)) {\n const argumentName = parseStepArgument(step.argument, {\n dataTable: () => 'dataTable',\n docString: () => 'docString',\n })\n return [argumentName]\n }\n return []\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/index.ts"],"names":[],"mappings":";;AAAA,wCAAwC;AACxC,yDAAwD;AAExD,yEAGuC;AAEvC,uDAAmD;AAYnD,MAAqB,4BAA4B;IAI/C,YAAY,EACV,aAAa,EACb,qBAAqB,GACmB;QACxC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,2BAA2B,GAAG,IAAI,kDAA2B,CAChE,GAAG,EAAE,CAAC,qBAAqB,CAAC,cAAc,CAC3C,CAAA;IACH,CAAC;IAED,KAAK,CAAC,EAAE,WAAW,EAAE,UAAU,EAAiB;QAC9C,MAAM,OAAO,GACX,mEAAmE,CAAA;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QACtD,MAAM,oBAAoB,GACxB,IAAI,CAAC,2BAA2B,CAAC,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACvE,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAA;QACjE,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YAC9B,OAAO;YACP,YAAY;YACZ,oBAAoB;YACpB,kBAAkB;SACnB,CAAC,CAAA;IACJ,CAAC;IAED,eAAe,CAAC,WAAwB;QACtC,QAAQ,WAAW,EAAE;YACnB,KAAK,qBAAW,CAAC,KAAK;gBACpB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,OAAO;gBACtB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,YAAY;gBAC3B,OAAO,OAAO,CAAA;SACjB;IACH,CAAC;IAED,qBAAqB,CAAC,IAAyB;QAC7C,IAAI,6BAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAChC,MAAM,YAAY,GAAG,kCAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE;gBACpD,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;gBAC5B,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;aAC7B,CAAC,CAAA;YACF,OAAO,CAAC,YAAY,CAAC,CAAA;SACtB;QACD,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAlDD,+CAkDC","sourcesContent":["import { KeywordType } from '../helpers'\nimport { parseStepArgument } from '../../step_arguments'\nimport { ISnippetSnytax } from './snippet_syntax'\nimport {\n CucumberExpressionGenerator,\n ParameterTypeRegistry,\n} from '@cucumber/cucumber-expressions'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport interface INewStepDefinitionSnippetBuilderOptions {\n snippetSyntax: ISnippetSnytax\n parameterTypeRegistry: ParameterTypeRegistry\n}\n\nexport interface IBuildRequest {\n keywordType: KeywordType\n pickleStep: messages.PickleStep\n}\n\nexport default class StepDefinitionSnippetBuilder {\n private readonly snippetSyntax: ISnippetSnytax\n private readonly cucumberExpressionGenerator: CucumberExpressionGenerator\n\n constructor({\n snippetSyntax,\n parameterTypeRegistry,\n }: INewStepDefinitionSnippetBuilderOptions) {\n this.snippetSyntax = snippetSyntax\n this.cucumberExpressionGenerator = new CucumberExpressionGenerator(\n () => parameterTypeRegistry.parameterTypes\n )\n }\n\n build({ keywordType, pickleStep }: IBuildRequest): string {\n const comment =\n 'Write code here that turns the phrase above into concrete actions'\n const functionName = this.getFunctionName(keywordType)\n const generatedExpressions =\n this.cucumberExpressionGenerator.generateExpressions(pickleStep.text)\n const stepParameterNames = this.getStepParameterNames(pickleStep)\n return this.snippetSyntax.build({\n comment,\n functionName,\n generatedExpressions,\n stepParameterNames,\n })\n }\n\n getFunctionName(keywordType: KeywordType): string {\n switch (keywordType) {\n case KeywordType.Event:\n return 'When'\n case KeywordType.Outcome:\n return 'Then'\n case KeywordType.Precondition:\n return 'Given'\n }\n }\n\n getStepParameterNames(step: messages.PickleStep): string[] {\n if (doesHaveValue(step.argument)) {\n const argumentName = parseStepArgument(step.argument, {\n dataTable: () => 'dataTable',\n docString: () => 'docString',\n })\n return [argumentName]\n }\n return []\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"javascript_snippet_syntax.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/javascript_snippet_syntax.ts"],"names":[],"mappings":";;AAAA,qDAIyB;AAEzB,MAAM,aAAa,GAAG,UAAU,CAAA;AAEhC,MAAqB,uBAAuB;IAG1C,YAAY,gBAAkC;QAC5C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,EACJ,OAAO,EACP,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,GACS;QAC3B,IAAI,eAAe,GAAG,WAAW,CAAA;QACjC,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,UAAU,EAAE;YACzD,eAAe,GAAG,QAAQ,GAAG,eAAe,CAAA;SAC7C;aAAM,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,SAAS,EAAE;YAC/D,eAAe,IAAI,GAAG,CAAA;SACvB;QAED,IAAI,cAAsB,CAAA;QAC1B,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,QAAQ,EAAE;YACvD,cAAc,GAAG,GAAG,aAAa,oBAAoB,CAAA;SACtD;aAAM;YACL,cAAc,GAAG,mBAAmB,CAAA;SACrC;QAED,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,CAChD,CAAC,mBAAmB,EAAE,KAAK,EAAE,EAAE;YAC7B,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACvC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,cAAc,CAAC,MAAM,CACjE,kBAAkB,CACnB,CAAA;YACD,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,QAAQ,EAAE;gBACvD,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;aACtC;YACD,OAAO,GAAG,MAAM,GAAG,YAAY,KAAK,mBAAmB,CAAC,MAAM,CAAC,OAAO,CACpE,IAAI,EACJ,KAAK,CACN,MAAM,eAAe,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;QAC/D,CAAC,CACF,CAAA;QAED,OAAO,CACL,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,OAAO,IAAI;YAChD,KAAK,cAAc,IAAI;YACvB,KAAK,CACN,CAAA;IACH,CAAC;CACF;AAjDD,0CAiDC","sourcesContent":["import {\n ISnippetSnytax,\n ISnippetSyntaxBuildOptions,\n SnippetInterface,\n} from './snippet_syntax'\n\nconst CALLBACK_NAME = 'callback'\n\nexport default class JavaScriptSnippetSyntax implements ISnippetSnytax {\n private readonly snippetInterface: SnippetInterface\n\n constructor(snippetInterface: SnippetInterface) {\n this.snippetInterface = snippetInterface\n }\n\n build({\n comment,\n generatedExpressions,\n functionName,\n stepParameterNames,\n }: ISnippetSyntaxBuildOptions): string {\n let functionKeyword = 'function '\n if (this.snippetInterface === SnippetInterface.AsyncAwait) {\n functionKeyword = 'async ' + functionKeyword\n } else if (this.snippetInterface === SnippetInterface.Generator) {\n functionKeyword += '*'\n }\n\n let implementation: string\n if (this.snippetInterface === SnippetInterface.Callback) {\n implementation = `${CALLBACK_NAME}(null, 'pending');`\n } else {\n implementation = \"return 'pending';\"\n }\n\n const definitionChoices = generatedExpressions.map(\n (generatedExpression, index) => {\n const prefix = index === 0 ? '' : '// '\n const allParameterNames = generatedExpression.parameterNames.concat(\n stepParameterNames\n )\n if (this.snippetInterface === SnippetInterface.Callback) {\n allParameterNames.push(CALLBACK_NAME)\n }\n return `${prefix + functionName}('${generatedExpression.source.replace(\n /'/g,\n \"\\\\'\"\n )}', ${functionKeyword}(${allParameterNames.join(', ')}) {\\n`\n }\n )\n\n return (\n `${definitionChoices.join('')} // ${comment}\\n` +\n ` ${implementation}\\n` +\n '});'\n )\n }\n}\n"]}
1
+ {"version":3,"file":"javascript_snippet_syntax.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/javascript_snippet_syntax.ts"],"names":[],"mappings":";;AAAA,qDAIyB;AAEzB,MAAM,aAAa,GAAG,UAAU,CAAA;AAEhC,MAAqB,uBAAuB;IAG1C,YAAY,gBAAkC;QAC5C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,EACJ,OAAO,EACP,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,GACS;QAC3B,IAAI,eAAe,GAAG,WAAW,CAAA;QACjC,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,UAAU,EAAE;YACzD,eAAe,GAAG,QAAQ,GAAG,eAAe,CAAA;SAC7C;aAAM,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,SAAS,EAAE;YAC/D,eAAe,IAAI,GAAG,CAAA;SACvB;QAED,IAAI,cAAsB,CAAA;QAC1B,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,QAAQ,EAAE;YACvD,cAAc,GAAG,GAAG,aAAa,oBAAoB,CAAA;SACtD;aAAM;YACL,cAAc,GAAG,mBAAmB,CAAA;SACrC;QAED,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,CAChD,CAAC,mBAAmB,EAAE,KAAK,EAAE,EAAE;YAC7B,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACvC,MAAM,iBAAiB,GACrB,mBAAmB,CAAC,cAAc,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAA;YAC/D,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,QAAQ,EAAE;gBACvD,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;aACtC;YACD,OAAO,GAAG,MAAM,GAAG,YAAY,KAAK,mBAAmB,CAAC,MAAM,CAAC,OAAO,CACpE,IAAI,EACJ,KAAK,CACN,MAAM,eAAe,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;QAC/D,CAAC,CACF,CAAA;QAED,OAAO,CACL,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,OAAO,IAAI;YAChD,KAAK,cAAc,IAAI;YACvB,KAAK,CACN,CAAA;IACH,CAAC;CACF;AAhDD,0CAgDC","sourcesContent":["import {\n ISnippetSnytax,\n ISnippetSyntaxBuildOptions,\n SnippetInterface,\n} from './snippet_syntax'\n\nconst CALLBACK_NAME = 'callback'\n\nexport default class JavaScriptSnippetSyntax implements ISnippetSnytax {\n private readonly snippetInterface: SnippetInterface\n\n constructor(snippetInterface: SnippetInterface) {\n this.snippetInterface = snippetInterface\n }\n\n build({\n comment,\n generatedExpressions,\n functionName,\n stepParameterNames,\n }: ISnippetSyntaxBuildOptions): string {\n let functionKeyword = 'function '\n if (this.snippetInterface === SnippetInterface.AsyncAwait) {\n functionKeyword = 'async ' + functionKeyword\n } else if (this.snippetInterface === SnippetInterface.Generator) {\n functionKeyword += '*'\n }\n\n let implementation: string\n if (this.snippetInterface === SnippetInterface.Callback) {\n implementation = `${CALLBACK_NAME}(null, 'pending');`\n } else {\n implementation = \"return 'pending';\"\n }\n\n const definitionChoices = generatedExpressions.map(\n (generatedExpression, index) => {\n const prefix = index === 0 ? '' : '// '\n const allParameterNames =\n generatedExpression.parameterNames.concat(stepParameterNames)\n if (this.snippetInterface === SnippetInterface.Callback) {\n allParameterNames.push(CALLBACK_NAME)\n }\n return `${prefix + functionName}('${generatedExpression.source.replace(\n /'/g,\n \"\\\\'\"\n )}', ${functionKeyword}(${allParameterNames.join(', ')}) {\\n`\n }\n )\n\n return (\n `${definitionChoices.join('')} // ${comment}\\n` +\n ` ${implementation}\\n` +\n '});'\n )\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import Formatter, { IFormatterOptions } from './';
2
- import { messages } from '@cucumber/messages';
2
+ import * as messages from '@cucumber/messages';
3
3
  import { ITestCaseAttempt } from './helpers/event_data_collector';
4
4
  interface ILogIssuesRequest {
5
5
  issues: ITestCaseAttempt[];
@@ -7,7 +7,7 @@ interface ILogIssuesRequest {
7
7
  }
8
8
  export default class SummaryFormatter extends Formatter {
9
9
  constructor(options: IFormatterOptions);
10
- logSummary(testRunDuration: messages.IDuration): void;
10
+ logSummary(testRunDuration: messages.Duration): void;
11
11
  logIssues({ issues, title }: ILogIssuesRequest): void;
12
12
  }
13
13
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"summary_formatter.js","sourceRoot":"","sources":["../../src/formatter/summary_formatter.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,uCAA4E;AAC5E,0CAAiD;AACjD,oDAAgD;AAGhD,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B,CAAC,uBAAuB,CAChD,CACF,CAAA;SACF;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;SACxD;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;SACxD;QACD,IAAI,CAAC,GAAG,CACN,uBAAa,CAAC;YACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,gBAAgB;YAChB,eAAe;SAChB,CAAC,CACH,CAAA;IACH,CAAC;IAED,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAqB;QAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,OAAO,CAAC,CAAA;QACzB,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,KAAK,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,CACN,qBAAW,CAAC;gBACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,MAAM,EAAE,KAAK,GAAG,CAAC;gBACjB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;aAChB,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AApED,mCAoEC","sourcesContent":["import _ from 'lodash'\nimport { formatIssue, formatSummary, isFailure, isWarning } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport { messages } from '@cucumber/messages'\nimport { ITestCaseAttempt } from './helpers/event_data_collector'\nimport { formatUndefinedParameterTypes } from './helpers/issue_helpers'\nimport { durationBetweenTimestamps } from '../time'\n\ninterface ILogIssuesRequest {\n issues: ITestCaseAttempt[]\n title: string\n}\n\nexport default class SummaryFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n let testRunStartedTimestamp: messages.ITimestamp\n options.eventBroadcaster.on('envelope', (envelope: messages.IEnvelope) => {\n if (doesHaveValue(envelope.testRunStarted)) {\n testRunStartedTimestamp = envelope.testRunStarted.timestamp\n }\n if (doesHaveValue(envelope.testRunFinished)) {\n const testRunFinishedTimestamp = envelope.testRunFinished.timestamp\n this.logSummary(\n durationBetweenTimestamps(\n testRunStartedTimestamp,\n testRunFinishedTimestamp\n )\n )\n }\n })\n }\n\n logSummary(testRunDuration: messages.IDuration): void {\n const failures: ITestCaseAttempt[] = []\n const warnings: ITestCaseAttempt[] = []\n const testCaseAttempts = this.eventDataCollector.getTestCaseAttempts()\n _.each(testCaseAttempts, (testCaseAttempt) => {\n if (isFailure(testCaseAttempt.worstTestStepResult)) {\n failures.push(testCaseAttempt)\n } else if (isWarning(testCaseAttempt.worstTestStepResult)) {\n warnings.push(testCaseAttempt)\n }\n })\n if (this.eventDataCollector.undefinedParameterTypes.length > 0) {\n this.log(\n formatUndefinedParameterTypes(\n this.eventDataCollector.undefinedParameterTypes\n )\n )\n }\n if (failures.length > 0) {\n this.logIssues({ issues: failures, title: 'Failures' })\n }\n if (warnings.length > 0) {\n this.logIssues({ issues: warnings, title: 'Warnings' })\n }\n this.log(\n formatSummary({\n colorFns: this.colorFns,\n testCaseAttempts,\n testRunDuration,\n })\n )\n }\n\n logIssues({ issues, title }: ILogIssuesRequest): void {\n this.log(`${title}:\\n\\n`)\n issues.forEach((testCaseAttempt, index) => {\n this.log(\n formatIssue({\n colorFns: this.colorFns,\n cwd: this.cwd,\n number: index + 1,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n )\n })\n }\n}\n"]}
1
+ {"version":3,"file":"summary_formatter.js","sourceRoot":"","sources":["../../src/formatter/summary_formatter.ts"],"names":[],"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G,CAAC,EAAE;YAC9D,IAAI,CAAC,GAAG,CACN,6CAA6B,CAC3B,IAAI,CAAC,kBAAkB,CAAC,uBAAuB,CAChD,CACF,CAAA;SACF;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;SACxD;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;SACxD;QACD,IAAI,CAAC,GAAG,CACN,uBAAa,CAAC;YACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,gBAAgB;YAChB,eAAe;SAChB,CAAC,CACH,CAAA;IACH,CAAC;IAED,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAqB;QAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,OAAO,CAAC,CAAA;QACzB,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,KAAK,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,CACN,qBAAW,CAAC;gBACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,MAAM,EAAE,KAAK,GAAG,CAAC;gBACjB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;aAChB,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AApED,mCAoEC","sourcesContent":["import _ from 'lodash'\nimport { formatIssue, formatSummary, isFailure, isWarning } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport { ITestCaseAttempt } from './helpers/event_data_collector'\nimport { formatUndefinedParameterTypes } from './helpers/issue_helpers'\nimport { durationBetweenTimestamps } from '../time'\n\ninterface ILogIssuesRequest {\n issues: ITestCaseAttempt[]\n title: string\n}\n\nexport default class SummaryFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n let testRunStartedTimestamp: messages.Timestamp\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n if (doesHaveValue(envelope.testRunStarted)) {\n testRunStartedTimestamp = envelope.testRunStarted.timestamp\n }\n if (doesHaveValue(envelope.testRunFinished)) {\n const testRunFinishedTimestamp = envelope.testRunFinished.timestamp\n this.logSummary(\n durationBetweenTimestamps(\n testRunStartedTimestamp,\n testRunFinishedTimestamp\n )\n )\n }\n })\n }\n\n logSummary(testRunDuration: messages.Duration): void {\n const failures: ITestCaseAttempt[] = []\n const warnings: ITestCaseAttempt[] = []\n const testCaseAttempts = this.eventDataCollector.getTestCaseAttempts()\n _.each(testCaseAttempts, (testCaseAttempt) => {\n if (isFailure(testCaseAttempt.worstTestStepResult)) {\n failures.push(testCaseAttempt)\n } else if (isWarning(testCaseAttempt.worstTestStepResult)) {\n warnings.push(testCaseAttempt)\n }\n })\n if (this.eventDataCollector.undefinedParameterTypes.length > 0) {\n this.log(\n formatUndefinedParameterTypes(\n this.eventDataCollector.undefinedParameterTypes\n )\n )\n }\n if (failures.length > 0) {\n this.logIssues({ issues: failures, title: 'Failures' })\n }\n if (warnings.length > 0) {\n this.logIssues({ issues: warnings, title: 'Warnings' })\n }\n this.log(\n formatSummary({\n colorFns: this.colorFns,\n testCaseAttempts,\n testRunDuration,\n })\n )\n }\n\n logIssues({ issues, title }: ILogIssuesRequest): void {\n this.log(`${title}:\\n\\n`)\n issues.forEach((testCaseAttempt, index) => {\n this.log(\n formatIssue({\n colorFns: this.colorFns,\n cwd: this.cwd,\n number: index + 1,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n )\n })\n }\n}\n"]}
@@ -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
  };
@@ -7,8 +26,8 @@ const lodash_1 = __importDefault(require("lodash"));
7
26
  const helpers_1 = require("./helpers");
8
27
  const _1 = __importDefault(require("./"));
9
28
  const cli_table3_1 = __importDefault(require("cli-table3"));
10
- const time_1 = require("../time");
11
29
  const value_checker_1 = require("../value_checker");
30
+ const messages = __importStar(require("@cucumber/messages"));
12
31
  class UsageFormatter extends _1.default {
13
32
  constructor(options) {
14
33
  super(options);
@@ -44,7 +63,7 @@ class UsageFormatter extends _1.default {
44
63
  const col2 = [];
45
64
  if (matches.length > 0) {
46
65
  if (value_checker_1.doesHaveValue(meanDuration)) {
47
- col2.push(`${time_1.durationToMilliseconds(meanDuration).toFixed(2)}ms`);
66
+ col2.push(`${messages.TimeConversion.durationToMilliseconds(meanDuration).toFixed(2)}ms`);
48
67
  }
49
68
  else {
50
69
  col2.push('-');
@@ -57,7 +76,7 @@ class UsageFormatter extends _1.default {
57
76
  lodash_1.default.take(matches, 5).forEach((match) => {
58
77
  col1.push(` ${match.text}`);
59
78
  if (value_checker_1.doesHaveValue(match.duration)) {
60
- col2.push(`${time_1.durationToMilliseconds(match.duration).toString()}ms`);
79
+ col2.push(`${messages.TimeConversion.durationToMilliseconds(match.duration).toString()}ms`);
61
80
  }
62
81
  else {
63
82
  col2.push('-');
@@ -1 +1 @@
1
- {"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,uCAAoD;AACpD,0CAAiD;AACjD,4DAA8B;AAC9B,kCAAgD;AAChD,oDAAgD;AAIhD,MAAqB,cAAe,SAAQ,UAAS;IACnD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,kBAAQ,CAAC;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;YAC/B,OAAM;SACP;QACD,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;YACtB,IAAI,EAAE,CAAC,gBAAgB,EAAE,UAAU,EAAE,UAAU,CAAC;YAChD,KAAK,EAAE;gBACL,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,EAAE;aACT;SACF,CAAC,CAAA;QACF,KAAK,CAAC,OAAO,CACX,CAAC,E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;YAClC,CAAC,CAAC,CAAA;YACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;aACvD;YACD,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAQ,CAAC,CAAA;QACxE,CAAC,CACF,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;CACF;AA9DD,iCA8DC","sourcesContent":["import _ from 'lodash'\nimport { formatLocation, getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport Table from 'cli-table3'\nimport { durationToMilliseconds } from '../time'\nimport { doesHaveValue } from '../value_checker'\nimport { messages } from '@cucumber/messages'\nimport IEnvelope = messages.IEnvelope\n\nexport default class UsageFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n cwd: this.cwd,\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n if (usage.length === 0) {\n this.log('No step definitions')\n return\n }\n const table = new Table({\n head: ['Pattern / Text', 'Duration', 'Location'],\n style: {\n border: [],\n head: [],\n },\n })\n usage.forEach(\n ({ line, matches, meanDuration, pattern, patternType, uri }) => {\n let formattedPattern = pattern\n if (patternType === 'RegularExpression') {\n formattedPattern = '/' + formattedPattern + '/'\n }\n const col1 = [formattedPattern]\n const col2 = []\n if (matches.length > 0) {\n if (doesHaveValue(meanDuration)) {\n col2.push(`${durationToMilliseconds(meanDuration).toFixed(2)}ms`)\n } else {\n col2.push('-')\n }\n } else {\n col2.push('UNUSED')\n }\n const col3 = [formatLocation({ line, uri })]\n _.take(matches, 5).forEach((match) => {\n col1.push(` ${match.text}`)\n if (doesHaveValue(match.duration)) {\n col2.push(`${durationToMilliseconds(match.duration).toString()}ms`)\n } else {\n col2.push('-')\n }\n col3.push(formatLocation(match))\n })\n if (matches.length > 5) {\n col1.push(` ${(matches.length - 5).toString()} more`)\n }\n table.push([col1.join('\\n'), col2.join('\\n'), col3.join('\\n')] as any)\n }\n )\n this.log(`${table.toString()}\\n`)\n }\n}\n"]}
1
+ {"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsB;AACtB,uCAAoD;AACpD,0CAAiD;AACjD,4DAA8B;AAC9B,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,cAAe,SAAQ,UAAS;IACnD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,kBAAQ,CAAC;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;YAC/B,OAAM;SACP;QACD,MAAM,K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I,CAAC,IAAI,CACP,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAC/C,KAAK,CAAC,QAAQ,CACf,CAAC,QAAQ,EAAE,IAAI,CACjB,CAAA;iBACF;qBAAM;oBACL,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;iBACf;gBACD,IAAI,CAAC,IAAI,CAAC,wBAAc,CAAC,KAAK,CAAC,CAAC,CAAA;YAClC,CAAC,CAAC,CAAA;YACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;aACvD;YACD,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAQ,CAAC,CAAA;QACxE,CAAC,CACF,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;CACF;AAtED,iCAsEC","sourcesContent":["import _ from 'lodash'\nimport { formatLocation, getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport Table from 'cli-table3'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n cwd: this.cwd,\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n if (usage.length === 0) {\n this.log('No step definitions')\n return\n }\n const table = new Table({\n head: ['Pattern / Text', 'Duration', 'Location'],\n style: {\n border: [],\n head: [],\n },\n })\n usage.forEach(\n ({ line, matches, meanDuration, pattern, patternType, uri }) => {\n let formattedPattern = pattern\n if (patternType === 'RegularExpression') {\n formattedPattern = '/' + formattedPattern + '/'\n }\n const col1 = [formattedPattern]\n const col2 = []\n if (matches.length > 0) {\n if (doesHaveValue(meanDuration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n meanDuration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n } else {\n col2.push('UNUSED')\n }\n const col3 = [formatLocation({ line, uri })]\n _.take(matches, 5).forEach((match) => {\n col1.push(` ${match.text}`)\n if (doesHaveValue(match.duration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n match.duration\n ).toString()}ms`\n )\n } else {\n col2.push('-')\n }\n col3.push(formatLocation(match))\n })\n if (matches.length > 5) {\n col1.push(` ${(matches.length - 5).toString()} more`)\n }\n table.push([col1.join('\\n'), col2.join('\\n'), col3.join('\\n')] as any)\n }\n )\n this.log(`${table.toString()}\\n`)\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"usage_json_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_json_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAAoC;AACpC,0CAAiD;AACjD,oDAAgD;AAIhD,MAAqB,kBAAmB,SAAQ,UAAS;IACvD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,kBAAQ,CAAC;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAU;QAC9B,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;SACvB;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAzBD,qCAyBC","sourcesContent":["import { getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport { messages } from '@cucumber/messages'\nimport IEnvelope = messages.IEnvelope\n\nexport default class UsageJsonFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n cwd: this.cwd,\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n this.log(JSON.stringify(usage, this.replacer, 2))\n }\n\n replacer(key: string, value: any): any {\n if (key === 'seconds') {\n return parseInt(value)\n }\n return value\n }\n}\n"]}
1
+ {"version":3,"file":"usage_json_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_json_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAAoC;AACpC,0CAAiD;AACjD,oDAAgD;AAIhD,MAAqB,kBAAmB,SAAQ,UAAS;IACvD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,kBAAQ,CAAC;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAU;QAC9B,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;SACvB;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAzBD,qCAyBC","sourcesContent":["import { getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageJsonFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n cwd: this.cwd,\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n this.log(JSON.stringify(usage, this.replacer, 2))\n }\n\n replacer(key: string, value: any): any {\n if (key === 'seconds') {\n return parseInt(value)\n }\n return value\n }\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as formatterHelpers from './formatter/helpers';
2
+ import * as messages from '@cucumber/messages';
2
3
  export { default as Cli } from './cli';
3
4
  export { parseGherkinMessageStream } from './cli/helpers';
4
5
  export { default as PickleFilter } from './pickle_filter';
5
- export { default as Runtime } from './runtime';
6
+ export { default as Runtime, INewRuntimeOptions, IRuntimeOptions, } from './runtime';
6
7
  export { default as supportCodeLibraryBuilder } from './support_code_library_builder';
7
- export { default as Status } from './status';
8
8
  export { default as DataTable } from './models/data_table';
9
- export { default as Formatter } from './formatter';
9
+ export { default as Formatter, IFormatterOptions } from './formatter';
10
10
  export { default as FormatterBuilder } from './formatter/builder';
11
11
  export { default as JsonFormatter } from './formatter/json_formatter';
12
12
  export { default as ProgressFormatter } from './formatter/progress_formatter';
@@ -16,18 +16,20 @@ export { default as SummaryFormatter } from './formatter/summary_formatter';
16
16
  export { default as UsageFormatter } from './formatter/usage_formatter';
17
17
  export { default as UsageJsonFormatter } from './formatter/usage_json_formatter';
18
18
  export { formatterHelpers };
19
- export declare const After: ((code: import("./support_code_library_builder/types").TestCaseHookFunction) => void) & ((tags: string, code: import("./support_code_library_builder/types").TestCaseHookFunction) => void) & ((options: import("./support_code_library_builder/types").IDefineTestCaseHookOptions, code: import("./support_code_library_builder/types").TestCaseHookFunction) => void);
19
+ export declare const After: (<WorldType = import("./support_code_library_builder/world").IWorld>(code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld>(tags: string, code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType_1>) => void) & (<WorldType_2 = import("./support_code_library_builder/world").IWorld>(options: import("./support_code_library_builder/types").IDefineTestCaseHookOptions, code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType_2>) => void);
20
20
  export declare const AfterAll: ((code: Function) => void) & ((options: import("./support_code_library_builder/types").IDefineTestRunHookOptions, code: Function) => void);
21
- export declare const AfterStep: ((code: import("./support_code_library_builder/types").TestStepHookFunction) => void) & ((tags: string, code: import("./support_code_library_builder/types").TestStepHookFunction) => void) & ((options: import("./support_code_library_builder/types").IDefineTestStepHookOptions, code: import("./support_code_library_builder/types").TestStepHookFunction) => void);
22
- export declare const Before: ((code: import("./support_code_library_builder/types").TestCaseHookFunction) => void) & ((tags: string, code: import("./support_code_library_builder/types").TestCaseHookFunction) => void) & ((options: import("./support_code_library_builder/types").IDefineTestCaseHookOptions, code: import("./support_code_library_builder/types").TestCaseHookFunction) => void);
21
+ export declare const AfterStep: (<WorldType = import("./support_code_library_builder/world").IWorld>(code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld>(tags: string, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_1>) => void) & (<WorldType_2 = import("./support_code_library_builder/world").IWorld>(options: import("./support_code_library_builder/types").IDefineTestStepHookOptions, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_2>) => void);
22
+ export declare const Before: (<WorldType = import("./support_code_library_builder/world").IWorld>(code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld>(tags: string, code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType_1>) => void) & (<WorldType_2 = import("./support_code_library_builder/world").IWorld>(options: import("./support_code_library_builder/types").IDefineTestCaseHookOptions, code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType_2>) => void);
23
23
  export declare const BeforeAll: ((code: Function) => void) & ((options: import("./support_code_library_builder/types").IDefineTestRunHookOptions, code: Function) => void);
24
- export declare const BeforeStep: ((code: import("./support_code_library_builder/types").TestStepHookFunction) => void) & ((tags: string, code: import("./support_code_library_builder/types").TestStepHookFunction) => void) & ((options: import("./support_code_library_builder/types").IDefineTestStepHookOptions, code: import("./support_code_library_builder/types").TestStepHookFunction) => void);
24
+ export declare const BeforeStep: (<WorldType = import("./support_code_library_builder/world").IWorld>(code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld>(tags: string, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_1>) => void) & (<WorldType_2 = import("./support_code_library_builder/world").IWorld>(options: import("./support_code_library_builder/types").IDefineTestStepHookOptions, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_2>) => void);
25
25
  export declare const defineParameterType: (options: import("./support_code_library_builder/types").IParameterTypeDefinition<any>) => void;
26
- export declare const defineStep: ((pattern: import("./support_code_library_builder/types").DefineStepPattern, code: Function) => void) & ((pattern: import("./support_code_library_builder/types").DefineStepPattern, options: import("./support_code_library_builder/types").IDefineStepOptions, code: Function) => void);
27
- export declare const Given: ((pattern: import("./support_code_library_builder/types").DefineStepPattern, code: Function) => void) & ((pattern: import("./support_code_library_builder/types").DefineStepPattern, options: import("./support_code_library_builder/types").IDefineStepOptions, code: Function) => void);
26
+ export declare const defineStep: (<WorldType = import("./support_code_library_builder/world").IWorld>(pattern: import("./support_code_library_builder/types").DefineStepPattern, code: import("./support_code_library_builder/types").TestStepFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld>(pattern: import("./support_code_library_builder/types").DefineStepPattern, options: import("./support_code_library_builder/types").IDefineStepOptions, code: import("./support_code_library_builder/types").TestStepFunction<WorldType_1>) => void);
27
+ export declare const Given: (<WorldType = import("./support_code_library_builder/world").IWorld>(pattern: import("./support_code_library_builder/types").DefineStepPattern, code: import("./support_code_library_builder/types").TestStepFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld>(pattern: import("./support_code_library_builder/types").DefineStepPattern, options: import("./support_code_library_builder/types").IDefineStepOptions, code: import("./support_code_library_builder/types").TestStepFunction<WorldType_1>) => void);
28
28
  export declare const setDefaultTimeout: (milliseconds: number) => void;
29
29
  export declare const setDefinitionFunctionWrapper: (fn: Function) => void;
30
30
  export declare const setWorldConstructor: (fn: any) => void;
31
- export declare const Then: ((pattern: import("./support_code_library_builder/types").DefineStepPattern, code: Function) => void) & ((pattern: import("./support_code_library_builder/types").DefineStepPattern, options: import("./support_code_library_builder/types").IDefineStepOptions, code: Function) => void);
32
- export declare const When: ((pattern: import("./support_code_library_builder/types").DefineStepPattern, code: Function) => void) & ((pattern: import("./support_code_library_builder/types").DefineStepPattern, options: import("./support_code_library_builder/types").IDefineStepOptions, code: Function) => void);
33
- export { default as World, IWorldOptions, } from './support_code_library_builder/world';
31
+ export declare const Then: (<WorldType = import("./support_code_library_builder/world").IWorld>(pattern: import("./support_code_library_builder/types").DefineStepPattern, code: import("./support_code_library_builder/types").TestStepFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld>(pattern: import("./support_code_library_builder/types").DefineStepPattern, options: import("./support_code_library_builder/types").IDefineStepOptions, code: import("./support_code_library_builder/types").TestStepFunction<WorldType_1>) => void);
32
+ export declare const When: (<WorldType = import("./support_code_library_builder/world").IWorld>(pattern: import("./support_code_library_builder/types").DefineStepPattern, code: import("./support_code_library_builder/types").TestStepFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld>(pattern: import("./support_code_library_builder/types").DefineStepPattern, options: import("./support_code_library_builder/types").IDefineStepOptions, code: import("./support_code_library_builder/types").TestStepFunction<WorldType_1>) => void);
33
+ export { default as World, IWorld, IWorldOptions, } from './support_code_library_builder/world';
34
+ export { ITestCaseHookParameter, ITestStepHookParameter, } from './support_code_library_builder/types';
35
+ export declare const Status: typeof messages.TestStepResultStatus;
package/lib/index.js CHANGED
@@ -22,10 +22,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.World = exports.When = exports.Then = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineStep = exports.defineParameterType = exports.BeforeStep = exports.BeforeAll = exports.Before = exports.AfterStep = exports.AfterAll = exports.After = exports.formatterHelpers = exports.UsageJsonFormatter = exports.UsageFormatter = exports.SummaryFormatter = exports.SnippetsFormatter = exports.RerunFormatter = exports.ProgressFormatter = exports.JsonFormatter = exports.FormatterBuilder = exports.Formatter = exports.DataTable = exports.Status = exports.supportCodeLibraryBuilder = exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = void 0;
25
+ exports.Status = exports.World = exports.When = exports.Then = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineStep = exports.defineParameterType = exports.BeforeStep = exports.BeforeAll = exports.Before = exports.AfterStep = exports.AfterAll = exports.After = exports.formatterHelpers = exports.UsageJsonFormatter = exports.UsageFormatter = exports.SummaryFormatter = exports.SnippetsFormatter = exports.RerunFormatter = exports.ProgressFormatter = exports.JsonFormatter = exports.FormatterBuilder = exports.Formatter = exports.DataTable = exports.supportCodeLibraryBuilder = exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = void 0;
26
26
  const formatterHelpers = __importStar(require("./formatter/helpers"));
27
27
  exports.formatterHelpers = formatterHelpers;
28
28
  const support_code_library_builder_1 = __importDefault(require("./support_code_library_builder"));
29
+ const messages = __importStar(require("@cucumber/messages"));
29
30
  // Top level
30
31
  var cli_1 = require("./cli");
31
32
  Object.defineProperty(exports, "Cli", { enumerable: true, get: function () { return __importDefault(cli_1).default; } });
@@ -37,8 +38,6 @@ var runtime_1 = require("./runtime");
37
38
  Object.defineProperty(exports, "Runtime", { enumerable: true, get: function () { return __importDefault(runtime_1).default; } });
38
39
  var support_code_library_builder_2 = require("./support_code_library_builder");
39
40
  Object.defineProperty(exports, "supportCodeLibraryBuilder", { enumerable: true, get: function () { return __importDefault(support_code_library_builder_2).default; } });
40
- var status_1 = require("./status");
41
- Object.defineProperty(exports, "Status", { enumerable: true, get: function () { return __importDefault(status_1).default; } });
42
41
  var data_table_1 = require("./models/data_table");
43
42
  Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return __importDefault(data_table_1).default; } });
44
43
  // Formatters
@@ -78,4 +77,5 @@ exports.Then = methods.Then;
78
77
  exports.When = methods.When;
79
78
  var world_1 = require("./support_code_library_builder/world");
80
79
  Object.defineProperty(exports, "World", { enumerable: true, get: function () { return __importDefault(world_1).default; } });
80
+ exports.Status = messages.TestStepResultStatus;
81
81
  //# sourceMappingURL=index.js.map