@cucumber/cucumber 8.0.0-rc.2 → 8.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -51
- package/api/index.d.ts +6 -0
- package/lib/api/convert_configuration.d.ts +4 -0
- package/lib/api/convert_configuration.js +64 -0
- package/lib/api/convert_configuration.js.map +1 -0
- package/lib/api/environment.d.ts +2 -0
- package/lib/api/environment.js +13 -0
- package/lib/api/environment.js.map +1 -0
- package/lib/{run → api}/formatters.d.ts +5 -3
- package/lib/{run → api}/formatters.js +13 -17
- package/lib/api/formatters.js.map +1 -0
- package/lib/api/gherkin.d.ts +21 -0
- package/lib/api/gherkin.js +65 -0
- package/lib/api/gherkin.js.map +1 -0
- package/lib/api/index.d.ts +11 -0
- package/lib/{run → api}/index.js +10 -1
- package/lib/api/index.js.map +1 -0
- package/lib/api/load_configuration.d.ts +9 -0
- package/lib/api/load_configuration.js +32 -0
- package/lib/api/load_configuration.js.map +1 -0
- package/lib/api/load_sources.d.ts +9 -0
- package/lib/api/load_sources.js +53 -0
- package/lib/api/load_sources.js.map +1 -0
- package/lib/api/load_support.d.ts +10 -0
- package/lib/api/load_support.js +28 -0
- package/lib/api/load_support.js.map +1 -0
- package/lib/api/paths.d.ts +7 -0
- package/lib/{run → api}/paths.js +25 -9
- package/lib/api/paths.js.map +1 -0
- package/lib/api/run_cucumber.d.ts +11 -0
- package/lib/api/run_cucumber.js +108 -0
- package/lib/api/run_cucumber.js.map +1 -0
- package/lib/{run → api}/runtime.d.ts +8 -7
- package/lib/api/runtime.js +36 -0
- package/lib/api/runtime.js.map +1 -0
- package/lib/{run → api}/support.d.ts +4 -3
- package/lib/{run → api}/support.js +5 -10
- package/lib/api/support.js.map +1 -0
- package/lib/api/types.d.ts +168 -0
- package/lib/{run → api}/types.js +0 -0
- package/lib/api/types.js.map +1 -0
- package/lib/api/wrapper.mjs +6 -0
- package/lib/cli/helpers.d.ts +16 -11
- package/lib/cli/helpers.js +19 -29
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/index.d.ts +3 -1
- package/lib/cli/index.js +35 -19
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/publish_banner.js +6 -6
- package/lib/cli/publish_banner.js.map +1 -1
- package/lib/cli/run.js +12 -3
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.d.ts +7 -0
- package/lib/cli/validate_node_engine_version.js +20 -0
- package/lib/cli/validate_node_engine_version.js.map +1 -0
- package/lib/configuration/argv_parser.d.ts +20 -0
- package/lib/{cli → configuration}/argv_parser.js +44 -45
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/check_schema.d.ts +2 -0
- package/lib/configuration/check_schema.js +56 -0
- package/lib/configuration/check_schema.js.map +1 -0
- package/lib/configuration/default_configuration.d.ts +2 -0
- package/lib/configuration/default_configuration.js +27 -0
- package/lib/configuration/default_configuration.js.map +1 -0
- package/lib/configuration/from_file.d.ts +2 -0
- package/lib/configuration/from_file.js +68 -0
- package/lib/configuration/from_file.js.map +1 -0
- package/lib/configuration/helpers.d.ts +1 -0
- package/lib/configuration/helpers.js +11 -0
- package/lib/configuration/helpers.js.map +1 -0
- package/lib/configuration/index.d.ts +6 -0
- package/lib/configuration/index.js +11 -0
- package/lib/configuration/index.js.map +1 -1
- package/lib/configuration/locate_file.d.ts +1 -0
- package/lib/configuration/locate_file.js +19 -0
- package/lib/configuration/locate_file.js.map +1 -0
- package/lib/configuration/merge_configurations.d.ts +2 -0
- package/lib/configuration/merge_configurations.js +48 -0
- package/lib/configuration/merge_configurations.js.map +1 -0
- package/lib/configuration/option_splitter.d.ts +3 -0
- package/lib/{cli → configuration}/option_splitter.js +2 -2
- package/lib/configuration/option_splitter.js.map +1 -0
- package/lib/configuration/types.d.ts +24 -28
- package/lib/configuration/types.js.map +1 -1
- package/lib/configuration/validate_configuration.d.ts +2 -0
- package/lib/configuration/validate_configuration.js +10 -0
- package/lib/configuration/validate_configuration.js.map +1 -0
- package/lib/formatter/builder.d.ts +2 -3
- package/lib/formatter/builder.js +8 -1
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/get_color_fns.js +15 -16
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
- package/lib/formatter/helpers/issue_helpers.js +2 -2
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +2 -2
- package/lib/formatter/helpers/test_case_attempt_formatter.js +9 -8
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +1 -2
- package/lib/formatter/helpers/test_case_attempt_parser.js +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.d.ts +1 -2
- package/lib/formatter/helpers/usage_helpers/index.js +3 -3
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/index.d.ts +14 -2
- package/lib/formatter/index.js +2 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.js +1 -1
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +0 -1
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/summary_formatter.js +1 -1
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.js +0 -1
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.js +0 -1
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/models/pickle_order.d.ts +1 -0
- package/lib/models/pickle_order.js +3 -0
- package/lib/models/pickle_order.js.map +1 -0
- package/lib/runtime/index.d.ts +3 -5
- package/lib/runtime/index.js +7 -36
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/command_types.d.ts +3 -2
- package/lib/runtime/parallel/command_types.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +27 -8
- package/lib/runtime/parallel/coordinator.js +66 -19
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/worker.d.ts +2 -4
- package/lib/runtime/parallel/worker.js +11 -34
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/run_test_run_hooks.d.ts +3 -0
- package/lib/runtime/run_test_run_hooks.js +28 -0
- package/lib/runtime/run_test_run_hooks.js.map +1 -0
- package/lib/support_code_library_builder/index.d.ts +4 -2
- package/lib/support_code_library_builder/index.js +25 -2
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js +16 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -0
- package/lib/support_code_library_builder/types.d.ts +9 -0
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/lib/wrapper.mjs +4 -0
- package/package.json +47 -28
- package/lib/cli/argv_parser.d.ts +0 -51
- package/lib/cli/argv_parser.js.map +0 -1
- package/lib/cli/configuration_builder.d.ts +0 -5
- package/lib/cli/configuration_builder.js +0 -71
- package/lib/cli/configuration_builder.js.map +0 -1
- package/lib/cli/option_splitter.d.ts +0 -4
- package/lib/cli/option_splitter.js.map +0 -1
- package/lib/cli/profile_loader.d.ts +0 -7
- package/lib/cli/profile_loader.js +0 -49
- package/lib/cli/profile_loader.js.map +0 -1
- package/lib/run/formatters.js.map +0 -1
- package/lib/run/index.d.ts +0 -2
- package/lib/run/index.js.map +0 -1
- package/lib/run/paths.d.ts +0 -6
- package/lib/run/paths.js.map +0 -1
- package/lib/run/runCucumber.d.ts +0 -3
- package/lib/run/runCucumber.js +0 -88
- package/lib/run/runCucumber.js.map +0 -1
- package/lib/run/runtime.js +0 -58
- package/lib/run/runtime.js.map +0 -1
- package/lib/run/support.js.map +0 -1
- package/lib/run/types.d.ts +0 -12
- package/lib/run/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary_formatter.js","sourceRoot":"","sources":["../../src/formatter/summary_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAA4E;AAC5E,0CAAiD;AACjD,oDAAgD;AAGhD,2DAAuE;AACvE,kCAAmD;AAOnD,MAAqB,gBAAiB,SAAQ,UAAS;IAIrD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,uBAA2C,CAAA;QAC/C,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE;YACtE,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;gBAC1C,uBAAuB,GAAG,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAA;aAC5D;YACD,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,MAAM,wBAAwB,GAAG,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAA;gBACnE,IAAI,CAAC,UAAU,CACb,IAAA,gCAAyB,EACvB,uBAAuB,EACvB,wBAAwB,CACzB,CACF,CAAA;aACF;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,UAAU,CAAC,eAAkC;QAC3C,MAAM,QAAQ,GAAuB,EAAE,CAAA;QACvC,MAAM,QAAQ,GAAuB,EAAE,CAAA;QACvC,MAAM,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAA;QACtE,gBAAgB,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE;YAC3C,IACE,IAAA,mBAAS,EACP,eAAe,CAAC,mBAAmB,EACnC,eAAe,CAAC,aA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AkB,CAAC,uBAAuB,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,IAAI,CAAC,GAAG,CACN,IAAA,6CAA6B,EAC3B,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,IAAA,uBAAa,EAAC;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,IAAA,qBAAW,EAAC;gBACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,KAAK,GAAG,CAAC;gBACjB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;gBACf,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;aACxC,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;;AAhFH,mCAiFC;AAhFwB,8BAAa,GAClC,yCAAyC,CAAA","sourcesContent":["import { 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 public static readonly documentation: string =\n 'Summary output of feature and scenarios'\n\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 testCaseAttempts.forEach((testCaseAttempt) => {\n if (\n isFailure(\n testCaseAttempt.worstTestStepResult,\n testCaseAttempt.willBeRetried\n )\n ) {\n failures.push(testCaseAttempt)\n } else if (\n isWarning(\n testCaseAttempt.worstTestStepResult,\n testCaseAttempt.willBeRetried\n )\n ) {\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 number: index + 1,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n printAttachments: this.printAttachments,\n })\n )\n })\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoD;AACpD,0CAAiD;AACjD,4DAA8B;AAC9B,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,cAAe,SAAQ,UAAS;IAInD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC;YACrB,
|
|
1
|
+
{"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoD;AACpD,0CAAiD;AACjD,4DAA8B;AAC9B,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,cAAe,SAAQ,UAAS;IAInD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;a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'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 public static readonly documentation: string =\n 'Prints where step definitions are used. The slowest step definitions (with duration) are listed first. If --dry-run is used the duration is not shown, and step definitions are sorted by filename instead.'\n\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 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 matches.slice(0, 5).forEach((match) => {\n col1.push(` ${match.text}`)\n if (doesHaveValue(match.duration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n match.duration\n ).toFixed(2)}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;IAIvD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC;YACrB,
|
|
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;IAIvD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC;YACrB,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;;AA1BH,qCA2BC;AA1BwB,gCAAa,GAClC,uHAAuH,CAAA","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 public static readonly documentation: string =\n 'Does what the Usage Formatter does, but outputs JSON, which can be output to a file and then consumed by other tools.'\n\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 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
|
@@ -6,6 +6,7 @@ export { default as PickleFilter } from './pickle_filter';
|
|
|
6
6
|
export { default as Runtime, INewRuntimeOptions, IRuntimeOptions, } from './runtime';
|
|
7
7
|
export { default as supportCodeLibraryBuilder } from './support_code_library_builder';
|
|
8
8
|
export { default as DataTable } from './models/data_table';
|
|
9
|
+
export { default as TestCaseHookDefinition } from './models/test_case_hook_definition';
|
|
9
10
|
export { version } from './version';
|
|
10
11
|
export { default as Formatter, IFormatterOptions } from './formatter';
|
|
11
12
|
export { default as FormatterBuilder } from './formatter/builder';
|
|
@@ -29,6 +30,7 @@ export declare const Given: (<WorldType = import("./support_code_library_builder
|
|
|
29
30
|
export declare const setDefaultTimeout: (milliseconds: number) => void;
|
|
30
31
|
export declare const setDefinitionFunctionWrapper: (fn: Function) => void;
|
|
31
32
|
export declare const setWorldConstructor: (fn: any) => void;
|
|
33
|
+
export declare const setParallelCanAssign: (fn: import("./support_code_library_builder/types").ParallelAssignmentValidator) => void;
|
|
32
34
|
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);
|
|
33
35
|
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);
|
|
34
36
|
export { default as World, IWorld, IWorldOptions, } from './support_code_library_builder/world';
|
package/lib/index.js
CHANGED
|
@@ -22,7 +22,7 @@ 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.wrapPromiseWithTimeout = 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.version = exports.DataTable = exports.supportCodeLibraryBuilder = exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = void 0;
|
|
25
|
+
exports.wrapPromiseWithTimeout = exports.Status = exports.World = exports.When = exports.Then = exports.setParallelCanAssign = 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.version = exports.TestCaseHookDefinition = 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"));
|
|
@@ -40,6 +40,8 @@ var support_code_library_builder_2 = require("./support_code_library_builder");
|
|
|
40
40
|
Object.defineProperty(exports, "supportCodeLibraryBuilder", { enumerable: true, get: function () { return __importDefault(support_code_library_builder_2).default; } });
|
|
41
41
|
var data_table_1 = require("./models/data_table");
|
|
42
42
|
Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return __importDefault(data_table_1).default; } });
|
|
43
|
+
var test_case_hook_definition_1 = require("./models/test_case_hook_definition");
|
|
44
|
+
Object.defineProperty(exports, "TestCaseHookDefinition", { enumerable: true, get: function () { return __importDefault(test_case_hook_definition_1).default; } });
|
|
43
45
|
var version_1 = require("./version");
|
|
44
46
|
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_1.version; } });
|
|
45
47
|
// Formatters
|
|
@@ -75,6 +77,7 @@ exports.Given = methods.Given;
|
|
|
75
77
|
exports.setDefaultTimeout = methods.setDefaultTimeout;
|
|
76
78
|
exports.setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper;
|
|
77
79
|
exports.setWorldConstructor = methods.setWorldConstructor;
|
|
80
|
+
exports.setParallelCanAssign = methods.setParallelCanAssign;
|
|
78
81
|
exports.Then = methods.Then;
|
|
79
82
|
exports.When = methods.When;
|
|
80
83
|
var world_1 = require("./support_code_library_builder/world");
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAuD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAuD;AA4B9C,4CAAgB;AA3BzB,kGAAsE;AACtE,6DAA8C;AAE9C,YAAY;AACZ,6BAAsC;AAA7B,2GAAA,OAAO,OAAO;AACvB,yCAAyD;AAAhD,oHAAA,yBAAyB,OAAA;AAClC,iDAAyD;AAAhD,8HAAA,OAAO,OAAgB;AAChC,qCAIkB;AAHhB,mHAAA,OAAO,OAAW;AAIpB,+EAAqF;AAA5E,0JAAA,OAAO,OAA6B;AAC7C,kDAA0D;AAAjD,wHAAA,OAAO,OAAa;AAC7B,gFAAsF;AAA7E,oJAAA,OAAO,OAA0B;AAC1C,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAEhB,aAAa;AACb,yCAAqE;AAA5D,uHAAA,OAAO,OAAa;AAC7B,+CAAiE;AAAxD,4HAAA,OAAO,OAAoB;AACpC,6DAAqE;AAA5D,gIAAA,OAAO,OAAiB;AACjC,qEAA6E;AAApE,wIAAA,OAAO,OAAqB;AACrC,+DAAuE;AAA9D,kIAAA,OAAO,OAAkB;AAClC,qEAA6E;AAApE,wIAAA,OAAO,OAAqB;AACrC,mEAA2E;AAAlE,sIAAA,OAAO,OAAoB;AACpC,+DAAuE;AAA9D,kIAAA,OAAO,OAAkB;AAClC,yEAAgF;AAAvE,2IAAA,OAAO,OAAsB;AAGtC,yBAAyB;AACzB,MAAM,EAAE,OAAO,EAAE,GAAG,sCAAyB,CAAA;AAChC,QAAA,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;AACrB,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAC3B,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAC7B,QAAA,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;AACvB,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAC7B,QAAA,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;AAC/B,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;AACjD,QAAA,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;AAC/B,QAAA,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;AACrB,QAAA,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;AAC7C,QAAA,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAA;AACnE,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;AACjD,QAAA,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAA;AACnD,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AACnB,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AAChC,8DAI6C;AAH3C,+GAAA,OAAO,OAAS;AASL,QAAA,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAA;AAEnD,eAAe;AACf,+BAA+C;AAAtC,8GAAA,sBAAsB,OAAA","sourcesContent":["import * as formatterHelpers from './formatter/helpers'\nimport supportCodeLibraryBuilder from './support_code_library_builder'\nimport * as messages from '@cucumber/messages'\n\n// Top level\nexport { default as Cli } from './cli'\nexport { parseGherkinMessageStream } from './cli/helpers'\nexport { default as PickleFilter } from './pickle_filter'\nexport {\n default as Runtime,\n INewRuntimeOptions,\n IRuntimeOptions,\n} from './runtime'\nexport { default as supportCodeLibraryBuilder } from './support_code_library_builder'\nexport { default as DataTable } from './models/data_table'\nexport { default as TestCaseHookDefinition } from './models/test_case_hook_definition'\nexport { version } from './version'\n\n// Formatters\nexport { default as Formatter, IFormatterOptions } from './formatter'\nexport { default as FormatterBuilder } from './formatter/builder'\nexport { default as JsonFormatter } from './formatter/json_formatter'\nexport { default as ProgressFormatter } from './formatter/progress_formatter'\nexport { default as RerunFormatter } from './formatter/rerun_formatter'\nexport { default as SnippetsFormatter } from './formatter/snippets_formatter'\nexport { default as SummaryFormatter } from './formatter/summary_formatter'\nexport { default as UsageFormatter } from './formatter/usage_formatter'\nexport { default as UsageJsonFormatter } from './formatter/usage_json_formatter'\nexport { formatterHelpers }\n\n// Support Code Functions\nconst { methods } = supportCodeLibraryBuilder\nexport const After = methods.After\nexport const AfterAll = methods.AfterAll\nexport const AfterStep = methods.AfterStep\nexport const Before = methods.Before\nexport const BeforeAll = methods.BeforeAll\nexport const BeforeStep = methods.BeforeStep\nexport const defineParameterType = methods.defineParameterType\nexport const defineStep = methods.defineStep\nexport const Given = methods.Given\nexport const setDefaultTimeout = methods.setDefaultTimeout\nexport const setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper\nexport const setWorldConstructor = methods.setWorldConstructor\nexport const setParallelCanAssign = methods.setParallelCanAssign\nexport const Then = methods.Then\nexport const When = methods.When\nexport {\n default as World,\n IWorld,\n IWorldOptions,\n} from './support_code_library_builder/world'\n\nexport {\n ITestCaseHookParameter,\n ITestStepHookParameter,\n} from './support_code_library_builder/types'\nexport const Status = messages.TestStepResultStatus\n\n// Time helpers\nexport { wrapPromiseWithTimeout } from './time'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type PickleOrder = 'defined' | 'random' | string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickle_order.js","sourceRoot":"","sources":["../../src/models/pickle_order.ts"],"names":[],"mappings":"","sourcesContent":["export type PickleOrder = 'defined' | 'random' | string\n"]}
|
package/lib/runtime/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { EventDataCollector } from '../formatter/helpers';
|
|
3
|
-
import { IdGenerator } from '@cucumber/messages';
|
|
4
2
|
import * as messages from '@cucumber/messages';
|
|
3
|
+
import { IdGenerator } from '@cucumber/messages';
|
|
5
4
|
import { EventEmitter } from 'events';
|
|
5
|
+
import { EventDataCollector } from '../formatter/helpers';
|
|
6
6
|
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
7
|
-
import TestRunHookDefinition from '../models/test_run_hook_definition';
|
|
8
7
|
export interface IRuntime {
|
|
9
8
|
start: () => Promise<boolean>;
|
|
10
9
|
}
|
|
@@ -25,7 +24,6 @@ export interface IRuntimeOptions {
|
|
|
25
24
|
strict: boolean;
|
|
26
25
|
worldParameters: any;
|
|
27
26
|
}
|
|
28
|
-
export declare const DEFAULT_RUNTIME_OPTIONS: IRuntimeOptions;
|
|
29
27
|
export default class Runtime implements IRuntime {
|
|
30
28
|
private readonly eventBroadcaster;
|
|
31
29
|
private readonly eventDataCollector;
|
|
@@ -36,8 +34,8 @@ export default class Runtime implements IRuntime {
|
|
|
36
34
|
private readonly stackTraceFilter;
|
|
37
35
|
private readonly supportCodeLibrary;
|
|
38
36
|
private success;
|
|
37
|
+
private runTestRunHooks;
|
|
39
38
|
constructor({ eventBroadcaster, eventDataCollector, newId, options, pickleIds, supportCodeLibrary, }: INewRuntimeOptions);
|
|
40
|
-
runTestRunHooks(definitions: TestRunHookDefinition[], name: string): Promise<void>;
|
|
41
39
|
runTestCase(pickleId: string, testCase: messages.TestCase): Promise<void>;
|
|
42
40
|
start(): Promise<boolean>;
|
|
43
41
|
}
|
package/lib/runtime/index.js
CHANGED
|
@@ -3,25 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DEFAULT_RUNTIME_OPTIONS = void 0;
|
|
7
|
-
const helpers_1 = require("../formatter/helpers");
|
|
8
6
|
const stack_trace_filter_1 = __importDefault(require("../stack_trace_filter"));
|
|
9
|
-
const user_code_runner_1 = __importDefault(require("../user_code_runner"));
|
|
10
|
-
const verror_1 = __importDefault(require("verror"));
|
|
11
|
-
const helpers_2 = require("./helpers");
|
|
12
|
-
const test_case_runner_1 = __importDefault(require("./test_case_runner"));
|
|
13
|
-
const value_checker_1 = require("../value_checker");
|
|
14
|
-
const stopwatch_1 = require("./stopwatch");
|
|
15
7
|
const assemble_test_cases_1 = require("./assemble_test_cases");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
retry: 0,
|
|
21
|
-
retryTagFilter: '',
|
|
22
|
-
strict: true,
|
|
23
|
-
worldParameters: {},
|
|
24
|
-
};
|
|
8
|
+
const helpers_1 = require("./helpers");
|
|
9
|
+
const run_test_run_hooks_1 = require("./run_test_run_hooks");
|
|
10
|
+
const stopwatch_1 = require("./stopwatch");
|
|
11
|
+
const test_case_runner_1 = __importDefault(require("./test_case_runner"));
|
|
25
12
|
class Runtime {
|
|
26
13
|
constructor({ eventBroadcaster, eventDataCollector, newId, options, pickleIds, supportCodeLibrary, }) {
|
|
27
14
|
this.eventBroadcaster = eventBroadcaster;
|
|
@@ -33,27 +20,11 @@ class Runtime {
|
|
|
33
20
|
this.stackTraceFilter = new stack_trace_filter_1.default();
|
|
34
21
|
this.supportCodeLibrary = supportCodeLibrary;
|
|
35
22
|
this.success = true;
|
|
36
|
-
|
|
37
|
-
async runTestRunHooks(definitions, name) {
|
|
38
|
-
if (this.options.dryRun) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
for (const hookDefinition of definitions) {
|
|
42
|
-
const { error } = await user_code_runner_1.default.run({
|
|
43
|
-
argsArray: [],
|
|
44
|
-
fn: hookDefinition.code,
|
|
45
|
-
thisArg: null,
|
|
46
|
-
timeoutInMilliseconds: (0, value_checker_1.valueOrDefault)(hookDefinition.options.timeout, this.supportCodeLibrary.defaultTimeout),
|
|
47
|
-
});
|
|
48
|
-
if ((0, value_checker_1.doesHaveValue)(error)) {
|
|
49
|
-
const location = (0, helpers_1.formatLocation)(hookDefinition);
|
|
50
|
-
throw new verror_1.default(error, `${name} hook errored, process exiting: ${location}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
23
|
+
this.runTestRunHooks = (0, run_test_run_hooks_1.makeRunTestRunHooks)(this.options.dryRun, this.supportCodeLibrary.defaultTimeout, (name, location) => `${name} hook errored, process exiting: ${location}`);
|
|
53
24
|
}
|
|
54
25
|
async runTestCase(pickleId, testCase) {
|
|
55
26
|
const pickle = this.eventDataCollector.getPickle(pickleId);
|
|
56
|
-
const retries = (0,
|
|
27
|
+
const retries = (0, helpers_1.retriesForPickle)(pickle, this.options);
|
|
57
28
|
const skip = this.options.dryRun || (this.options.failFast && !this.success);
|
|
58
29
|
const testCaseRunner = new test_case_runner_1.default({
|
|
59
30
|
eventBroadcaster: this.eventBroadcaster,
|
|
@@ -68,7 +39,7 @@ class Runtime {
|
|
|
68
39
|
worldParameters: this.options.worldParameters,
|
|
69
40
|
});
|
|
70
41
|
const status = await testCaseRunner.run();
|
|
71
|
-
if ((0,
|
|
42
|
+
if ((0, helpers_1.shouldCauseFailure)(status, this.options)) {
|
|
72
43
|
this.success = false;
|
|
73
44
|
}
|
|
74
45
|
}
|
package/lib/runtime/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":";;;;;AAIA,+EAAoD;AAEpD,+DAAyD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BAAkB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAC5C;YACD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE;YACrC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAA;SAC/D;QACD,MAAM,IAAI,CAAC,eAAe,CACxB,IAAI,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EACtE,aAAa,CACd,CAAA;QACD,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;QACrB,MAAM,eAAe,GAAsB;YACzC,eAAe,EAAE;gBACf,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;gBACrC,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB;SACF,CAAA;QACD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAA;QACvD,IAAI,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE;YAClC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAA;SACjC;QACD,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AAxGD,0BAwGC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport { EventEmitter } from 'events'\nimport { EventDataCollector } from '../formatter/helpers'\nimport StackTraceFilter from '../stack_trace_filter'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { assembleTestCases } from './assemble_test_cases'\nimport { retriesForPickle, shouldCauseFailure } from './helpers'\nimport { makeRunTestRunHooks, RunsTestRunHooks } from './run_test_run_hooks'\nimport { ITestRunStopwatch, RealTestRunStopwatch } from './stopwatch'\nimport TestCaseRunner from './test_case_runner'\n\nexport interface IRuntime {\n start: () => Promise<boolean>\n}\n\nexport interface INewRuntimeOptions {\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n newId: IdGenerator.NewId\n options: IRuntimeOptions\n pickleIds: string[]\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport interface IRuntimeOptions {\n dryRun: boolean\n failFast: boolean\n filterStacktraces: boolean\n retry: number\n retryTagFilter: string\n strict: boolean\n worldParameters: any\n}\n\nexport default class Runtime implements IRuntime {\n private readonly eventBroadcaster: EventEmitter\n private readonly eventDataCollector: EventDataCollector\n private readonly stopwatch: ITestRunStopwatch\n private readonly newId: IdGenerator.NewId\n private readonly options: IRuntimeOptions\n private readonly pickleIds: string[]\n private readonly stackTraceFilter: StackTraceFilter\n private readonly supportCodeLibrary: ISupportCodeLibrary\n private success: boolean\n private runTestRunHooks: RunsTestRunHooks\n\n constructor({\n eventBroadcaster,\n eventDataCollector,\n newId,\n options,\n pickleIds,\n supportCodeLibrary,\n }: INewRuntimeOptions) {\n this.eventBroadcaster = eventBroadcaster\n this.eventDataCollector = eventDataCollector\n this.stopwatch = new RealTestRunStopwatch()\n this.newId = newId\n this.options = options\n this.pickleIds = pickleIds\n this.stackTraceFilter = new StackTraceFilter()\n this.supportCodeLibrary = supportCodeLibrary\n this.success = true\n this.runTestRunHooks = makeRunTestRunHooks(\n this.options.dryRun,\n this.supportCodeLibrary.defaultTimeout,\n (name, location) => `${name} hook errored, process exiting: ${location}`\n )\n }\n\n async runTestCase(\n pickleId: string,\n testCase: messages.TestCase\n ): Promise<void> {\n const pickle = this.eventDataCollector.getPickle(pickleId)\n const retries = retriesForPickle(pickle, this.options)\n const skip = this.options.dryRun || (this.options.failFast && !this.success)\n const testCaseRunner = new TestCaseRunner({\n eventBroadcaster: this.eventBroadcaster,\n stopwatch: this.stopwatch,\n gherkinDocument: this.eventDataCollector.getGherkinDocument(pickle.uri),\n newId: this.newId,\n pickle,\n testCase,\n retries,\n skip,\n supportCodeLibrary: this.supportCodeLibrary,\n worldParameters: this.options.worldParameters,\n })\n const status = await testCaseRunner.run()\n if (shouldCauseFailure(status, this.options)) {\n this.success = false\n }\n }\n\n async start(): Promise<boolean> {\n if (this.options.filterStacktraces) {\n this.stackTraceFilter.filter()\n }\n const testRunStarted: messages.Envelope = {\n testRunStarted: {\n timestamp: this.stopwatch.timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', testRunStarted)\n this.stopwatch.start()\n await this.runTestRunHooks(\n this.supportCodeLibrary.beforeTestRunHookDefinitions,\n 'a BeforeAll'\n )\n const assembledTestCases = await assembleTestCases({\n eventBroadcaster: this.eventBroadcaster,\n newId: this.newId,\n pickles: this.pickleIds.map((pickleId) =>\n this.eventDataCollector.getPickle(pickleId)\n ),\n supportCodeLibrary: this.supportCodeLibrary,\n })\n for (const pickleId of this.pickleIds) {\n await this.runTestCase(pickleId, assembledTestCases[pickleId])\n }\n await this.runTestRunHooks(\n this.supportCodeLibrary.afterTestRunHookDefinitions.slice(0).reverse(),\n 'an AfterAll'\n )\n this.stopwatch.stop()\n const testRunFinished: messages.Envelope = {\n testRunFinished: {\n timestamp: this.stopwatch.timestamp(),\n success: this.success,\n },\n }\n this.eventBroadcaster.emit('envelope', testRunFinished)\n if (this.options.filterStacktraces) {\n this.stackTraceFilter.unfilter()\n }\n return this.success\n }\n}\n"]}
|
|
@@ -7,8 +7,9 @@ export interface IWorkerCommand {
|
|
|
7
7
|
}
|
|
8
8
|
export interface IWorkerCommandInitialize {
|
|
9
9
|
filterStacktraces: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
requireModules: string[];
|
|
11
|
+
requirePaths: string[];
|
|
12
|
+
importPaths: string[];
|
|
12
13
|
supportCodeIds?: ICanonicalSupportCodeIds;
|
|
13
14
|
options: IRuntimeOptions;
|
|
14
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command_types.js","sourceRoot":"","sources":["../../../src/runtime/parallel/command_types.ts"],"names":[],"mappings":"","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { IRuntimeOptions } from '../index'\n\n// Messages from Coordinator to Worker\n\nexport interface IWorkerCommand {\n initialize?: IWorkerCommandInitialize\n run?: IWorkerCommandRun\n finalize?: boolean\n}\n\nexport interface IWorkerCommandInitialize {\n filterStacktraces: boolean\n
|
|
1
|
+
{"version":3,"file":"command_types.js","sourceRoot":"","sources":["../../../src/runtime/parallel/command_types.ts"],"names":[],"mappings":"","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { IRuntimeOptions } from '../index'\n\n// Messages from Coordinator to Worker\n\nexport interface IWorkerCommand {\n initialize?: IWorkerCommandInitialize\n run?: IWorkerCommandRun\n finalize?: boolean\n}\n\nexport interface IWorkerCommandInitialize {\n filterStacktraces: boolean\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n supportCodeIds?: ICanonicalSupportCodeIds\n options: IRuntimeOptions\n}\n\nexport interface ICanonicalSupportCodeIds {\n stepDefinitionIds: string[]\n beforeTestCaseHookDefinitionIds: string[]\n afterTestCaseHookDefinitionIds: string[]\n}\n\nexport interface IWorkerCommandRun {\n retries: number\n skip: boolean\n elapsed: number\n pickle: messages.Pickle\n testCase: messages.TestCase\n gherkinDocument: messages.GherkinDocument\n}\n\n// Messages from Worker to Coordinator\n\nexport interface ICoordinatorReport {\n jsonEnvelope?: string\n ready?: boolean\n}\n"]}
|
|
@@ -9,19 +9,32 @@ import { ICoordinatorReport } from './command_types';
|
|
|
9
9
|
import { IdGenerator } from '@cucumber/messages';
|
|
10
10
|
export interface INewCoordinatorOptions {
|
|
11
11
|
cwd: string;
|
|
12
|
+
logger: Console;
|
|
12
13
|
eventBroadcaster: EventEmitter;
|
|
13
14
|
eventDataCollector: EventDataCollector;
|
|
14
15
|
options: IRuntimeOptions;
|
|
15
16
|
newId: IdGenerator.NewId;
|
|
16
17
|
pickleIds: string[];
|
|
17
18
|
supportCodeLibrary: ISupportCodeLibrary;
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
requireModules: string[];
|
|
20
|
+
requirePaths: string[];
|
|
21
|
+
importPaths: string[];
|
|
20
22
|
numberOfWorkers: number;
|
|
21
23
|
}
|
|
24
|
+
declare const enum WorkerState {
|
|
25
|
+
'idle' = 0,
|
|
26
|
+
'closed' = 1,
|
|
27
|
+
'running' = 2,
|
|
28
|
+
'new' = 3
|
|
29
|
+
}
|
|
22
30
|
interface IWorker {
|
|
23
|
-
|
|
31
|
+
state: WorkerState;
|
|
24
32
|
process: ChildProcess;
|
|
33
|
+
id: string;
|
|
34
|
+
}
|
|
35
|
+
interface IPicklePlacement {
|
|
36
|
+
index: number;
|
|
37
|
+
pickle: messages.Pickle;
|
|
25
38
|
}
|
|
26
39
|
export default class Coordinator implements IRuntime {
|
|
27
40
|
private readonly cwd;
|
|
@@ -29,23 +42,29 @@ export default class Coordinator implements IRuntime {
|
|
|
29
42
|
private readonly eventDataCollector;
|
|
30
43
|
private readonly stopwatch;
|
|
31
44
|
private onFinish;
|
|
32
|
-
private nextPickleIdIndex;
|
|
33
45
|
private readonly options;
|
|
34
46
|
private readonly newId;
|
|
35
47
|
private readonly pickleIds;
|
|
36
48
|
private assembledTestCases;
|
|
49
|
+
private inProgressPickles;
|
|
37
50
|
private workers;
|
|
38
51
|
private readonly supportCodeLibrary;
|
|
39
|
-
private readonly
|
|
40
|
-
private readonly
|
|
52
|
+
private readonly requireModules;
|
|
53
|
+
private readonly requirePaths;
|
|
54
|
+
private readonly importPaths;
|
|
41
55
|
private readonly numberOfWorkers;
|
|
56
|
+
private readonly logger;
|
|
42
57
|
private success;
|
|
43
|
-
|
|
58
|
+
private idleInterventions;
|
|
59
|
+
constructor({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, numberOfWorkers, }: INewCoordinatorOptions);
|
|
44
60
|
parseWorkerMessage(worker: IWorker, message: ICoordinatorReport): void;
|
|
61
|
+
awakenWorkers(triggeringWorker: IWorker): void;
|
|
45
62
|
startWorker(id: string, total: number): void;
|
|
46
63
|
onWorkerProcessClose(exitCode: number): void;
|
|
47
64
|
parseTestCaseResult(testCaseFinished: messages.TestCaseFinished): void;
|
|
48
65
|
start(): Promise<boolean>;
|
|
49
|
-
|
|
66
|
+
nextPicklePlacement(): IPicklePlacement;
|
|
67
|
+
placementAt(index: number): IPicklePlacement;
|
|
68
|
+
giveWork(worker: IWorker, force?: boolean): void;
|
|
50
69
|
}
|
|
51
70
|
export {};
|
|
@@ -31,30 +31,35 @@ const stopwatch_1 = require("../stopwatch");
|
|
|
31
31
|
const assemble_test_cases_1 = require("../assemble_test_cases");
|
|
32
32
|
const runWorkerPath = path_1.default.resolve(__dirname, 'run_worker.js');
|
|
33
33
|
class Coordinator {
|
|
34
|
-
constructor({ cwd, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary,
|
|
34
|
+
constructor({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, numberOfWorkers, }) {
|
|
35
35
|
this.cwd = cwd;
|
|
36
|
+
this.logger = logger;
|
|
36
37
|
this.eventBroadcaster = eventBroadcaster;
|
|
37
38
|
this.eventDataCollector = eventDataCollector;
|
|
38
39
|
this.stopwatch = new stopwatch_1.RealTestRunStopwatch();
|
|
39
40
|
this.options = options;
|
|
40
41
|
this.newId = newId;
|
|
41
42
|
this.supportCodeLibrary = supportCodeLibrary;
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
43
|
+
this.requireModules = requireModules;
|
|
44
|
+
this.requirePaths = requirePaths;
|
|
45
|
+
this.importPaths = importPaths;
|
|
46
|
+
this.pickleIds = Array.from(pickleIds);
|
|
45
47
|
this.numberOfWorkers = numberOfWorkers;
|
|
46
|
-
this.nextPickleIdIndex = 0;
|
|
47
48
|
this.success = true;
|
|
48
49
|
this.workers = {};
|
|
50
|
+
this.inProgressPickles = {};
|
|
51
|
+
this.idleInterventions = 0;
|
|
49
52
|
}
|
|
50
53
|
parseWorkerMessage(worker, message) {
|
|
51
54
|
if (message.ready) {
|
|
52
|
-
|
|
55
|
+
worker.state = 0 /* idle */;
|
|
56
|
+
this.awakenWorkers(worker);
|
|
53
57
|
}
|
|
54
58
|
else if ((0, value_checker_1.doesHaveValue)(message.jsonEnvelope)) {
|
|
55
59
|
const envelope = messages.parseEnvelope(message.jsonEnvelope);
|
|
56
60
|
this.eventBroadcaster.emit('envelope', envelope);
|
|
57
61
|
if ((0, value_checker_1.doesHaveValue)(envelope.testCaseFinished)) {
|
|
62
|
+
delete this.inProgressPickles[worker.id];
|
|
58
63
|
this.parseTestCaseResult(envelope.testCaseFinished);
|
|
59
64
|
}
|
|
60
65
|
}
|
|
@@ -62,6 +67,19 @@ class Coordinator {
|
|
|
62
67
|
throw new Error(`Unexpected message from worker: ${JSON.stringify(message)}`);
|
|
63
68
|
}
|
|
64
69
|
}
|
|
70
|
+
awakenWorkers(triggeringWorker) {
|
|
71
|
+
Object.values(this.workers).forEach((worker) => {
|
|
72
|
+
if (worker.state === 0 /* idle */) {
|
|
73
|
+
this.giveWork(worker);
|
|
74
|
+
}
|
|
75
|
+
return worker.state !== 0 /* idle */;
|
|
76
|
+
});
|
|
77
|
+
if (Object.keys(this.inProgressPickles).length == 0 &&
|
|
78
|
+
this.pickleIds.length > 0) {
|
|
79
|
+
this.giveWork(triggeringWorker, true);
|
|
80
|
+
this.idleInterventions++;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
65
83
|
startWorker(id, total) {
|
|
66
84
|
const workerProcess = (0, child_process_1.fork)(runWorkerPath, [], {
|
|
67
85
|
cwd: this.cwd,
|
|
@@ -73,20 +91,21 @@ class Coordinator {
|
|
|
73
91
|
},
|
|
74
92
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
75
93
|
});
|
|
76
|
-
const worker = {
|
|
94
|
+
const worker = { state: 3 /* new */, process: workerProcess, id };
|
|
77
95
|
this.workers[id] = worker;
|
|
78
96
|
worker.process.on('message', (message) => {
|
|
79
97
|
this.parseWorkerMessage(worker, message);
|
|
80
98
|
});
|
|
81
99
|
worker.process.on('close', (exitCode) => {
|
|
82
|
-
worker.
|
|
100
|
+
worker.state = 1 /* closed */;
|
|
83
101
|
this.onWorkerProcessClose(exitCode);
|
|
84
102
|
});
|
|
85
103
|
const initializeCommand = {
|
|
86
104
|
initialize: {
|
|
87
105
|
filterStacktraces: this.options.filterStacktraces,
|
|
88
|
-
|
|
89
|
-
|
|
106
|
+
requireModules: this.requireModules,
|
|
107
|
+
requirePaths: this.requirePaths,
|
|
108
|
+
importPaths: this.importPaths,
|
|
90
109
|
supportCodeIds: {
|
|
91
110
|
stepDefinitionIds: this.supportCodeLibrary.stepDefinitions.map((s) => s.id),
|
|
92
111
|
beforeTestCaseHookDefinitionIds: this.supportCodeLibrary.beforeTestCaseHookDefinitions.map((h) => h.id),
|
|
@@ -102,7 +121,7 @@ class Coordinator {
|
|
|
102
121
|
if (!success) {
|
|
103
122
|
this.success = false;
|
|
104
123
|
}
|
|
105
|
-
if (Object.values(this.workers).every((x) => x.closed)) {
|
|
124
|
+
if (Object.values(this.workers).every((x) => x.state === 1 /* closed */)) {
|
|
106
125
|
const envelope = {
|
|
107
126
|
testRunFinished: {
|
|
108
127
|
timestamp: this.stopwatch.timestamp(),
|
|
@@ -135,22 +154,49 @@ class Coordinator {
|
|
|
135
154
|
supportCodeLibrary: this.supportCodeLibrary,
|
|
136
155
|
});
|
|
137
156
|
return await new Promise((resolve) => {
|
|
138
|
-
for (let i = 0; i
|
|
157
|
+
for (let i = 0; i < this.numberOfWorkers; i++) {
|
|
139
158
|
this.startWorker(i.toString(), this.numberOfWorkers);
|
|
140
159
|
}
|
|
141
|
-
this.onFinish =
|
|
160
|
+
this.onFinish = (status) => {
|
|
161
|
+
if (this.idleInterventions > 0) {
|
|
162
|
+
this.logger.warn(`WARNING: All workers went idle ${this.idleInterventions} time(s). Consider revising handler passed to setParallelCanAssign.`);
|
|
163
|
+
}
|
|
164
|
+
resolve(status);
|
|
165
|
+
};
|
|
142
166
|
});
|
|
143
167
|
}
|
|
144
|
-
|
|
145
|
-
|
|
168
|
+
nextPicklePlacement() {
|
|
169
|
+
for (let index = 0; index < this.pickleIds.length; index++) {
|
|
170
|
+
const placement = this.placementAt(index);
|
|
171
|
+
if (this.supportCodeLibrary.parallelCanAssign(placement.pickle, Object.values(this.inProgressPickles))) {
|
|
172
|
+
return placement;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
placementAt(index) {
|
|
178
|
+
return {
|
|
179
|
+
index,
|
|
180
|
+
pickle: this.eventDataCollector.getPickle(this.pickleIds[index]),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
giveWork(worker, force = false) {
|
|
184
|
+
if (this.pickleIds.length < 1) {
|
|
146
185
|
const finalizeCommand = { finalize: true };
|
|
186
|
+
worker.state = 2 /* running */;
|
|
147
187
|
worker.process.send(finalizeCommand);
|
|
148
188
|
return;
|
|
149
189
|
}
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
190
|
+
const picklePlacement = force
|
|
191
|
+
? this.placementAt(0)
|
|
192
|
+
: this.nextPicklePlacement();
|
|
193
|
+
if (picklePlacement === null) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const { index: nextPickleIndex, pickle } = picklePlacement;
|
|
197
|
+
this.pickleIds.splice(nextPickleIndex, 1);
|
|
198
|
+
this.inProgressPickles[worker.id] = pickle;
|
|
199
|
+
const testCase = this.assembledTestCases[pickle.id];
|
|
154
200
|
const gherkinDocument = this.eventDataCollector.getGherkinDocument(pickle.uri);
|
|
155
201
|
const retries = (0, helpers_1.retriesForPickle)(pickle, this.options);
|
|
156
202
|
const skip = this.options.dryRun || (this.options.failFast && !this.success);
|
|
@@ -164,6 +210,7 @@ class Coordinator {
|
|
|
164
210
|
gherkinDocument,
|
|
165
211
|
},
|
|
166
212
|
};
|
|
213
|
+
worker.state = 2 /* running */;
|
|
167
214
|
worker.process.send(runCommand);
|
|
168
215
|
}
|
|
169
216
|
}
|