@cucumber/cucumber 8.0.0-rc.2 → 8.1.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.
- package/README.md +82 -51
- package/api/index.d.ts +6 -0
- package/bin/{cucumber-js → cucumber.js} +0 -0
- package/lib/api/convert_configuration.d.ts +4 -0
- package/lib/api/convert_configuration.js +65 -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/api/index.js +28 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/load_configuration.d.ts +9 -0
- package/lib/api/load_configuration.js +32 -0
- package/lib/api/load_configuration.js.map +1 -0
- package/lib/api/load_sources.d.ts +9 -0
- package/lib/api/load_sources.js +53 -0
- package/lib/api/load_sources.js.map +1 -0
- package/lib/api/load_support.d.ts +10 -0
- package/lib/api/load_support.js +28 -0
- package/lib/api/load_support.js.map +1 -0
- package/lib/api/paths.d.ts +7 -0
- package/lib/{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 +25 -30
- 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 +10 -0
- package/lib/cli/validate_node_engine_version.js +24 -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 +45 -47
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/check_schema.d.ts +2 -0
- package/lib/configuration/check_schema.js +60 -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 +16 -1
- 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 +3 -3
- 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 +3 -3
- package/lib/formatter/builder.js +30 -4
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/fixtures/typescript.d.ts +2 -0
- package/lib/formatter/fixtures/typescript.js +6 -0
- package/lib/formatter/fixtures/typescript.js.map +1 -0
- package/lib/formatter/get_color_fns.js +15 -16
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.js +5 -1
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/index.js +5 -1
- package/lib/formatter/helpers/index.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/summary_helpers.js +5 -1
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +2 -2
- package/lib/formatter/helpers/test_case_attempt_formatter.js +18 -10
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +2 -2
- package/lib/formatter/helpers/test_case_attempt_parser.js +7 -2
- 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 +8 -4
- 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 +5 -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/progress_formatter.js +5 -1
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/rerun_formatter.js +5 -1
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +5 -2
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.d.ts +1 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +9 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.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 +5 -2
- 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 +12 -8
- package/lib/index.js +11 -2
- package/lib/index.js.map +1 -1
- package/lib/models/definition.d.ts +1 -0
- package/lib/models/definition.js.map +1 -1
- package/lib/models/pickle_order.d.ts +1 -0
- package/lib/models/pickle_order.js +3 -0
- package/lib/models/pickle_order.js.map +1 -0
- package/lib/models/test_case_hook_definition.d.ts +1 -0
- package/lib/models/test_case_hook_definition.js +1 -0
- package/lib/models/test_case_hook_definition.js.map +1 -1
- package/lib/runtime/attachment_manager/index.js +5 -1
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/helpers.js +5 -1
- package/lib/runtime/helpers.js.map +1 -1
- 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 +71 -20
- 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/runtime/step_runner.js +5 -1
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js +5 -1
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.js +5 -1
- package/lib/runtime/test_case_runner.js.map +1 -1
- 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 +10 -0
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/support_code_library_builder/world.d.ts +7 -7
- package/lib/support_code_library_builder/world.js.map +1 -1
- package/lib/time.js +5 -1
- package/lib/time.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 +5 -1
- package/package.json +61 -38
- 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 +0 -15
- 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":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":"
|
|
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,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,EAAE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ACf;gBACD,IAAI,CAAC,IAAI,CAAC,IAAA,wBAAc,EAAC,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;;AAvEH,iCAwEC;AAvEwB,4BAAa,GAClC,6MAA6M,CAAA","sourcesContent":["import { 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 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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as formatterHelpers from './formatter/helpers';
|
|
2
|
+
import * as parallelCanAssignHelpers from './support_code_library_builder/parallel_can_assign_helpers';
|
|
2
3
|
import * as messages from '@cucumber/messages';
|
|
3
4
|
export { default as Cli } from './cli';
|
|
4
5
|
export { parseGherkinMessageStream } from './cli/helpers';
|
|
@@ -6,6 +7,7 @@ export { default as PickleFilter } from './pickle_filter';
|
|
|
6
7
|
export { default as Runtime, INewRuntimeOptions, IRuntimeOptions, } from './runtime';
|
|
7
8
|
export { default as supportCodeLibraryBuilder } from './support_code_library_builder';
|
|
8
9
|
export { default as DataTable } from './models/data_table';
|
|
10
|
+
export { default as TestCaseHookDefinition } from './models/test_case_hook_definition';
|
|
9
11
|
export { version } from './version';
|
|
10
12
|
export { default as Formatter, IFormatterOptions } from './formatter';
|
|
11
13
|
export { default as FormatterBuilder } from './formatter/builder';
|
|
@@ -17,21 +19,23 @@ export { default as SummaryFormatter } from './formatter/summary_formatter';
|
|
|
17
19
|
export { default as UsageFormatter } from './formatter/usage_formatter';
|
|
18
20
|
export { default as UsageJsonFormatter } from './formatter/usage_json_formatter';
|
|
19
21
|
export { formatterHelpers };
|
|
20
|
-
export declare const After: (<WorldType = import("./support_code_library_builder/world").IWorld
|
|
22
|
+
export declare const After: (<WorldType = import("./support_code_library_builder/world").IWorld<any>>(code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld<any>>(tags: string, code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType_1>) => void) & (<WorldType_2 = import("./support_code_library_builder/world").IWorld<any>>(options: import("./support_code_library_builder/types").IDefineTestCaseHookOptions, code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType_2>) => void);
|
|
21
23
|
export declare const AfterAll: ((code: Function) => void) & ((options: import("./support_code_library_builder/types").IDefineTestRunHookOptions, code: Function) => void);
|
|
22
|
-
export declare const AfterStep: (<WorldType = import("./support_code_library_builder/world").IWorld
|
|
23
|
-
export declare const Before: (<WorldType = import("./support_code_library_builder/world").IWorld
|
|
24
|
+
export declare const AfterStep: (<WorldType = import("./support_code_library_builder/world").IWorld<any>>(code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld<any>>(tags: string, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_1>) => void) & (<WorldType_2 = import("./support_code_library_builder/world").IWorld<any>>(options: import("./support_code_library_builder/types").IDefineTestStepHookOptions, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_2>) => void);
|
|
25
|
+
export declare const Before: (<WorldType = import("./support_code_library_builder/world").IWorld<any>>(code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld<any>>(tags: string, code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType_1>) => void) & (<WorldType_2 = import("./support_code_library_builder/world").IWorld<any>>(options: import("./support_code_library_builder/types").IDefineTestCaseHookOptions, code: import("./support_code_library_builder/types").TestCaseHookFunction<WorldType_2>) => void);
|
|
24
26
|
export declare const BeforeAll: ((code: Function) => void) & ((options: import("./support_code_library_builder/types").IDefineTestRunHookOptions, code: Function) => void);
|
|
25
|
-
export declare const BeforeStep: (<WorldType = import("./support_code_library_builder/world").IWorld
|
|
27
|
+
export declare const BeforeStep: (<WorldType = import("./support_code_library_builder/world").IWorld<any>>(code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld<any>>(tags: string, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_1>) => void) & (<WorldType_2 = import("./support_code_library_builder/world").IWorld<any>>(options: import("./support_code_library_builder/types").IDefineTestStepHookOptions, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_2>) => void);
|
|
26
28
|
export declare const defineParameterType: (options: import("./support_code_library_builder/types").IParameterTypeDefinition<any>) => void;
|
|
27
|
-
export declare const defineStep: (<WorldType = import("./support_code_library_builder/world").IWorld
|
|
28
|
-
export declare const Given: (<WorldType = import("./support_code_library_builder/world").IWorld
|
|
29
|
+
export declare const defineStep: (<WorldType = import("./support_code_library_builder/world").IWorld<any>>(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<any>>(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);
|
|
30
|
+
export declare const Given: (<WorldType = import("./support_code_library_builder/world").IWorld<any>>(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<any>>(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);
|
|
29
31
|
export declare const setDefaultTimeout: (milliseconds: number) => void;
|
|
30
32
|
export declare const setDefinitionFunctionWrapper: (fn: Function) => void;
|
|
31
33
|
export declare const setWorldConstructor: (fn: any) => void;
|
|
32
|
-
export declare const
|
|
33
|
-
export declare const
|
|
34
|
+
export declare const setParallelCanAssign: (fn: import("./support_code_library_builder/types").ParallelAssignmentValidator) => void;
|
|
35
|
+
export declare const Then: (<WorldType = import("./support_code_library_builder/world").IWorld<any>>(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<any>>(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);
|
|
36
|
+
export declare const When: (<WorldType = import("./support_code_library_builder/world").IWorld<any>>(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<any>>(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
37
|
export { default as World, IWorld, IWorldOptions, } from './support_code_library_builder/world';
|
|
38
|
+
export { parallelCanAssignHelpers };
|
|
35
39
|
export { ITestCaseHookParameter, ITestStepHookParameter, } from './support_code_library_builder/types';
|
|
36
40
|
export declare const Status: typeof messages.TestStepResultStatus;
|
|
37
41
|
export { wrapPromiseWithTimeout } from './time';
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -22,9 +26,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
27
|
};
|
|
24
28
|
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;
|
|
29
|
+
exports.wrapPromiseWithTimeout = exports.Status = exports.parallelCanAssignHelpers = 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
30
|
const formatterHelpers = __importStar(require("./formatter/helpers"));
|
|
27
31
|
exports.formatterHelpers = formatterHelpers;
|
|
32
|
+
const parallelCanAssignHelpers = __importStar(require("./support_code_library_builder/parallel_can_assign_helpers"));
|
|
33
|
+
exports.parallelCanAssignHelpers = parallelCanAssignHelpers;
|
|
28
34
|
const support_code_library_builder_1 = __importDefault(require("./support_code_library_builder"));
|
|
29
35
|
const messages = __importStar(require("@cucumber/messages"));
|
|
30
36
|
// Top level
|
|
@@ -40,6 +46,8 @@ var support_code_library_builder_2 = require("./support_code_library_builder");
|
|
|
40
46
|
Object.defineProperty(exports, "supportCodeLibraryBuilder", { enumerable: true, get: function () { return __importDefault(support_code_library_builder_2).default; } });
|
|
41
47
|
var data_table_1 = require("./models/data_table");
|
|
42
48
|
Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return __importDefault(data_table_1).default; } });
|
|
49
|
+
var test_case_hook_definition_1 = require("./models/test_case_hook_definition");
|
|
50
|
+
Object.defineProperty(exports, "TestCaseHookDefinition", { enumerable: true, get: function () { return __importDefault(test_case_hook_definition_1).default; } });
|
|
43
51
|
var version_1 = require("./version");
|
|
44
52
|
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_1.version; } });
|
|
45
53
|
// Formatters
|
|
@@ -75,6 +83,7 @@ exports.Given = methods.Given;
|
|
|
75
83
|
exports.setDefaultTimeout = methods.setDefaultTimeout;
|
|
76
84
|
exports.setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper;
|
|
77
85
|
exports.setWorldConstructor = methods.setWorldConstructor;
|
|
86
|
+
exports.setParallelCanAssign = methods.setParallelCanAssign;
|
|
78
87
|
exports.Then = methods.Then;
|
|
79
88
|
exports.When = methods.When;
|
|
80
89
|
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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAuD;AA6B9C,4CAAgB;AA5BzB,qHAAsG;AAoD7F,4DAAwB;AAnDjC,kGAAsE;AACtE,6DAA8C;AAE9C,YAAY;AACZ,6BAAsC;AAA7B,2GAAA,OAAO,OAAO;AACvB,yCAAyD;AAAhD,oHAAA,yBAAyB,OAA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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;AAUL,QAAA,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAA;AAEnD,eAAe;AACf,+BAA+C;AAAtC,8GAAA,sBAAsB,OAAA","sourcesContent":["import * as formatterHelpers from './formatter/helpers'\nimport * as parallelCanAssignHelpers from './support_code_library_builder/parallel_can_assign_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'\nexport { parallelCanAssignHelpers }\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/models/definition.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/models/definition.ts"],"names":[],"mappings":";;AAsDA,MAA8B,UAAU;IAQtC,YAAY,EACV,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,OAAO,EACP,aAAa,EACb,GAAG,GACuC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,6BAA6B,CAC3B,mBAAoC,EACpC,cAA+B;QAE/B,OAAO,CACL,gBAAgB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY;YACvD,iBAAiB,mBAAmB,CAAC,QAAQ,EAAE,0CAA0C;YACzF,OAAO,cAAc,CAAC,QAAQ,EAAE,4BAA4B,CAC7D,CAAA;IACH,CAAC;IAED,+BAA+B,CAAC,UAAiB;QAC/C,OAAO,IAAI,CAAC,6BAA6B,CACvC,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,MAAM,GAAG,CAAC,CACtB,CAAA;IACH,CAAC;CACF;AAzCD,6BAyCC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { Expression } from '@cucumber/cucumber-expressions'\n\nexport interface IGetInvocationDataRequest {\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n world: any\n}\n\nexport interface IGetInvocationDataResponse {\n getInvalidCodeLengthMessage: () => string\n parameters: any[]\n validCodeLengths: number[]\n}\n\nexport interface IDefinitionOptions {\n timeout?: number\n wrapperOptions?: any\n}\n\nexport interface IHookDefinitionOptions extends IDefinitionOptions {\n name?: string\n tags?: string\n}\n\nexport interface IDefinitionParameters<T extends IDefinitionOptions> {\n code: Function\n id: string\n line: number\n options: T\n unwrappedCode?: Function\n uri: string\n}\n\nexport interface IStepDefinitionParameters\n extends IDefinitionParameters<IDefinitionOptions> {\n pattern: string | RegExp\n expression: Expression\n}\n\nexport interface IDefinition {\n readonly code: Function\n readonly id: string\n readonly line: number\n readonly options: IDefinitionOptions\n readonly unwrappedCode: Function\n readonly uri: string\n\n getInvocationParameters: (\n options: IGetInvocationDataRequest\n ) => Promise<IGetInvocationDataResponse>\n}\n\nexport default abstract class Definition {\n public readonly code: Function\n public readonly id: string\n public readonly line: number\n public readonly options: IDefinitionOptions\n public readonly unwrappedCode: Function\n public readonly uri: string\n\n constructor({\n code,\n id,\n line,\n options,\n unwrappedCode,\n uri,\n }: IDefinitionParameters<IDefinitionOptions>) {\n this.code = code\n this.id = id\n this.line = line\n this.options = options\n this.unwrappedCode = unwrappedCode\n this.uri = uri\n }\n\n buildInvalidCodeLengthMessage(\n syncOrPromiseLength: number | string,\n callbackLength: number | string\n ): string {\n return (\n `function has ${this.code.length.toString()} arguments` +\n `, should have ${syncOrPromiseLength.toString()} (if synchronous or returning a promise)` +\n ` or ${callbackLength.toString()} (if accepting a callback)`\n )\n }\n\n baseGetInvalidCodeLengthMessage(parameters: any[]): string {\n return this.buildInvalidCodeLengthMessage(\n parameters.length,\n parameters.length + 1\n )\n }\n}\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"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Definition, { IDefinition, IDefinitionParameters, IGetInvocationDataRequest, IGetInvocationDataResponse, IHookDefinitionOptions } from './definition';
|
|
2
2
|
import * as messages from '@cucumber/messages';
|
|
3
3
|
export default class TestCaseHookDefinition extends Definition implements IDefinition {
|
|
4
|
+
readonly name: string;
|
|
4
5
|
readonly tagExpression: string;
|
|
5
6
|
private readonly pickleTagFilter;
|
|
6
7
|
constructor(data: IDefinitionParameters<IHookDefinitionOptions>);
|
|
@@ -8,6 +8,7 @@ const definition_1 = __importDefault(require("./definition"));
|
|
|
8
8
|
class TestCaseHookDefinition extends definition_1.default {
|
|
9
9
|
constructor(data) {
|
|
10
10
|
super(data);
|
|
11
|
+
this.name = data.options.name;
|
|
11
12
|
this.tagExpression = data.options.tags;
|
|
12
13
|
this.pickleTagFilter = new pickle_filter_1.PickleTagFilter(data.options.tags);
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_case_hook_definition.js","sourceRoot":"","sources":["../../src/models/test_case_hook_definition.ts"],"names":[],"mappings":";;;;;AAAA,oDAAkD;AAClD,8DAMqB;AAGrB,MAAqB,sBACnB,SAAQ,oBAAU;
|
|
1
|
+
{"version":3,"file":"test_case_hook_definition.js","sourceRoot":"","sources":["../../src/models/test_case_hook_definition.ts"],"names":[],"mappings":";;;;;AAAA,oDAAkD;AAClD,8DAMqB;AAGrB,MAAqB,sBACnB,SAAQ,oBAAU;IAOlB,YAAY,IAAmD;QAC7D,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QACtC,IAAI,CAAC,eAAe,GAAG,IAAI,+BAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/D,CAAC;IAED,iBAAiB,CAAC,MAAuB;QACvC,OAAO,IAAI,CAAC,eAAe,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAC9D,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,EAC5B,aAAa,GACa;QAC1B,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC;YAC3B,2BAA2B,EAAE,GAAG,EAAE,CAChC,IAAI,CAAC,6BAA6B,CAAC,QAAQ,EAAE,GAAG,CAAC;YACnD,UAAU,EAAE,CAAC,aAAa,CAAC;YAC3B,gBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SAC5B,CAAC,CAAA;IACJ,CAAC;CACF;AA7BD,yCA6BC","sourcesContent":["import { PickleTagFilter } from '../pickle_filter'\nimport Definition, {\n IDefinition,\n IDefinitionParameters,\n IGetInvocationDataRequest,\n IGetInvocationDataResponse,\n IHookDefinitionOptions,\n} from './definition'\nimport * as messages from '@cucumber/messages'\n\nexport default class TestCaseHookDefinition\n extends Definition\n implements IDefinition\n{\n public readonly name: string\n public readonly tagExpression: string\n private readonly pickleTagFilter: PickleTagFilter\n\n constructor(data: IDefinitionParameters<IHookDefinitionOptions>) {\n super(data)\n this.name = data.options.name\n this.tagExpression = data.options.tags\n this.pickleTagFilter = new PickleTagFilter(data.options.tags)\n }\n\n appliesToTestCase(pickle: messages.Pickle): boolean {\n return this.pickleTagFilter.matchesAllTagExpressions(pickle)\n }\n\n async getInvocationParameters({\n hookParameter,\n }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse> {\n return await Promise.resolve({\n getInvalidCodeLengthMessage: () =>\n this.buildInvalidCodeLengthMessage('0 or 1', '2'),\n parameters: [hookParameter],\n validCodeLengths: [0, 1, 2],\n })\n }\n}\n"]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/attachment_manager/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/attachment_manager/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAgC;AAEhC,6DAA8C;AAC9C,uDAAqE;AAoBrE,MAAqB,iBAAiB;IAGpC,YAAY,YAA6B;QACvC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAA;IACvD,CAAC;IAED,MAAM,CACJ,IAAgC,EAChC,SAAkB,EAClB,QAAqB;Q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AyB,CAAC,MAAM;YACnD,WAAW,EAAE,SAAS;SACvB,CAAC,CAAA;IACJ,CAAC;IAED,sBAAsB,CACpB,IAAc,EACd,SAAiB,EACjB,QAAoB;QAEpB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpD,MAAM,OAAO,GAAiB,EAAE,CAAA;YAChC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBACxB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACrB,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBAClB,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAA;gBAC9D,OAAO,EAAE,CAAA;YACX,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;QACF,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,EAAE;YAC3B,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;SACjC;aAAM;YACL,OAAO,OAAO,CAAA;SACf;IACH,CAAC;IAED,sBAAsB,CAAC,IAAY,EAAE,KAAuB;QAC1D,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACpC,CAAC;CACF;AAjFD,oCAiFC","sourcesContent":["import isStream from 'is-stream'\nimport { Readable } from 'stream'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\n\nexport interface IAttachmentMedia {\n encoding: messages.AttachmentContentEncoding\n contentType: string\n}\n\nexport interface IAttachment {\n data: string\n media: IAttachmentMedia\n}\n\nexport type IAttachFunction = (attachment: IAttachment) => void\nexport type ICreateAttachment = (\n data: Buffer | Readable | string,\n mediaType?: string,\n callback?: () => void\n) => void | Promise<void>\nexport type ICreateLog = (text: string) => void | Promise<void>\n\nexport default class AttachmentManager {\n private readonly onAttachment: IAttachFunction\n\n constructor(onAttachment: IAttachFunction) {\n this.onAttachment = onAttachment\n }\n\n log(text: string): void | Promise<void> {\n return this.create(text, 'text/x.cucumber.log+plain')\n }\n\n create(\n data: Buffer | Readable | string,\n mediaType?: string,\n callback?: () => void\n ): void | Promise<void> {\n if (Buffer.isBuffer(data)) {\n if (doesNotHaveValue(mediaType)) {\n throw Error('Buffer attachments must specify a media type')\n }\n this.createBufferAttachment(data, mediaType)\n } else if (isStream.readable(data)) {\n if (doesNotHaveValue(mediaType)) {\n throw Error('Stream attachments must specify a media type')\n }\n return this.createStreamAttachment(data, mediaType, callback)\n } else if (typeof data === 'string') {\n if (doesNotHaveValue(mediaType)) {\n mediaType = 'text/plain'\n }\n if (mediaType.startsWith('base64:')) {\n this.createStringAttachment(data, {\n encoding: messages.AttachmentContentEncoding.BASE64,\n contentType: mediaType.replace('base64:', ''),\n })\n } else {\n this.createStringAttachment(data, {\n encoding: messages.AttachmentContentEncoding.IDENTITY,\n contentType: mediaType,\n })\n }\n } else {\n throw Error(\n 'Invalid attachment data: must be a buffer, readable stream, or string'\n )\n }\n }\n\n createBufferAttachment(data: Buffer, mediaType: string): void {\n this.createStringAttachment(data.toString('base64'), {\n encoding: messages.AttachmentContentEncoding.BASE64,\n contentType: mediaType,\n })\n }\n\n createStreamAttachment(\n data: Readable,\n mediaType: string,\n callback: () => void\n ): void | Promise<void> {\n const promise = new Promise<void>((resolve, reject) => {\n const buffers: Uint8Array[] = []\n data.on('data', (chunk) => {\n buffers.push(chunk)\n })\n data.on('end', () => {\n this.createBufferAttachment(Buffer.concat(buffers), mediaType)\n resolve()\n })\n data.on('error', reject)\n })\n if (doesHaveValue(callback)) {\n promise.then(callback, callback)\n } else {\n return promise\n }\n }\n\n createStringAttachment(data: string, media: IAttachmentMedia): void {\n this.onAttachment({ data, media })\n }\n}\n"]}
|
package/lib/runtime/helpers.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/runtime/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/runtime/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4EAAsE;AACtE,4DAA8B;AAC9B,kEAAwC;AACxC,oDAAkD;AAElD,6DAA8C;AAG9C,SAAgB,yBAAyB,CACvC,eAAiC;IAEjC,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;QACtB,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,aAAa,EAAE,EAAE;YACjB,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,EAAE;YAClB,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,EAAE;YACT,WAAW,EAAE,EAAE;YACf,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,EAAE;SAChB;QACD,K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B,CAAC,MAAM;QACpC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;KACxC,CAAA;IACD,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA;KAC5D;IACD,OAAO,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AACzC,CAAC;AAhBD,gDAgBC","sourcesContent":["import { formatLocation } from '../formatter/helpers/location_helpers'\nimport Table from 'cli-table3'\nimport indentString from 'indent-string'\nimport { PickleTagFilter } from '../pickle_filter'\nimport StepDefinition from '../models/step_definition'\nimport * as messages from '@cucumber/messages'\nimport { IRuntimeOptions } from '.'\n\nexport function getAmbiguousStepException(\n stepDefinitions: StepDefinition[]\n): string {\n const table = new Table({\n chars: {\n bottom: '',\n 'bottom-left': '',\n 'bottom-mid': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n middle: ' - ',\n right: '',\n 'right-mid': '',\n top: '',\n 'top-left': '',\n 'top-mid': '',\n 'top-right': '',\n },\n style: {\n border: [],\n 'padding-left': 0,\n 'padding-right': 0,\n },\n })\n table.push(\n ...stepDefinitions.map((stepDefinition) => {\n const pattern = stepDefinition.pattern.toString()\n return [pattern, formatLocation(stepDefinition)]\n })\n )\n return `${'Multiple step definitions match:' + '\\n'}${indentString(\n table.toString(),\n 2\n )}`\n}\n\nexport function retriesForPickle(\n pickle: messages.Pickle,\n options: IRuntimeOptions\n): number {\n if (!options.retry) {\n return 0\n }\n const retries = options.retry\n if (retries === 0) {\n return 0\n }\n const retryTagFilter = options.retryTagFilter\n if (!retryTagFilter) {\n return retries\n }\n const pickleTagFilter = new PickleTagFilter(retryTagFilter)\n if (pickleTagFilter.matchesAllTagExpressions(pickle)) {\n return retries\n }\n return 0\n}\n\nexport function shouldCauseFailure(\n status: messages.TestStepResultStatus,\n options: IRuntimeOptions\n): boolean {\n if (options.dryRun) {\n return false\n }\n const failureStatuses: messages.TestStepResultStatus[] = [\n messages.TestStepResultStatus.AMBIGUOUS,\n messages.TestStepResultStatus.FAILED,\n messages.TestStepResultStatus.UNDEFINED,\n ]\n if (options.strict) {\n failureStatuses.push(messages.TestStepResultStatus.PENDING)\n }\n return failureStatuses.includes(status)\n}\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.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AK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CACvC,IAAI,CAAC,kBAAkB,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 {};
|