@cucumber/cucumber 11.1.1 → 11.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +9 -7
  2. package/lib/api/convert_configuration.d.ts +1 -1
  3. package/lib/api/convert_configuration.js.map +1 -1
  4. package/lib/api/formatters.d.ts +1 -1
  5. package/lib/api/formatters.js +1 -1
  6. package/lib/api/formatters.js.map +1 -1
  7. package/lib/api/index.d.ts +1 -0
  8. package/lib/api/index.js.map +1 -1
  9. package/lib/api/load_configuration.d.ts +2 -1
  10. package/lib/api/load_configuration.js +2 -2
  11. package/lib/api/load_configuration.js.map +1 -1
  12. package/lib/api/load_sources.d.ts +2 -1
  13. package/lib/api/load_sources.js +3 -3
  14. package/lib/api/load_sources.js.map +1 -1
  15. package/lib/api/load_support.d.ts +2 -1
  16. package/lib/api/load_support.js +3 -3
  17. package/lib/api/load_support.js.map +1 -1
  18. package/lib/api/plugins.d.ts +5 -5
  19. package/lib/api/plugins.js +9 -9
  20. package/lib/api/plugins.js.map +1 -1
  21. package/lib/api/run_cucumber.d.ts +2 -1
  22. package/lib/api/run_cucumber.js +3 -3
  23. package/lib/api/run_cucumber.js.map +1 -1
  24. package/lib/api/support.d.ts +1 -1
  25. package/lib/api/support.js.map +1 -1
  26. package/lib/api/test_helpers.d.ts +1 -1
  27. package/lib/api/test_helpers.js.map +1 -1
  28. package/lib/api/types.d.ts +0 -35
  29. package/lib/api/types.js.map +1 -1
  30. package/lib/assemble/assemble_test_cases.d.ts +1 -6
  31. package/lib/assemble/assemble_test_cases.js +2 -1
  32. package/lib/assemble/assemble_test_cases.js.map +1 -1
  33. package/lib/cli/helpers.d.ts +1 -1
  34. package/lib/cli/helpers.js +41 -22
  35. package/lib/cli/helpers.js.map +1 -1
  36. package/lib/configuration/from_file.d.ts +1 -1
  37. package/lib/configuration/from_file.js +2 -2
  38. package/lib/configuration/from_file.js.map +1 -1
  39. package/lib/configuration/parse_configuration.d.ts +1 -1
  40. package/lib/configuration/parse_configuration.js.map +1 -1
  41. package/lib/configuration/split_format_descriptor.d.ts +1 -1
  42. package/lib/configuration/split_format_descriptor.js.map +1 -1
  43. package/lib/configuration/validate_configuration.d.ts +1 -1
  44. package/lib/configuration/validate_configuration.js.map +1 -1
  45. package/lib/environment/console_logger.d.ts +12 -0
  46. package/lib/{api → environment}/console_logger.js +6 -6
  47. package/lib/environment/console_logger.js.map +1 -0
  48. package/lib/environment/index.d.ts +2 -0
  49. package/lib/environment/index.js +19 -0
  50. package/lib/environment/index.js.map +1 -0
  51. package/lib/environment/make_environment.d.ts +2 -0
  52. package/lib/{api/environment.js → environment/make_environment.js} +4 -4
  53. package/lib/environment/make_environment.js.map +1 -0
  54. package/lib/environment/types.d.ts +42 -0
  55. package/lib/{logger.js → environment/types.js} +1 -1
  56. package/lib/environment/types.js.map +1 -0
  57. package/lib/formatter/create_stream.d.ts +1 -1
  58. package/lib/formatter/create_stream.js.map +1 -1
  59. package/lib/paths/paths.d.ts +1 -1
  60. package/lib/paths/paths.js.map +1 -1
  61. package/lib/plugin/plugin_manager.d.ts +5 -4
  62. package/lib/plugin/plugin_manager.js +13 -5
  63. package/lib/plugin/plugin_manager.js.map +1 -1
  64. package/lib/plugin/types.d.ts +4 -3
  65. package/lib/plugin/types.js.map +1 -1
  66. package/lib/runtime/coordinator.js +4 -6
  67. package/lib/runtime/coordinator.js.map +1 -1
  68. package/lib/runtime/make_runtime.d.ts +3 -2
  69. package/lib/runtime/make_runtime.js.map +1 -1
  70. package/lib/runtime/parallel/adapter.d.ts +2 -2
  71. package/lib/runtime/parallel/adapter.js.map +1 -1
  72. package/lib/runtime/step_runner.js +6 -4
  73. package/lib/runtime/step_runner.js.map +1 -1
  74. package/lib/version.d.ts +1 -1
  75. package/lib/version.js +1 -1
  76. package/lib/version.js.map +1 -1
  77. package/package.json +9 -9
  78. package/lib/api/console_logger.d.ts +0 -12
  79. package/lib/api/console_logger.js.map +0 -1
  80. package/lib/api/environment.d.ts +0 -7
  81. package/lib/api/environment.js.map +0 -1
  82. package/lib/logger.d.ts +0 -5
  83. package/lib/logger.js.map +0 -1
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <h1 align="center">
2
- <img src="./docs/images/logo.svg" alt="">
2
+ <img src="./docs/images/logo.svg" alt="" width="75">
3
3
  <br>
4
4
  Cucumber
5
5
  </h1>
@@ -7,12 +7,14 @@
7
7
  <b>Automated tests in plain language, for Node.js</b>
8
8
  </p>
9
9
 
10
- [![#StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://vshymanskyy.github.io/StandWithUkraine)
11
- [![npm](https://img.shields.io/npm/v/@cucumber/cucumber.svg)](https://www.npmjs.com/package/@cucumber/cucumber)
12
- [![build](https://github.com/cucumber/cucumber-js/actions/workflows/build.yaml/badge.svg)](https://github.com/cucumber/cucumber-js/actions)
13
- [![coverage](https://coveralls.io/repos/github/cucumber/cucumber-js/badge.svg?branch=main)](https://coveralls.io/github/cucumber/cucumber-js?branch=master)
14
- [![backers](https://opencollective.com/cucumber/backers/badge.svg)](https://opencollective.com/cucumber)
15
- [![sponsors](https://opencollective.com/cucumber/sponsors/badge.svg)](https://opencollective.com/cucumber)
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package/@cucumber/cucumber" style="text-decoration: none"><img src="https://img.shields.io/npm/v/@cucumber/cucumber?style=flat&color=dark-green" alt="Latest version on npm"></a>
12
+ <a href="https://github.com/cucumber/cucumber-js/actions" style="text-decoration: none"><img src="https://github.com/cucumber/cucumber-js/actions/workflows/build.yaml/badge.svg" alt="Build status"></a>
13
+ <a href="https://coveralls.io/github/cucumber/cucumber-js?branch=master" style="text-decoration: none"><img src="https://coveralls.io/repos/github/cucumber/cucumber-js/badge.svg?branch=main" alt="Coverage"></a>
14
+ <a href="https://opencollective.com/cucumber"><img src="https://opencollective.com/cucumber/backers/badge.svg" alt="Backers"></a>
15
+ <a href="https://opencollective.com/cucumber"><img src="https://opencollective.com/cucumber/sponsors/badge.svg" alt="Sponsors"></a>
16
+ <a href="https://vshymanskyy.github.io/StandWithUkraine"><img src="https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg" alt="Ukraine solidarity"></a>
17
+ </p>
16
18
 
17
19
  [Cucumber](https://github.com/cucumber) is a tool for running automated tests written in plain language. Because they're
18
20
  written in plain language, they can be read by anyone on your team. Because they can be
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import { IConfiguration } from '../configuration';
3
- import { ILogger } from '../logger';
3
+ import { ILogger } from '../environment';
4
4
  import { IRunConfiguration } from './types';
5
5
  export declare function convertConfiguration(logger: ILogger, flatConfiguration: IConfiguration, env: NodeJS.ProcessEnv): Promise<IRunConfiguration>;
@@ -1 +1 @@
1
- {"version":3,"file":"convert_configuration.js","sourceRoot":"","sources":["../../src/api/convert_configuration.ts"],"names":[],"mappings":";;;AAAA,oDAIyB;AAKlB,KAAK,UAAU,oBAAoB,CACxC,MAAe,EACf,iBAAiC,EACjC,GAAsB;IAEtB,OAAO;QACL,OAAO,EAAE;YACP,KAAK,EAAE,iBAAiB,CAAC,KAAK;YAC9B,cAAc,EAAE,iBAAiB,CAAC,QAAQ;YAC1C,KAAK,EAAE,iBAAiB,CAAC,IAAI;YAC7B,aAAa,EAAE,iBAAiB,CAAC,IAAI;YACrC,KAAK,EAAE,iBAAiB,CAAC,KAAK;SAC/B;QACD,OAAO,EAAE;YACP,cAAc,EAAE,iBAAiB,CAAC,aAAa;YAC/C,YAAY,EAAE,iBAAiB,CAAC,OAAO;YACvC,WAAW,EAAE,iBAAiB,CAAC,MAAM;YACrC,OAAO,EAAE,iBAAiB,CAAC,MAAM;SAClC;QACD,OAAO,EAAE;YACP,MAAM,EAAE,iBAAiB,CAAC,MAAM;YAChC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;YACpC,iBAAiB,EAAE,CAAC,iBAAiB,CAAC,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,iBAAiC,EACjC,GAAsB;IAEtB,MAAM,OAAO,GAAG,YAAY,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAA;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IACD,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,oBAAoB;QAC7B,KAAK,EAAE,GAAG,CAAC,sBAAsB;KAClC,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CACnB,iBAAiC,EACjC,GAAsB;IAEtB,OAAO,CACL,iBAAiB,CAAC,OAAO;QACzB,IAAA,8BAAc,EAAC,GAAG,CAAC,wBAAwB,CAAC;QAC5C,GAAG,CAAC,sBAAsB,KAAK,SAAS,CACzC,CAAA;AACH,CAAC","sourcesContent":["import {\n IConfiguration,\n isTruthyString,\n splitFormatDescriptor,\n} from '../configuration'\nimport { IPublishConfig } from '../publish'\nimport { ILogger } from '../logger'\nimport { IRunConfiguration } from './types'\n\nexport async function convertConfiguration(\n logger: ILogger,\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): Promise<IRunConfiguration> {\n return {\n sources: {\n paths: flatConfiguration.paths,\n defaultDialect: flatConfiguration.language,\n names: flatConfiguration.name,\n tagExpression: flatConfiguration.tags,\n order: flatConfiguration.order,\n },\n support: {\n requireModules: flatConfiguration.requireModule,\n requirePaths: flatConfiguration.require,\n importPaths: flatConfiguration.import,\n loaders: flatConfiguration.loader,\n },\n runtime: {\n dryRun: flatConfiguration.dryRun,\n failFast: flatConfiguration.failFast,\n filterStacktraces: !flatConfiguration.backtrace,\n parallel: flatConfiguration.parallel,\n retry: flatConfiguration.retry,\n retryTagFilter: flatConfiguration.retryTagFilter,\n strict: flatConfiguration.strict,\n worldParameters: flatConfiguration.worldParameters,\n },\n formats: convertFormats(logger, flatConfiguration, env),\n }\n}\n\nfunction convertFormats(\n logger: ILogger,\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n) {\n const splitFormats: string[][] = flatConfiguration.format.map((item) =>\n Array.isArray(item) ? item : splitFormatDescriptor(logger, item)\n )\n return {\n stdout:\n [...splitFormats].reverse().find(([, target]) => !target)?.[0] ??\n 'progress',\n files: splitFormats\n .filter(([, target]) => !!target)\n .reduce((mapped, [type, target]) => {\n return {\n ...mapped,\n [target]: type,\n }\n }, {}),\n publish: makePublishConfig(flatConfiguration, env),\n options: flatConfiguration.formatOptions,\n }\n}\n\nfunction makePublishConfig(\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): IPublishConfig | false {\n const enabled = isPublishing(flatConfiguration, env)\n if (!enabled) {\n return false\n }\n return {\n url: env.CUCUMBER_PUBLISH_URL,\n token: env.CUCUMBER_PUBLISH_TOKEN,\n }\n}\n\nfunction isPublishing(\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): boolean {\n return (\n flatConfiguration.publish ||\n isTruthyString(env.CUCUMBER_PUBLISH_ENABLED) ||\n env.CUCUMBER_PUBLISH_TOKEN !== undefined\n )\n}\n"]}
1
+ {"version":3,"file":"convert_configuration.js","sourceRoot":"","sources":["../../src/api/convert_configuration.ts"],"names":[],"mappings":";;;AAAA,oDAIyB;AAKlB,KAAK,UAAU,oBAAoB,CACxC,MAAe,EACf,iBAAiC,EACjC,GAAsB;IAEtB,OAAO;QACL,OAAO,EAAE;YACP,KAAK,EAAE,iBAAiB,CAAC,KAAK;YAC9B,cAAc,EAAE,iBAAiB,CAAC,QAAQ;YAC1C,KAAK,EAAE,iBAAiB,CAAC,IAAI;YAC7B,aAAa,EAAE,iBAAiB,CAAC,IAAI;YACrC,KAAK,EAAE,iBAAiB,CAAC,KAAK;SAC/B;QACD,OAAO,EAAE;YACP,cAAc,EAAE,iBAAiB,CAAC,aAAa;YAC/C,YAAY,EAAE,iBAAiB,CAAC,OAAO;YACvC,WAAW,EAAE,iBAAiB,CAAC,MAAM;YACrC,OAAO,EAAE,iBAAiB,CAAC,MAAM;SAClC;QACD,OAAO,EAAE;YACP,MAAM,EAAE,iBA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,GAAG,CAAC;QAClD,OAAO,EAAE,iBAAiB,CAAC,aAAa;KACzC,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,iBAAiC,EACjC,GAAsB;IAEtB,MAAM,OAAO,GAAG,YAAY,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAA;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IACD,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,oBAAoB;QAC7B,KAAK,EAAE,GAAG,CAAC,sBAAsB;KAClC,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CACnB,iBAAiC,EACjC,GAAsB;IAEtB,OAAO,CACL,iBAAiB,CAAC,OAAO;QACzB,IAAA,8BAAc,EAAC,GAAG,CAAC,wBAAwB,CAAC;QAC5C,GAAG,CAAC,sBAAsB,KAAK,SAAS,CACzC,CAAA;AACH,CAAC","sourcesContent":["import {\n IConfiguration,\n isTruthyString,\n splitFormatDescriptor,\n} from '../configuration'\nimport { IPublishConfig } from '../publish'\nimport { ILogger } from '../environment'\nimport { IRunConfiguration } from './types'\n\nexport async function convertConfiguration(\n logger: ILogger,\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): Promise<IRunConfiguration> {\n return {\n sources: {\n paths: flatConfiguration.paths,\n defaultDialect: flatConfiguration.language,\n names: flatConfiguration.name,\n tagExpression: flatConfiguration.tags,\n order: flatConfiguration.order,\n },\n support: {\n requireModules: flatConfiguration.requireModule,\n requirePaths: flatConfiguration.require,\n importPaths: flatConfiguration.import,\n loaders: flatConfiguration.loader,\n },\n runtime: {\n dryRun: flatConfiguration.dryRun,\n failFast: flatConfiguration.failFast,\n filterStacktraces: !flatConfiguration.backtrace,\n parallel: flatConfiguration.parallel,\n retry: flatConfiguration.retry,\n retryTagFilter: flatConfiguration.retryTagFilter,\n strict: flatConfiguration.strict,\n worldParameters: flatConfiguration.worldParameters,\n },\n formats: convertFormats(logger, flatConfiguration, env),\n }\n}\n\nfunction convertFormats(\n logger: ILogger,\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n) {\n const splitFormats: string[][] = flatConfiguration.format.map((item) =>\n Array.isArray(item) ? item : splitFormatDescriptor(logger, item)\n )\n return {\n stdout:\n [...splitFormats].reverse().find(([, target]) => !target)?.[0] ??\n 'progress',\n files: splitFormats\n .filter(([, target]) => !!target)\n .reduce((mapped, [type, target]) => {\n return {\n ...mapped,\n [target]: type,\n }\n }, {}),\n publish: makePublishConfig(flatConfiguration, env),\n options: flatConfiguration.formatOptions,\n }\n}\n\nfunction makePublishConfig(\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): IPublishConfig | false {\n const enabled = isPublishing(flatConfiguration, env)\n if (!enabled) {\n return false\n }\n return {\n url: env.CUCUMBER_PUBLISH_URL,\n token: env.CUCUMBER_PUBLISH_TOKEN,\n }\n}\n\nfunction isPublishing(\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): boolean {\n return (\n flatConfiguration.publish ||\n isTruthyString(env.CUCUMBER_PUBLISH_ENABLED) ||\n env.CUCUMBER_PUBLISH_TOKEN !== undefined\n )\n}\n"]}
@@ -4,7 +4,7 @@ import { EventEmitter } from 'node:events';
4
4
  import { IFormatterStream } from '../formatter';
5
5
  import { EventDataCollector } from '../formatter/helpers';
6
6
  import { SupportCodeLibrary } from '../support_code_library_builder/types';
7
- import { ILogger } from '../logger';
7
+ import { ILogger } from '../environment';
8
8
  import { PluginManager } from '../plugin';
9
9
  import { IRunOptionsFormats } from './types';
10
10
  export declare function initializeFormatters({ env, cwd, stdout, logger, onStreamError, eventBroadcaster, eventDataCollector, configuration, supportCodeLibrary, pluginManager, }: {
@@ -34,7 +34,7 @@ async function initializeFormatters({ env, cwd, stdout, logger, onStreamError, e
34
34
  cleanupFns.push(async () => formatter.finished());
35
35
  }
36
36
  else {
37
- await pluginManager.initFormatter(implementation, configuration.options, logger, stream.write.bind(stream), directory);
37
+ await pluginManager.initFormatter(implementation, configuration.options, stream.write.bind(stream), directory);
38
38
  if (stream !== stdout) {
39
39
  cleanupFns.push((0, node_util_1.promisify)(stream.end.bind(stream)));
40
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;;AACA,yCAAqC;AAKrC,mEAAmD;AAEnD,8DAAyD;AACzD,gFAA2E;AAIpE,KAAK,UAAU,oBAAoB,CAAC,EACzC,GAAG,EACH,GAAG,EACH,MAAM,EACN,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,aAAa,GAad;IACC,MAAM,UAAU,GAA+B,EAAE,CAAA;IAEjD,KAAK,UAAU,mBAAmB,CAChC,MAAwB,EACxB,SAA6B,EAC7B,MAAc,EACd,SAAiB;QAEjB,IAAI,SAAS,KAAK,cAAc,IAAI,CAAE,MAAyB,CAAC,KAAK,EAAE;YACrE,MAAM,CAAC,IAAI,CACT,sDAAsD,MAAM,oDAAoD,CACjH,CAAA;YACD,SAAS,GAAG,UAAU,CAAA;SACvB;QACD,MAAM,cAAc,GAAG,MAAM,IAAA,8CAAqB,EAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QAClE,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE;YACxC,MAAM,WAAW,GAAG;gBAClB,GAAG;gBACH,GAAG;gBACH,gBAAgB;gBAChB,kBAAkB;gBAClB,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC9B,iBAAiB,EAAE,aAAa,CAAC,OAAO;gBACxC,MAAM;gBACN,OAAO,EACL,MAAM,KAAK,MAAM;oBACf,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE;oBACrC,CAAC,CAAC,IAAA,qBAAS,EAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC7C,kBAAkB;aACnB,CAAA;YACD,MAAM,SAAS,GAAG,MAAM,iBAAgB,CAAC,KAAK,CAC5C,cAAc,EACd,WAAW,CACZ,CAAA;YACD,UAAU,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAA;SAClD;aAAM;YACL,MAAM,aAAa,CAAC,aAAa,CAC/B,cAAc,EACd,aAAa,CAAC,OAAO,EACrB,MAAM,EACN,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EACzB,SAAS,CACV,CAAA;YACD,IAAI,MAAM,KAAK,MAAM,EAAE;gBACrB,UAAU,CAAC,IAAI,CAAC,IAAA,qBAAS,EAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;aACzD;SACF;IACH,CAAC;IAED,MAAM,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC5E,KAAK,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;QACrE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,4BAAY,EAC9C,MAAM,EACN,aAAa,EACb,GAAG,EACH,MAAM,CACP,CAAA;QACD,MAAM,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;KAChE;IAED,OAAO,KAAK;QACV,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAC/D,CAAC,CAAA;AACH,CAAC;AAvFD,oDAuFC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { promisify } from 'node:util'\nimport { WriteStream as TtyWriteStream } from 'node:tty'\nimport { IFormatterStream } from '../formatter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport FormatterBuilder from '../formatter/builder'\nimport { ILogger } from '../logger'\nimport { createStream } from '../formatter/create_stream'\nimport { resolveImplementation } from '../formatter/resolve_implementation'\nimport { PluginManager } from '../plugin'\nimport { IRunOptionsFormats } from './types'\n\nexport async function initializeFormatters({\n env,\n cwd,\n stdout,\n logger,\n onStreamError,\n eventBroadcaster,\n eventDataCollector,\n configuration,\n supportCodeLibrary,\n pluginManager,\n}: {\n env: NodeJS.ProcessEnv\n cwd: string\n stdout: IFormatterStream\n stderr: IFormatterStream\n logger: ILogger\n onStreamError: () => void\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n configuration: IRunOptionsFormats\n supportCodeLibrary: SupportCodeLibrary\n pluginManager: PluginManager\n}): Promise<() => Promise<void>> {\n const cleanupFns: Array<() => Promise<void>> = []\n\n async function initializeFormatter(\n stream: IFormatterStream,\n directory: string | undefined,\n target: string,\n specifier: string\n ): Promise<void> {\n if (specifier === 'progress-bar' && !(stream as TtyWriteStream).isTTY) {\n logger.warn(\n `Cannot use 'progress-bar' formatter for output to '${target}' as not a TTY. Switching to 'progress' formatter.`\n )\n specifier = 'progress'\n }\n const implementation = await resolveImplementation(specifier, cwd)\n if (typeof implementation === 'function') {\n const typeOptions = {\n env,\n cwd,\n eventBroadcaster,\n eventDataCollector,\n log: stream.write.bind(stream),\n parsedArgvOptions: configuration.options,\n stream,\n cleanup:\n stream === stdout\n ? async () => await Promise.resolve()\n : promisify<any>(stream.end.bind(stream)),\n supportCodeLibrary,\n }\n const formatter = await FormatterBuilder.build(\n implementation,\n typeOptions\n )\n cleanupFns.push(async () => formatter.finished())\n } else {\n await pluginManager.initFormatter(\n implementation,\n configuration.options,\n logger,\n stream.write.bind(stream),\n directory\n )\n if (stream !== stdout) {\n cleanupFns.push(promisify<any>(stream.end.bind(stream)))\n }\n }\n }\n\n await initializeFormatter(stdout, undefined, 'stdout', configuration.stdout)\n for (const [target, specifier] of Object.entries(configuration.files)) {\n const { stream, directory } = await createStream(\n target,\n onStreamError,\n cwd,\n logger\n )\n await initializeFormatter(stream, directory, target, specifier)\n }\n\n return async function () {\n await Promise.all(cleanupFns.map((cleanupFn) => cleanupFn()))\n }\n}\n"]}
1
+ {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;;AACA,yCAAqC;AAKrC,mEAAmD;AAEnD,8DAAyD;AACzD,gFAA2E;AAIpE,KAAK,UAAU,oBAAoB,CAAC,EACzC,GAAG,EACH,GAAG,EACH,MAAM,EACN,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,aAAa,GAad;IACC,MAAM,UAAU,GAA+B,EAAE,CAAA;IAEjD,KAAK,UAAU,mBAAmB,CAChC,MAAwB,EACxB,SAA6B,EAC7B,MAAc,EACd,SAAiB;QAEjB,IAAI,SAAS,KAAK,cAAc,IAAI,CAAE,MAAyB,CAAC,KAAK,EAAE;YACrE,MAAM,CAAC,IAAI,CACT,sDAAsD,MAAM,oDAAoD,CACjH,CAAA;YACD,SAAS,GAAG,UAAU,CAAA;SACvB;QACD,MAAM,cAAc,GAAG,MAAM,IAAA,8CAAqB,EAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QAClE,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE;YACxC,MAAM,WAAW,GAAG;gBAClB,GAAG;gBACH,GAAG;gBACH,gBAAgB;gBAChB,kBAAkB;gBAClB,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC9B,iBAAiB,EAAE,aAAa,CAAC,OAAO;gBACxC,MAAM;gBACN,OAAO,EACL,MAAM,KAAK,MAAM;oBACf,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE;oBACrC,CAAC,CAAC,IAAA,qBAAS,EAAM,M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WriteStream as TtyWriteStream } from 'node:tty'\nimport { IFormatterStream } from '../formatter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport FormatterBuilder from '../formatter/builder'\nimport { ILogger } from '../environment'\nimport { createStream } from '../formatter/create_stream'\nimport { resolveImplementation } from '../formatter/resolve_implementation'\nimport { PluginManager } from '../plugin'\nimport { IRunOptionsFormats } from './types'\n\nexport async function initializeFormatters({\n env,\n cwd,\n stdout,\n logger,\n onStreamError,\n eventBroadcaster,\n eventDataCollector,\n configuration,\n supportCodeLibrary,\n pluginManager,\n}: {\n env: NodeJS.ProcessEnv\n cwd: string\n stdout: IFormatterStream\n stderr: IFormatterStream\n logger: ILogger\n onStreamError: () => void\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n configuration: IRunOptionsFormats\n supportCodeLibrary: SupportCodeLibrary\n pluginManager: PluginManager\n}): Promise<() => Promise<void>> {\n const cleanupFns: Array<() => Promise<void>> = []\n\n async function initializeFormatter(\n stream: IFormatterStream,\n directory: string | undefined,\n target: string,\n specifier: string\n ): Promise<void> {\n if (specifier === 'progress-bar' && !(stream as TtyWriteStream).isTTY) {\n logger.warn(\n `Cannot use 'progress-bar' formatter for output to '${target}' as not a TTY. Switching to 'progress' formatter.`\n )\n specifier = 'progress'\n }\n const implementation = await resolveImplementation(specifier, cwd)\n if (typeof implementation === 'function') {\n const typeOptions = {\n env,\n cwd,\n eventBroadcaster,\n eventDataCollector,\n log: stream.write.bind(stream),\n parsedArgvOptions: configuration.options,\n stream,\n cleanup:\n stream === stdout\n ? async () => await Promise.resolve()\n : promisify<any>(stream.end.bind(stream)),\n supportCodeLibrary,\n }\n const formatter = await FormatterBuilder.build(\n implementation,\n typeOptions\n )\n cleanupFns.push(async () => formatter.finished())\n } else {\n await pluginManager.initFormatter(\n implementation,\n configuration.options,\n stream.write.bind(stream),\n directory\n )\n if (stream !== stdout) {\n cleanupFns.push(promisify<any>(stream.end.bind(stream)))\n }\n }\n }\n\n await initializeFormatter(stdout, undefined, 'stdout', configuration.stdout)\n for (const [target, specifier] of Object.entries(configuration.files)) {\n const { stream, directory } = await createStream(\n target,\n onStreamError,\n cwd,\n logger\n )\n await initializeFormatter(stream, directory, target, specifier)\n }\n\n return async function () {\n await Promise.all(cleanupFns.map((cleanupFn) => cleanupFn()))\n }\n}\n"]}
@@ -7,6 +7,7 @@
7
7
  * These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
8
8
  */
9
9
  export { IConfiguration } from '../configuration';
10
+ export { IRunEnvironment } from '../environment';
10
11
  export { IPickleOrder } from '../filter';
11
12
  export { IPublishConfig } from '../publish';
12
13
  export * from './load_configuration';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAKH,uDAAoC;AACpC,iDAA8B;AAC9B,iDAA8B;AAC9B,iDAA8B;AAC9B,0CAAuB","sourcesContent":["/**\n * JavaScript API for running and extending Cucumber\n *\n * @packageDocumentation\n * @module api\n * @remarks\n * These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.\n */\n\nexport { IConfiguration } from '../configuration'\nexport { IPickleOrder } from '../filter'\nexport { IPublishConfig } from '../publish'\nexport * from './load_configuration'\nexport * from './load_sources'\nexport * from './load_support'\nexport * from './run_cucumber'\nexport * from './types'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAMH,uDAAoC;AACpC,iDAA8B;AAC9B,iDAA8B;AAC9B,iDAA8B;AAC9B,0CAAuB","sourcesContent":["/**\n * JavaScript API for running and extending Cucumber\n *\n * @packageDocumentation\n * @module api\n * @remarks\n * These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.\n */\n\nexport { IConfiguration } from '../configuration'\nexport { IRunEnvironment } from '../environment'\nexport { IPickleOrder } from '../filter'\nexport { IPublishConfig } from '../publish'\nexport * from './load_configuration'\nexport * from './load_sources'\nexport * from './load_support'\nexport * from './run_cucumber'\nexport * from './types'\n"]}
@@ -1,4 +1,5 @@
1
- import { IRunEnvironment, IResolvedConfiguration, ILoadConfigurationOptions } from './types';
1
+ import { IRunEnvironment } from '../environment';
2
+ import { IResolvedConfiguration, ILoadConfigurationOptions } from './types';
2
3
  /**
3
4
  * Load user-authored configuration to be used in a test run
4
5
  *
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadConfiguration = void 0;
4
4
  const locate_file_1 = require("../configuration/locate_file");
5
5
  const configuration_1 = require("../configuration");
6
+ const environment_1 = require("../environment");
6
7
  const convert_configuration_1 = require("./convert_configuration");
7
- const environment_1 = require("./environment");
8
8
  /**
9
9
  * Load user-authored configuration to be used in a test run
10
10
  *
@@ -13,7 +13,7 @@ const environment_1 = require("./environment");
13
13
  * @param environment - Project environment
14
14
  */
15
15
  async function loadConfiguration(options = {}, environment = {}) {
16
- const { cwd, env, logger } = (0, environment_1.mergeEnvironment)(environment);
16
+ const { cwd, env, logger } = (0, environment_1.makeEnvironment)(environment);
17
17
  const configFile = options.file ?? (0, locate_file_1.locateFile)(cwd);
18
18
  if (configFile) {
19
19
  logger.debug(`Configuration will be loaded from "${configFile}"`);
@@ -1 +1 @@
1
- {"version":3,"file":"load_configuration.js","sourceRoot":"","sources":["../../src/api/load_configuration.ts"],"names":[],"mappings":";;;AAAA,8DAAyD;AACzD,oDAMyB;AACzB,mEAA8D;AAC9D,+CAAgD;AAOhD;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,UAAqC,EAAE,EACvC,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,IAAA,wBAAU,EAAC,GAAG,CAAC,CAAA;IAClD,IAAI,UAAU,EAAE;QACd,MAAM,CAAC,KAAK,CAAC,sCAAsC,UAAU,GAAG,CAAC,CAAA;KAClE;SAAM,IAAI,UAAU,KAAK,KAAK,EAAE;QAC/B,MAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAA;KACvD;SAAM;QACL,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;KAC5C;IACD,MAAM,oBAAoB,GAAG,UAAU;QACrC,CAAC,CAAC,MAAM,IAAA,wBAAQ,EAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC;QAC3D,CAAC,CAAC,EAAE,CAAA;IACN,MAAM,QAAQ,GAAG,IAAA,mCAAmB,EAClC,qCAAqB,EACrB,oBAAoB,EACpB,IAAA,kCAAkB,EAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CACzD,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAA;IACjD,IAAA,qCAAqB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IACvC,MAAM,QAAQ,GAAG,MAAM,IAAA,4CAAoB,EAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;IAClE,OAAO;QACL,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;KAC3B,CAAA;AACH,CAAC;AA5BD,8CA4BC","sourcesContent":["import { locateFile } from '../configuration/locate_file'\nimport {\n DEFAULT_CONFIGURATION,\n fromFile,\n mergeConfigurations,\n parseConfiguration,\n validateConfiguration,\n} from '../configuration'\nimport { convertConfiguration } from './convert_configuration'\nimport { mergeEnvironment } from './environment'\nimport {\n IRunEnvironment,\n IResolvedConfiguration,\n ILoadConfigurationOptions,\n} from './types'\n\n/**\n * Load user-authored configuration to be used in a test run\n *\n * @public\n * @param options - Coordinates required to find configuration\n * @param environment - Project environment\n */\nexport async function loadConfiguration(\n options: ILoadConfigurationOptions = {},\n environment: IRunEnvironment = {}\n): Promise<IResolvedConfiguration> {\n const { cwd, env, logger } = mergeEnvironment(environment)\n const configFile = options.file ?? locateFile(cwd)\n if (configFile) {\n logger.debug(`Configuration will be loaded from \"${configFile}\"`)\n } else if (configFile === false) {\n logger.debug('Skipping configuration file resolution')\n } else {\n logger.debug('No configuration file found')\n }\n const profileConfiguration = configFile\n ? await fromFile(logger, cwd, configFile, options.profiles)\n : {}\n const original = mergeConfigurations(\n DEFAULT_CONFIGURATION,\n profileConfiguration,\n parseConfiguration(logger, 'Provided', options.provided)\n )\n logger.debug('Resolved configuration:', original)\n validateConfiguration(original, logger)\n const runnable = await convertConfiguration(logger, original, env)\n return {\n useConfiguration: original,\n runConfiguration: runnable,\n }\n}\n"]}
1
+ {"version":3,"file":"load_configuration.js","sourceRoot":"","sources":["../../src/api/load_configuration.ts"],"names":[],"mappings":";;;AAAA,8DAAyD;AACzD,oDAMyB;AACzB,gDAAiE;AACjE,mEAA8D;AAG9D;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,UAAqC,EAAE,EACvC,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,6BAAe,EAAC,WAAW,CAAC,CAAA;IACzD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,IAAA,wBAAU,EAAC,GAAG,CAAC,CAAA;IAClD,IAAI,UAAU,EAAE;QACd,MAAM,CAAC,KAAK,CAAC,sCAAsC,UAAU,GAAG,CAAC,CAAA;KAClE;SAAM,IAAI,UAAU,KAAK,KAAK,EAAE;QAC/B,MAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAA;KACvD;SAAM;QACL,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;KAC5C;IACD,MAAM,oBAAoB,GAAG,UAAU;QACrC,CAAC,CAAC,MAAM,IAAA,wBAAQ,EAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC;QAC3D,CAAC,CAAC,EAAE,CAAA;IACN,MAAM,QAAQ,GAAG,IAAA,mCAAmB,EAClC,qCAAqB,EACrB,oBAAoB,EACpB,IAAA,kCAAkB,EAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CACzD,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAA;IACjD,IAAA,qCAAqB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IACvC,MAAM,QAAQ,GAAG,MAAM,IAAA,4CAAoB,EAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;IAClE,OAAO;QACL,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;KAC3B,CAAA;AACH,CAAC;AA5BD,8CA4BC","sourcesContent":["import { locateFile } from '../configuration/locate_file'\nimport {\n DEFAULT_CONFIGURATION,\n fromFile,\n mergeConfigurations,\n parseConfiguration,\n validateConfiguration,\n} from '../configuration'\nimport { IRunEnvironment, makeEnvironment } from '../environment'\nimport { convertConfiguration } from './convert_configuration'\nimport { IResolvedConfiguration, ILoadConfigurationOptions } from './types'\n\n/**\n * Load user-authored configuration to be used in a test run\n *\n * @public\n * @param options - Coordinates required to find configuration\n * @param environment - Project environment\n */\nexport async function loadConfiguration(\n options: ILoadConfigurationOptions = {},\n environment: IRunEnvironment = {}\n): Promise<IResolvedConfiguration> {\n const { cwd, env, logger } = makeEnvironment(environment)\n const configFile = options.file ?? locateFile(cwd)\n if (configFile) {\n logger.debug(`Configuration will be loaded from \"${configFile}\"`)\n } else if (configFile === false) {\n logger.debug('Skipping configuration file resolution')\n } else {\n logger.debug('No configuration file found')\n }\n const profileConfiguration = configFile\n ? await fromFile(logger, cwd, configFile, options.profiles)\n : {}\n const original = mergeConfigurations(\n DEFAULT_CONFIGURATION,\n profileConfiguration,\n parseConfiguration(logger, 'Provided', options.provided)\n )\n logger.debug('Resolved configuration:', original)\n validateConfiguration(original, logger)\n const runnable = await convertConfiguration(logger, original, env)\n return {\n useConfiguration: original,\n runConfiguration: runnable,\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
- import { ILoadSourcesResult, IRunEnvironment, ISourcesCoordinates } from './types';
1
+ import { IRunEnvironment } from '../environment';
2
+ import { ILoadSourcesResult, ISourcesCoordinates } from './types';
2
3
  /**
3
4
  * Load and parse features, produce a filtered and ordered test plan and/or
4
5
  * parse errors
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadSources = void 0;
4
4
  const messages_1 = require("@cucumber/messages");
5
5
  const paths_1 = require("../paths");
6
- const environment_1 = require("./environment");
6
+ const environment_1 = require("../environment");
7
7
  const gherkin_1 = require("./gherkin");
8
8
  const plugins_1 = require("./plugins");
9
9
  /**
@@ -15,10 +15,10 @@ const plugins_1 = require("./plugins");
15
15
  * @param environment - Project environment
16
16
  */
17
17
  async function loadSources(coordinates, environment = {}) {
18
- const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
18
+ const mergedEnvironment = (0, environment_1.makeEnvironment)(environment);
19
19
  const { cwd, logger } = mergedEnvironment;
20
20
  const newId = messages_1.IdGenerator.uuid();
21
- const pluginManager = await (0, plugins_1.initializeForLoadSources)(logger, coordinates, mergedEnvironment);
21
+ const pluginManager = await (0, plugins_1.initializeForLoadSources)(coordinates, mergedEnvironment);
22
22
  const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, coordinates);
23
23
  pluginManager.emit('paths:resolve', resolvedPaths);
24
24
  const { sourcePaths } = resolvedPaths;
@@ -1 +1 @@
1
- {"version":3,"file":"load_sources.js","sourceRoot":"","sources":["../../src/api/load_sources.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAChD,oCAAuC;AAQvC,+CAAgD;AAChD,uCAA+C;AAC/C,uCAAoD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B,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ;KACT,CAAC,CAAC,CAAA;IACH,MAAM,MAAM,GAAoB,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;QACtE,OAAO;YACL,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO;SACR,CAAA;IACH,CAAC,CAAC,CAAA;IACF,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,OAAO;QACL,IAAI;QACJ,MAAM;KACP,CAAA;AACH,CAAC;AArDD,kCAqDC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { resolvePaths } from '../paths'\nimport {\n ILoadSourcesResult,\n IPlannedPickle,\n IRunEnvironment,\n ISourcesCoordinates,\n ISourcesError,\n} from './types'\nimport { mergeEnvironment } from './environment'\nimport { getPicklesAndErrors } from './gherkin'\nimport { initializeForLoadSources } from './plugins'\n\n/**\n * Load and parse features, produce a filtered and ordered test plan and/or\n * parse errors\n *\n * @public\n * @param coordinates - Coordinates required to find and process features\n * @param environment - Project environment\n */\nexport async function loadSources(\n coordinates: ISourcesCoordinates,\n environment: IRunEnvironment = {}\n): Promise<ILoadSourcesResult> {\n const mergedEnvironment = mergeEnvironment(environment)\n const { cwd, logger } = mergedEnvironment\n const newId = IdGenerator.uuid()\n const pluginManager = await initializeForLoadSources(\n logger,\n coordinates,\n mergedEnvironment\n )\n const resolvedPaths = await resolvePaths(logger, cwd, coordinates)\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { sourcePaths } = resolvedPaths\n if (sourcePaths.length === 0) {\n return {\n plan: [],\n errors: [],\n }\n }\n const { filterablePickles, parseErrors } = await getPicklesAndErrors({\n newId,\n cwd,\n sourcePaths,\n coordinates,\n onEnvelope: (envelope) => pluginManager.emit('message', envelope),\n })\n const filteredPickles = await pluginManager.transform(\n 'pickles:filter',\n filterablePickles\n )\n const orderedPickles = await pluginManager.transform(\n 'pickles:order',\n filteredPickles\n )\n const plan: IPlannedPickle[] = orderedPickles.map(({ location, pickle }) => ({\n name: pickle.name,\n uri: pickle.uri,\n location,\n }))\n const errors: ISourcesError[] = parseErrors.map(({ source, message }) => {\n return {\n uri: source.uri,\n location: source.location,\n message,\n }\n })\n await pluginManager.cleanup()\n return {\n plan,\n errors,\n }\n}\n"]}
1
+ {"version":3,"file":"load_sources.js","sourceRoot":"","sources":["../../src/api/load_sources.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAChD,oCAAuC;AACvC,gDAAiE;AAOjE,uCAA+C;AAC/C,uCAAoD;AAEpD;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAC/B,WAAgC,EAChC,cAA+B,EAAE;IAEjC,MAAM,iBAAiB,GAAG,IAAA,6BAAe,EAAC,WAAW,CAAC,CAAA;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;IACzC,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,aAAa,GAAG,MAAM,IAAA,kCAAwB,EAClD,WAAW,EACX,iBAAiB,CAClB,CAAA;IACD,MAAM,aAAa,GAAG,MAAM,IAAA,oBAAY,EAAC,MAAM,EAAE,GAAG,EAAE,WAAW,CAAC,CAAA;IAClE,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;IAClD,MAAM,EAAE,WAAW,EAAE,GAAG,aAAa,CAAA;IACrC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,OAAO;YACL,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;SACX,CAAA;KACF;IACD,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,6BAAmB,EAAC;QACnE,KAAK;QACL,GAAG;QACH,WAAW;QACX,WAAW;QACX,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;KAClE,CAAC,CAAA;IACF,MAAM,eAAe,GAAG,MAAM,aAAa,CAAC,SAAS,CACnD,gBAAgB,EAChB,iBAAiB,CAClB,CAAA;IACD,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,SAAS,CAClD,eAAe,EACf,eAAe,CAChB,CAAA;IACD,MAAM,IAAI,GAAqB,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QAC3E,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ;KACT,CAAC,CAAC,CAAA;IACH,MAAM,MAAM,GAAoB,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;QACtE,OAAO;YACL,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO;SACR,CAAA;IACH,CAAC,CAAC,CAAA;IACF,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,OAAO;QACL,IAAI;QACJ,MAAM;KACP,CAAA;AACH,CAAC;AApDD,kCAoDC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { resolvePaths } from '../paths'\nimport { IRunEnvironment, makeEnvironment } from '../environment'\nimport {\n ILoadSourcesResult,\n IPlannedPickle,\n ISourcesCoordinates,\n ISourcesError,\n} from './types'\nimport { getPicklesAndErrors } from './gherkin'\nimport { initializeForLoadSources } from './plugins'\n\n/**\n * Load and parse features, produce a filtered and ordered test plan and/or\n * parse errors\n *\n * @public\n * @param coordinates - Coordinates required to find and process features\n * @param environment - Project environment\n */\nexport async function loadSources(\n coordinates: ISourcesCoordinates,\n environment: IRunEnvironment = {}\n): Promise<ILoadSourcesResult> {\n const mergedEnvironment = makeEnvironment(environment)\n const { cwd, logger } = mergedEnvironment\n const newId = IdGenerator.uuid()\n const pluginManager = await initializeForLoadSources(\n coordinates,\n mergedEnvironment\n )\n const resolvedPaths = await resolvePaths(logger, cwd, coordinates)\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { sourcePaths } = resolvedPaths\n if (sourcePaths.length === 0) {\n return {\n plan: [],\n errors: [],\n }\n }\n const { filterablePickles, parseErrors } = await getPicklesAndErrors({\n newId,\n cwd,\n sourcePaths,\n coordinates,\n onEnvelope: (envelope) => pluginManager.emit('message', envelope),\n })\n const filteredPickles = await pluginManager.transform(\n 'pickles:filter',\n filterablePickles\n )\n const orderedPickles = await pluginManager.transform(\n 'pickles:order',\n filteredPickles\n )\n const plan: IPlannedPickle[] = orderedPickles.map(({ location, pickle }) => ({\n name: pickle.name,\n uri: pickle.uri,\n location,\n }))\n const errors: ISourcesError[] = parseErrors.map(({ source, message }) => {\n return {\n uri: source.uri,\n location: source.location,\n message,\n }\n })\n await pluginManager.cleanup()\n return {\n plan,\n errors,\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
- import { ILoadSupportOptions, IRunEnvironment, ISupportCodeLibrary } from './types';
1
+ import { IRunEnvironment } from '../environment';
2
+ import { ILoadSupportOptions, ISupportCodeLibrary } from './types';
2
3
  /**
3
4
  * Load support code for use in test runs
4
5
  *
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadSupport = void 0;
4
4
  const messages_1 = require("@cucumber/messages");
5
5
  const paths_1 = require("../paths");
6
+ const environment_1 = require("../environment");
6
7
  const support_1 = require("./support");
7
- const environment_1 = require("./environment");
8
8
  const plugins_1 = require("./plugins");
9
9
  /**
10
10
  * Load support code for use in test runs
@@ -14,7 +14,7 @@ const plugins_1 = require("./plugins");
14
14
  * @param environment - Project environment
15
15
  */
16
16
  async function loadSupport(options, environment = {}) {
17
- const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
17
+ const mergedEnvironment = (0, environment_1.makeEnvironment)(environment);
18
18
  const { cwd, logger } = mergedEnvironment;
19
19
  const newId = messages_1.IdGenerator.uuid();
20
20
  const supportCoordinates = Object.assign({
@@ -23,7 +23,7 @@ async function loadSupport(options, environment = {}) {
23
23
  loaders: [],
24
24
  importPaths: [],
25
25
  }, options.support);
26
- const pluginManager = await (0, plugins_1.initializeForLoadSupport)();
26
+ const pluginManager = await (0, plugins_1.initializeForLoadSupport)(mergedEnvironment);
27
27
  const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources, supportCoordinates);
28
28
  pluginManager.emit('paths:resolve', resolvedPaths);
29
29
  const { requirePaths, importPaths } = resolvedPaths;
@@ -1 +1 @@
1
- {"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAChD,oCAAuC;AAMvC,uCAAiD;AACjD,+CAAgD;AAChD,uCAAoD;AAEpD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,iBAAiB,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;IACzC,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CACtC;QACE,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,EAAE;QAChB,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE;KAChB,EACD,OAAO,CAAC,OAAO,CAChB,CAAA;IACD,MAAM,aAAa,GAAG,MAAM,IAAA,kCAAwB,GAAE,CAAA;IACtD,MAAM,aAAa,GAAG,MAAM,IAAA,oBAAY,EACtC,MAAM,EACN,GAAG,EACH,OAAO,CAAC,OAAO,EACf,kBAAkB,CACnB,CAAA;IACD,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;IAClD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,aAAa,CAAA;IACnD,MAAM,kBAAkB,GAAG,MAAM,IAAA,+BAAqB,EAAC;QACrD,MAAM;QACN,GAAG;QACH,KAAK;QACL,cAAc,EAAE,kBAAkB,CAAC,cAAc;QACjD,YAAY;QACZ,OAAO,EAAE,kBAAkB,CAAC,OAAO;QACnC,WAAW;KACZ,CAAC,CAAA;IACF,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AApCD,kCAoCC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { resolvePaths } from '../paths'\nimport {\n ILoadSupportOptions,\n IRunEnvironment,\n ISupportCodeLibrary,\n} from './types'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { initializeForLoadSupport } from './plugins'\n\n/**\n * Load support code for use in test runs\n *\n * @public\n * @param options - Options required to find the support code\n * @param environment - Project environment\n */\nexport async function loadSupport(\n options: ILoadSupportOptions,\n environment: IRunEnvironment = {}\n): Promise<ISupportCodeLibrary> {\n const mergedEnvironment = mergeEnvironment(environment)\n const { cwd, logger } = mergedEnvironment\n const newId = IdGenerator.uuid()\n const supportCoordinates = Object.assign(\n {\n requireModules: [],\n requirePaths: [],\n loaders: [],\n importPaths: [],\n },\n options.support\n )\n const pluginManager = await initializeForLoadSupport()\n const resolvedPaths = await resolvePaths(\n logger,\n cwd,\n options.sources,\n supportCoordinates\n )\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { requirePaths, importPaths } = resolvedPaths\n const supportCodeLibrary = await getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requireModules: supportCoordinates.requireModules,\n requirePaths,\n loaders: supportCoordinates.loaders,\n importPaths,\n })\n await pluginManager.cleanup()\n return supportCodeLibrary\n}\n"]}
1
+ {"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAChD,oCAAuC;AACvC,gDAAiE;AAEjE,uCAAiD;AACjD,uCAAoD;AAEpD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,iBAAiB,GAAG,IAAA,6BAAe,EAAC,WAAW,CAAC,CAAA;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;IACzC,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CACtC;QACE,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,EAAE;QAChB,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE;KAChB,EACD,OAAO,CAAC,OAAO,CAChB,CAAA;IACD,MAAM,aAAa,GAAG,MAAM,IAAA,kCAAwB,EAAC,iBAAiB,CAAC,CAAA;IACvE,MAAM,aAAa,GAAG,MAAM,IAAA,oBAAY,EACtC,MAAM,EACN,GAAG,EACH,OAAO,CAAC,OAAO,EACf,kBAAkB,CACnB,CAAA;IACD,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;IAClD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,aAAa,CAAA;IACnD,MAAM,kBAAkB,GAAG,MAAM,IAAA,+BAAqB,EAAC;QACrD,MAAM;QACN,GAAG;QACH,KAAK;QACL,cAAc,EAAE,kBAAkB,CAAC,cAAc;QACjD,YAAY;QACZ,OAAO,EAAE,kBAAkB,CAAC,OAAO;QACnC,WAAW;KACZ,CAAC,CAAA;IACF,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AApCD,kCAoCC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { resolvePaths } from '../paths'\nimport { IRunEnvironment, makeEnvironment } from '../environment'\nimport { ILoadSupportOptions, ISupportCodeLibrary } from './types'\nimport { getSupportCodeLibrary } from './support'\nimport { initializeForLoadSupport } from './plugins'\n\n/**\n * Load support code for use in test runs\n *\n * @public\n * @param options - Options required to find the support code\n * @param environment - Project environment\n */\nexport async function loadSupport(\n options: ILoadSupportOptions,\n environment: IRunEnvironment = {}\n): Promise<ISupportCodeLibrary> {\n const mergedEnvironment = makeEnvironment(environment)\n const { cwd, logger } = mergedEnvironment\n const newId = IdGenerator.uuid()\n const supportCoordinates = Object.assign(\n {\n requireModules: [],\n requirePaths: [],\n loaders: [],\n importPaths: [],\n },\n options.support\n )\n const pluginManager = await initializeForLoadSupport(mergedEnvironment)\n const resolvedPaths = await resolvePaths(\n logger,\n cwd,\n options.sources,\n supportCoordinates\n )\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { requirePaths, importPaths } = resolvedPaths\n const supportCodeLibrary = await getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requireModules: supportCoordinates.requireModules,\n requirePaths,\n loaders: supportCoordinates.loaders,\n importPaths,\n })\n await pluginManager.cleanup()\n return supportCodeLibrary\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { PluginManager } from '../plugin';
2
- import { ILogger } from '../logger';
3
- import { IRunConfiguration, IRunEnvironment, ISourcesCoordinates } from './types';
4
- export declare function initializeForLoadSources(logger: ILogger, coordinates: ISourcesCoordinates, environment: Required<IRunEnvironment>): Promise<PluginManager>;
5
- export declare function initializeForLoadSupport(): Promise<PluginManager>;
6
- export declare function initializeForRunCucumber(logger: ILogger, configuration: IRunConfiguration, environment: Required<IRunEnvironment>): Promise<PluginManager>;
2
+ import { UsableEnvironment } from '../environment';
3
+ import { IRunConfiguration, ISourcesCoordinates } from './types';
4
+ export declare function initializeForLoadSources(coordinates: ISourcesCoordinates, environment: UsableEnvironment): Promise<PluginManager>;
5
+ export declare function initializeForLoadSupport(environment: UsableEnvironment): Promise<PluginManager>;
6
+ export declare function initializeForRunCucumber(configuration: IRunConfiguration, environment: UsableEnvironment): Promise<PluginManager>;
@@ -7,23 +7,23 @@ exports.initializeForRunCucumber = exports.initializeForLoadSupport = exports.in
7
7
  const plugin_1 = require("../plugin");
8
8
  const publish_1 = __importDefault(require("../publish"));
9
9
  const filter_1 = __importDefault(require("../filter"));
10
- async function initializeForLoadSources(logger, coordinates, environment) {
10
+ async function initializeForLoadSources(coordinates, environment) {
11
11
  // eventually we'll load plugin packages here
12
- const pluginManager = new plugin_1.PluginManager();
13
- await pluginManager.initCoordinator('loadSources', filter_1.default, coordinates, logger, environment);
12
+ const pluginManager = new plugin_1.PluginManager(environment);
13
+ await pluginManager.initCoordinator('loadSources', filter_1.default, coordinates);
14
14
  return pluginManager;
15
15
  }
16
16
  exports.initializeForLoadSources = initializeForLoadSources;
17
- async function initializeForLoadSupport() {
17
+ async function initializeForLoadSupport(environment) {
18
18
  // eventually we'll load plugin packages here
19
- return new plugin_1.PluginManager();
19
+ return new plugin_1.PluginManager(environment);
20
20
  }
21
21
  exports.initializeForLoadSupport = initializeForLoadSupport;
22
- async function initializeForRunCucumber(logger, configuration, environment) {
22
+ async function initializeForRunCucumber(configuration, environment) {
23
23
  // eventually we'll load plugin packages here
24
- const pluginManager = new plugin_1.PluginManager();
25
- await pluginManager.initCoordinator('runCucumber', publish_1.default, configuration.formats.publish, logger, environment);
26
- await pluginManager.initCoordinator('runCucumber', filter_1.default, configuration.sources, logger, environment);
24
+ const pluginManager = new plugin_1.PluginManager(environment);
25
+ await pluginManager.initCoordinator('runCucumber', publish_1.default, configuration.formats.publish);
26
+ await pluginManager.initCoordinator('runCucumber', filter_1.default, configuration.sources);
27
27
  return pluginManager;
28
28
  }
29
29
  exports.initializeForRunCucumber = initializeForRunCucumber;
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;;AAAA,sCAAyC;AACzC,yDAAsC;AAEtC,uDAAoC;AAO7B,KAAK,UAAU,wBAAwB,CAC5C,MAAe,EACf,WAAgC,EAChC,WAAsC;IAEtC,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,EAAE,CAAA;IACzC,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,gBAAY,EACZ,WAAW,EACX,MAAM,EACN,WAAW,CACZ,CAAA;IACD,OAAO,aAAa,CAAA;AACtB,CAAC;AAfD,4DAeC;AAEM,KAAK,UAAU,wBAAwB;IAC5C,6CAA6C;IAC7C,OAAO,IAAI,sBAAa,EAAE,CAAA;AAC5B,CAAC;AAHD,4DAGC;AAEM,KAAK,UAAU,wBAAwB,CAC5C,MAAe,EACf,aAAgC,EAChC,WAAsC;IAEtC,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,EAAE,CAAA;IACzC,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,iBAAa,EACb,aAAa,CAAC,OAAO,CAAC,OAAO,EAC7B,MAAM,EACN,WAAW,CACZ,CAAA;IACD,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,gBAAY,EACZ,aAAa,CAAC,OAAO,EACrB,MAAM,EACN,WAAW,CACZ,CAAA;IACD,OAAO,aAAa,CAAA;AACtB,CAAC;AAtBD,4DAsBC","sourcesContent":["import { PluginManager } from '../plugin'\nimport publishPlugin from '../publish'\nimport { ILogger } from '../logger'\nimport filterPlugin from '../filter'\nimport {\n IRunConfiguration,\n IRunEnvironment,\n ISourcesCoordinates,\n} from './types'\n\nexport async function initializeForLoadSources(\n logger: ILogger,\n coordinates: ISourcesCoordinates,\n environment: Required<IRunEnvironment>\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager()\n await pluginManager.initCoordinator(\n 'loadSources',\n filterPlugin,\n coordinates,\n logger,\n environment\n )\n return pluginManager\n}\n\nexport async function initializeForLoadSupport(): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n return new PluginManager()\n}\n\nexport async function initializeForRunCucumber(\n logger: ILogger,\n configuration: IRunConfiguration,\n environment: Required<IRunEnvironment>\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager()\n await pluginManager.initCoordinator(\n 'runCucumber',\n publishPlugin,\n configuration.formats.publish,\n logger,\n environment\n )\n await pluginManager.initCoordinator(\n 'runCucumber',\n filterPlugin,\n configuration.sources,\n logger,\n environment\n )\n return pluginManager\n}\n"]}
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;;AAAA,sCAAyC;AACzC,yDAAsC;AACtC,uDAAoC;AAI7B,KAAK,UAAU,wBAAwB,CAC5C,WAAgC,EAChC,WAA8B;IAE9B,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,CAAC,WAAW,CAAC,CAAA;IACpD,MAAM,aAAa,CAAC,eAAe,CAAC,aAAa,EAAE,gBAAY,EAAE,WAAW,CAAC,CAAA;IAC7E,OAAO,aAAa,CAAA;AACtB,CAAC;AARD,4DAQC;AAEM,KAAK,UAAU,wBAAwB,CAC5C,WAA8B;IAE9B,6CAA6C;IAC7C,OAAO,IAAI,sBAAa,CAAC,WAAW,CAAC,CAAA;AACvC,CAAC;AALD,4DAKC;AAEM,KAAK,UAAU,wBAAwB,CAC5C,aAAgC,EAChC,WAA8B;IAE9B,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,CAAC,WAAW,CAAC,CAAA;IACpD,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,iBAAa,EACb,aAAa,CAAC,OAAO,CAAC,OAAO,CAC9B,CAAA;IACD,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,gBAAY,EACZ,aAAa,CAAC,OAAO,CACtB,CAAA;IACD,OAAO,aAAa,CAAA;AACtB,CAAC;AAjBD,4DAiBC","sourcesContent":["import { PluginManager } from '../plugin'\nimport publishPlugin from '../publish'\nimport filterPlugin from '../filter'\nimport { UsableEnvironment } from '../environment'\nimport { IRunConfiguration, ISourcesCoordinates } from './types'\n\nexport async function initializeForLoadSources(\n coordinates: ISourcesCoordinates,\n environment: UsableEnvironment\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager(environment)\n await pluginManager.initCoordinator('loadSources', filterPlugin, coordinates)\n return pluginManager\n}\n\nexport async function initializeForLoadSupport(\n environment: UsableEnvironment\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n return new PluginManager(environment)\n}\n\nexport async function initializeForRunCucumber(\n configuration: IRunConfiguration,\n environment: UsableEnvironment\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager(environment)\n await pluginManager.initCoordinator(\n 'runCucumber',\n publishPlugin,\n configuration.formats.publish\n )\n await pluginManager.initCoordinator(\n 'runCucumber',\n filterPlugin,\n configuration.sources\n )\n return pluginManager\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { Envelope } from '@cucumber/messages';
2
- import { IRunOptions, IRunEnvironment, IRunResult } from './types';
2
+ import { IRunEnvironment } from '../environment';
3
+ import { IRunOptions, IRunResult } from './types';
3
4
  /**
4
5
  * Execute a Cucumber test run and return the overall result
5
6
  *
@@ -8,9 +8,9 @@ const helpers_2 = require("../cli/helpers");
8
8
  const paths_1 = require("../paths");
9
9
  const version_1 = require("../version");
10
10
  const runtime_1 = require("../runtime");
11
+ const environment_1 = require("../environment");
11
12
  const formatters_1 = require("./formatters");
12
13
  const support_1 = require("./support");
13
- const environment_1 = require("./environment");
14
14
  const gherkin_1 = require("./gherkin");
15
15
  const plugins_1 = require("./plugins");
16
16
  /**
@@ -22,7 +22,7 @@ const plugins_1 = require("./plugins");
22
22
  * @param onMessage - Callback fired each time Cucumber emits a message
23
23
  */
24
24
  async function runCucumber(options, environment = {}, onMessage) {
25
- const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
25
+ const mergedEnvironment = (0, environment_1.makeEnvironment)(environment);
26
26
  const { cwd, stdout, stderr, env, logger } = mergedEnvironment;
27
27
  logger.debug(`Running cucumber-js ${version_1.version}
28
28
  Working directory: ${cwd}
@@ -37,7 +37,7 @@ Running from: ${__dirname}
37
37
  loaders: [],
38
38
  importPaths: [],
39
39
  }, options.support);
40
- const pluginManager = await (0, plugins_1.initializeForRunCucumber)(logger, {
40
+ const pluginManager = await (0, plugins_1.initializeForRunCucumber)({
41
41
  ...options,
42
42
  support: supportCoordinates,
43
43
  }, mergedEnvironment);
@@ -1 +1 @@
1
- {"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,iDAAsE;AACtE,kDAAyD;AACzD,4CAAyE;AACzE,oCAAuC;AAEvC,wCAAoC;AAEpC,wCAAwC;AAExC,6CAAmD;AACnD,uCAAiD;AACjD,+CAAgD;AAChD,uCAA+C;AAC/C,uCAAoD;AAEpD;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,cAA+B,EAAE,EACjC,SAAuC;IAEvC,MAAM,iBAAiB,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;IAE9D,MAAM,CAAC,KAAK,CAAC,uBAAuB,iBAAO;qBACxB,GAAG;gBACR,SAAS;CACxB,CAAC,CAAA;IAEA,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAEhC,MAAM,kBAAkB,GACtB,qBAAqB,IAAI,OAAO,CAAC,OAAO;QACtC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB;QACrC,CAAC,CAAC,MAAM,CAAC,MAAM,CACX;YACE,cAAc,EAAE,EAAE;YAClB,YAAY,EAAE,EAAE;YAChB,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,EAAE;SAChB,EACD,OAAO,CAAC,OAAO,CAChB,CAAA;IAEP,MAAM,aAAa,GAAG,MAAM,IAAA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AChC,WAAW;QACX,MAAM;QACN,gBAAgB;QAChB,cAAc,EAAE,eAAe;QAC/B,KAAK;QACL,kBAAkB;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,CAAA;IACnC,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,MAAM,iBAAiB,EAAE,CAAA;IAEzB,OAAO;QACL,OAAO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC5B,CAAA;AACH,CAAC;AA7ID,kCA6IC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Envelope, IdGenerator, ParseError } from '@cucumber/messages'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { emitMetaMessage, emitSupportCodeMessages } from '../cli/helpers'\nimport { resolvePaths } from '../paths'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { version } from '../version'\nimport { IFilterablePickle } from '../filter'\nimport { makeRuntime } from '../runtime'\nimport { IRunOptions, IRunEnvironment, IRunResult } from './types'\nimport { initializeFormatters } from './formatters'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { getPicklesAndErrors } from './gherkin'\nimport { initializeForRunCucumber } from './plugins'\n\n/**\n * Execute a Cucumber test run and return the overall result\n *\n * @public\n * @param options - Options for the run, obtainable via {@link loadConfiguration}\n * @param environment - Project environment\n * @param onMessage - Callback fired each time Cucumber emits a message\n */\nexport async function runCucumber(\n options: IRunOptions,\n environment: IRunEnvironment = {},\n onMessage?: (message: Envelope) => void\n): Promise<IRunResult> {\n const mergedEnvironment = mergeEnvironment(environment)\n const { cwd, stdout, stderr, env, logger } = mergedEnvironment\n\n logger.debug(`Running cucumber-js ${version} \nWorking directory: ${cwd}\nRunning from: ${__dirname} \n`)\n\n const newId = IdGenerator.uuid()\n\n const supportCoordinates =\n 'originalCoordinates' in options.support\n ? options.support.originalCoordinates\n : Object.assign(\n {\n requireModules: [],\n requirePaths: [],\n loaders: [],\n importPaths: [],\n },\n options.support\n )\n\n const pluginManager = await initializeForRunCucumber(\n logger,\n {\n ...options,\n support: supportCoordinates,\n },\n mergedEnvironment\n )\n\n const resolvedPaths = await resolvePaths(\n logger,\n cwd,\n options.sources,\n supportCoordinates\n )\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { sourcePaths, requirePaths, importPaths } = resolvedPaths\n\n const supportCodeLibrary =\n 'originalCoordinates' in options.support\n ? (options.support as SupportCodeLibrary)\n : await getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requirePaths,\n requireModules: supportCoordinates.requireModules,\n importPaths,\n loaders: supportCoordinates.loaders,\n })\n\n const eventBroadcaster = new EventEmitter()\n if (onMessage) {\n eventBroadcaster.on('envelope', onMessage)\n }\n eventBroadcaster.on('envelope', (value) =>\n pluginManager.emit('message', value)\n )\n const eventDataCollector = new EventDataCollector(eventBroadcaster)\n\n let formatterStreamError = false\n const cleanupFormatters = await initializeFormatters({\n env,\n cwd,\n stdout,\n stderr,\n logger,\n onStreamError: () => (formatterStreamError = true),\n eventBroadcaster,\n eventDataCollector,\n configuration: options.formats,\n supportCodeLibrary,\n pluginManager,\n })\n await emitMetaMessage(eventBroadcaster, env)\n\n let filteredPickles: ReadonlyArray<IFilterablePickle> = []\n let parseErrors: ParseError[] = []\n if (sourcePaths.length > 0) {\n const gherkinResult = await getPicklesAndErrors({\n newId,\n cwd,\n sourcePaths,\n coordinates: options.sources,\n onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),\n })\n filteredPickles = await pluginManager.transform(\n 'pickles:filter',\n gherkinResult.filterablePickles\n )\n filteredPickles = await pluginManager.transform(\n 'pickles:order',\n filteredPickles\n )\n parseErrors = gherkinResult.parseErrors\n }\n if (parseErrors.length) {\n parseErrors.forEach((parseError) => {\n logger.error(\n `Parse error in \"${parseError.source.uri}\" ${parseError.message}`\n )\n })\n await cleanupFormatters()\n await pluginManager.cleanup()\n return {\n success: false,\n support: supportCodeLibrary,\n }\n }\n\n emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n })\n\n const runtime = await makeRuntime({\n environment,\n logger,\n eventBroadcaster,\n sourcedPickles: filteredPickles,\n newId,\n supportCodeLibrary,\n options: options.runtime,\n })\n const success = await runtime.run()\n await pluginManager.cleanup()\n await cleanupFormatters()\n\n return {\n success: success && !formatterStreamError,\n support: supportCodeLibrary,\n }\n}\n"]}
1
+ {"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,iDAAsE;AACtE,kDAAyD;AACzD,4CAAyE;AACzE,oCAAuC;AAEvC,wCAAoC;AAEpC,wCAAwC;AACxC,gDAAiE;AAEjE,6CAAmD;AACnD,uCAAiD;AACjD,uCAA+C;AAC/C,uCAAoD;AAEpD;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,cAA+B,EAAE,EACjC,SAAuC;IAEvC,MAAM,iBAAiB,GAAG,IAAA,6BAAe,EAAC,WAAW,CAAC,CAAA;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;IAE9D,MAAM,CAAC,KAAK,CAAC,uBAAuB,iBAAO;qBACxB,GAAG;gBACR,SAAS;CACxB,CAAC,CAAA;IAEA,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAEhC,MAAM,kBAAkB,GACtB,qBAAqB,IAAI,OAAO,CAAC,OAAO;QACtC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB;QACrC,CAAC,CAAC,MAAM,CAAC,MAAM,CACX;YACE,cAAc,EAAE,EAAE;YAClB,YAAY,EAAE,EAAE;YAChB,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,EAAE;SAChB,EACD,OAAO,CAAC,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AM,OAAO,GAAG,MAAM,IAAA,qBAAW,EAAC;QAChC,WAAW;QACX,MAAM;QACN,gBAAgB;QAChB,cAAc,EAAE,eAAe;QAC/B,KAAK;QACL,kBAAkB;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,CAAA;IACnC,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,MAAM,iBAAiB,EAAE,CAAA;IAEzB,OAAO;QACL,OAAO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC5B,CAAA;AACH,CAAC;AA5ID,kCA4IC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Envelope, IdGenerator, ParseError } from '@cucumber/messages'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { emitMetaMessage, emitSupportCodeMessages } from '../cli/helpers'\nimport { resolvePaths } from '../paths'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { version } from '../version'\nimport { IFilterablePickle } from '../filter'\nimport { makeRuntime } from '../runtime'\nimport { IRunEnvironment, makeEnvironment } from '../environment'\nimport { IRunOptions, IRunResult } from './types'\nimport { initializeFormatters } from './formatters'\nimport { getSupportCodeLibrary } from './support'\nimport { getPicklesAndErrors } from './gherkin'\nimport { initializeForRunCucumber } from './plugins'\n\n/**\n * Execute a Cucumber test run and return the overall result\n *\n * @public\n * @param options - Options for the run, obtainable via {@link loadConfiguration}\n * @param environment - Project environment\n * @param onMessage - Callback fired each time Cucumber emits a message\n */\nexport async function runCucumber(\n options: IRunOptions,\n environment: IRunEnvironment = {},\n onMessage?: (message: Envelope) => void\n): Promise<IRunResult> {\n const mergedEnvironment = makeEnvironment(environment)\n const { cwd, stdout, stderr, env, logger } = mergedEnvironment\n\n logger.debug(`Running cucumber-js ${version} \nWorking directory: ${cwd}\nRunning from: ${__dirname} \n`)\n\n const newId = IdGenerator.uuid()\n\n const supportCoordinates =\n 'originalCoordinates' in options.support\n ? options.support.originalCoordinates\n : Object.assign(\n {\n requireModules: [],\n requirePaths: [],\n loaders: [],\n importPaths: [],\n },\n options.support\n )\n\n const pluginManager = await initializeForRunCucumber(\n {\n ...options,\n support: supportCoordinates,\n },\n mergedEnvironment\n )\n\n const resolvedPaths = await resolvePaths(\n logger,\n cwd,\n options.sources,\n supportCoordinates\n )\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { sourcePaths, requirePaths, importPaths } = resolvedPaths\n\n const supportCodeLibrary =\n 'originalCoordinates' in options.support\n ? (options.support as SupportCodeLibrary)\n : await getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requirePaths,\n requireModules: supportCoordinates.requireModules,\n importPaths,\n loaders: supportCoordinates.loaders,\n })\n\n const eventBroadcaster = new EventEmitter()\n if (onMessage) {\n eventBroadcaster.on('envelope', onMessage)\n }\n eventBroadcaster.on('envelope', (value) =>\n pluginManager.emit('message', value)\n )\n const eventDataCollector = new EventDataCollector(eventBroadcaster)\n\n let formatterStreamError = false\n const cleanupFormatters = await initializeFormatters({\n env,\n cwd,\n stdout,\n stderr,\n logger,\n onStreamError: () => (formatterStreamError = true),\n eventBroadcaster,\n eventDataCollector,\n configuration: options.formats,\n supportCodeLibrary,\n pluginManager,\n })\n await emitMetaMessage(eventBroadcaster, env)\n\n let filteredPickles: ReadonlyArray<IFilterablePickle> = []\n let parseErrors: ParseError[] = []\n if (sourcePaths.length > 0) {\n const gherkinResult = await getPicklesAndErrors({\n newId,\n cwd,\n sourcePaths,\n coordinates: options.sources,\n onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),\n })\n filteredPickles = await pluginManager.transform(\n 'pickles:filter',\n gherkinResult.filterablePickles\n )\n filteredPickles = await pluginManager.transform(\n 'pickles:order',\n filteredPickles\n )\n parseErrors = gherkinResult.parseErrors\n }\n if (parseErrors.length) {\n parseErrors.forEach((parseError) => {\n logger.error(\n `Parse error in \"${parseError.source.uri}\" ${parseError.message}`\n )\n })\n await cleanupFormatters()\n await pluginManager.cleanup()\n return {\n success: false,\n support: supportCodeLibrary,\n }\n }\n\n emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n })\n\n const runtime = await makeRuntime({\n environment,\n logger,\n eventBroadcaster,\n sourcedPickles: filteredPickles,\n newId,\n supportCodeLibrary,\n options: options.runtime,\n })\n const success = await runtime.run()\n await pluginManager.cleanup()\n await cleanupFormatters()\n\n return {\n success: success && !formatterStreamError,\n support: supportCodeLibrary,\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { IdGenerator } from '@cucumber/messages';
2
2
  import { SupportCodeLibrary } from '../support_code_library_builder/types';
3
- import { ILogger } from '../logger';
3
+ import { ILogger } from '../environment';
4
4
  export declare function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, loaders, }: {
5
5
  logger: ILogger;
6
6
  cwd: string;
@@ -1 +1 @@
1
- {"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsC;AACtC,uCAAwC;AAGxC,mGAAuE;AACvE,iEAAuC;AAGhC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,MAAM,EACN,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,GASR;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE;QAC1C,cAAc;QACd,YAAY;QACZ,WAAW;QACX,OAAO;KACR,CAAC,CAAA;IAEF,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1B,MAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAA;QACzD,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IACF,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAA;QACzD,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE;QAC/B,MAAM,CAAC,KAAK,CAAC,kCAAkC,SAAS,GAAG,CAAC,CAAA;QAC5D,IAAA,sBAAQ,EAAC,SAAS,EAAE,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,CAAA;KACzC;IAED,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,CAAC,KAAK,CAAC,mCAAmC,IAAI,GAAG,CAAC,CAAA;QACxD,MAAM,MAAM,CAAC,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC7C;IAED,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AA5CD,sDA4CC","sourcesContent":["import { register } from 'node:module'\nimport { pathToFileURL } from 'node:url'\nimport { IdGenerator } from '@cucumber/messages'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport supportCodeLibraryBuilder from '../support_code_library_builder'\nimport tryRequire from '../try_require'\nimport { ILogger } from '../logger'\n\nexport async function getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requireModules,\n requirePaths,\n importPaths,\n loaders,\n}: {\n logger: ILogger\n cwd: string\n newId: IdGenerator.NewId\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n loaders: string[]\n}): Promise<SupportCodeLibrary> {\n supportCodeLibraryBuilder.reset(cwd, newId, {\n requireModules,\n requirePaths,\n importPaths,\n loaders,\n })\n\n requireModules.map((path) => {\n logger.debug(`Attempting to require code from \"${path}\"`)\n tryRequire(path)\n })\n requirePaths.map((path) => {\n logger.debug(`Attempting to require code from \"${path}\"`)\n tryRequire(path)\n })\n\n for (const specifier of loaders) {\n logger.debug(`Attempting to register loader \"${specifier}\"`)\n register(specifier, pathToFileURL('./'))\n }\n\n for (const path of importPaths) {\n logger.debug(`Attempting to import code from \"${path}\"`)\n await import(pathToFileURL(path).toString())\n }\n\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
1
+ {"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsC;AACtC,uCAAwC;AAGxC,mGAAuE;AACvE,iEAAuC;AAGhC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,MAAM,EACN,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,GASR;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE;QAC1C,cAAc;QACd,YAAY;QACZ,WAAW;QACX,OAAO;KACR,CAAC,CAAA;IAEF,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1B,MAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAA;QACzD,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IACF,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAA;QACzD,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE;QAC/B,MAAM,CAAC,KAAK,CAAC,kCAAkC,SAAS,GAAG,CAAC,CAAA;QAC5D,IAAA,sBAAQ,EAAC,SAAS,EAAE,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,CAAA;KACzC;IAED,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,CAAC,KAAK,CAAC,mCAAmC,IAAI,GAAG,CAAC,CAAA;QACxD,MAAM,MAAM,CAAC,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC7C;IAED,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AA5CD,sDA4CC","sourcesContent":["import { register } from 'node:module'\nimport { pathToFileURL } from 'node:url'\nimport { IdGenerator } from '@cucumber/messages'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport supportCodeLibraryBuilder from '../support_code_library_builder'\nimport tryRequire from '../try_require'\nimport { ILogger } from '../environment'\n\nexport async function getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requireModules,\n requirePaths,\n importPaths,\n loaders,\n}: {\n logger: ILogger\n cwd: string\n newId: IdGenerator.NewId\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n loaders: string[]\n}): Promise<SupportCodeLibrary> {\n supportCodeLibraryBuilder.reset(cwd, newId, {\n requireModules,\n requirePaths,\n importPaths,\n loaders,\n })\n\n requireModules.map((path) => {\n logger.debug(`Attempting to require code from \"${path}\"`)\n tryRequire(path)\n })\n requirePaths.map((path) => {\n logger.debug(`Attempting to require code from \"${path}\"`)\n tryRequire(path)\n })\n\n for (const specifier of loaders) {\n logger.debug(`Attempting to register loader \"${specifier}\"`)\n register(specifier, pathToFileURL('./'))\n }\n\n for (const path of importPaths) {\n logger.debug(`Attempting to import code from \"${path}\"`)\n await import(pathToFileURL(path).toString())\n }\n\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
@@ -1,3 +1,3 @@
1
- import { IRunEnvironment } from './types';
1
+ import { IRunEnvironment } from '../environment';
2
2
  export declare function setupEnvironment(): Promise<Partial<IRunEnvironment>>;
3
3
  export declare function teardownEnvironment(environment: IRunEnvironment): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"test_helpers.js","sourceRoot":"","sources":["../../src/api/test_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAC5B,6CAAyC;AACzC,+CAAsB;AACtB,2EAAqD;AACrD,iDAAgD;AAGhD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;AAEzB,KAAK,UAAU,g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ent } from 'reindent-template-literals'\nimport { IdGenerator } from '@cucumber/messages'\nimport { IRunEnvironment } from './types'\n\nconst newId = IdGenerator.uuid()\n\nexport async function setupEnvironment(): Promise<Partial<IRunEnvironment>> {\n const cwd = path.join(__dirname, '..', '..', 'tmp', `api_${newId()}`)\n await fs.mkdir(path.join(cwd, 'features'), { recursive: true })\n await fs.writeFile(\n path.join(cwd, 'features', 'test.feature'),\n reindent(`Feature: test fixture\n Scenario: one\n Given a step\n Then another step`)\n )\n await fs.writeFile(\n path.join(cwd, 'features', 'steps.ts'),\n reindent(`import { Given, Then } from '../../../src'\n Given('a step', function () {})\n Then('another step', function () {})`)\n )\n await fs.writeFile(\n path.join(cwd, 'cucumber.mjs'),\n `export default {paths: ['features/test.feature'], requireModule: ['ts-node/register'], require: ['features/steps.ts']}`\n )\n const stdout = new PassThrough()\n return { cwd, stdout }\n}\n\nexport async function teardownEnvironment(environment: IRunEnvironment) {\n return new Promise((resolve) => {\n fs.rm(environment.cwd, { recursive: true }, resolve)\n }).then(() => {\n environment.stdout.end()\n })\n}\n"]}
1
+ {"version":3,"file":"test_helpers.js","sourceRoot":"","sources":["../../src/api/test_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAC5B,6CAAyC;AACzC,+CAAsB;AACtB,2EAAqD;AACrD,iDAAgD;AAGhD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;AAEzB,KAAK,UAAU,gBAAgB;IACpC,MAAM,GAAG,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,KAAK,EAAE,EAAE,CAAC,CAAA;IACrE,MAAM,YAAE,CAAC,KAAK,CAAC,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC/D,MAAM,YAAE,CAAC,SAAS,CAChB,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,cAAc,CAAC,EAC1C,IAAA,qCAAQ,EAAC;;;0BAGa,CAAC,CACxB,CAAA;IACD,MAAM,YAAE,CAAC,SAAS,CAChB,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,EACtC,IAAA,qCAAQ,EAAC;;yCAE4B,CAAC,CACvC,CAAA;IACD,MAAM,YAAE,CAAC,SAAS,CAChB,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAC9B,wHAAwH,CACzH,CAAA;IACD,MAAM,MAAM,GAAG,IAAI,yBAAW,EAAE,CAAA;IAChC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA;AACxB,CAAC;AAtBD,4CAsBC;AAEM,KAAK,UAAU,mBAAmB,CAAC,WAA4B;IACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,YAAE,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;IAC1B,CAAC,CAAC,CAAA;AACJ,CAAC;AAND,kDAMC","sourcesContent":["import path from 'node:path'\nimport { PassThrough } from 'node:stream'\nimport fs from 'mz/fs'\nimport { reindent } from 'reindent-template-literals'\nimport { IdGenerator } from '@cucumber/messages'\nimport { IRunEnvironment } from '../environment'\n\nconst newId = IdGenerator.uuid()\n\nexport async function setupEnvironment(): Promise<Partial<IRunEnvironment>> {\n const cwd = path.join(__dirname, '..', '..', 'tmp', `api_${newId()}`)\n await fs.mkdir(path.join(cwd, 'features'), { recursive: true })\n await fs.writeFile(\n path.join(cwd, 'features', 'test.feature'),\n reindent(`Feature: test fixture\n Scenario: one\n Given a step\n Then another step`)\n )\n await fs.writeFile(\n path.join(cwd, 'features', 'steps.ts'),\n reindent(`import { Given, Then } from '../../../src'\n Given('a step', function () {})\n Then('another step', function () {})`)\n )\n await fs.writeFile(\n path.join(cwd, 'cucumber.mjs'),\n `export default {paths: ['features/test.feature'], requireModule: ['ts-node/register'], require: ['features/steps.ts']}`\n )\n const stdout = new PassThrough()\n return { cwd, stdout }\n}\n\nexport async function teardownEnvironment(environment: IRunEnvironment) {\n return new Promise((resolve) => {\n fs.rm(environment.cwd, { recursive: true }, resolve)\n }).then(() => {\n environment.stdout.end()\n })\n}\n"]}
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Writable } from 'node:stream';
4
1
  import { JsonObject } from 'type-fest';
5
2
  import { IPublishConfig } from '../publish';
6
3
  import { IConfiguration } from '../configuration';
@@ -280,38 +277,6 @@ export interface IRunOptions {
280
277
  runtime: IRunOptionsRuntime;
281
278
  formats: IRunOptionsFormats;
282
279
  }
283
- /**
284
- * Contextual data about the project environment
285
- * @public
286
- */
287
- export interface IRunEnvironment {
288
- /**
289
- * Working directory for the project
290
- * @default process.cwd()
291
- */
292
- cwd?: string;
293
- /**
294
- * Writable stream where the test run's main formatter output is written
295
- * @default process.stdout
296
- */
297
- stdout?: Writable;
298
- /**
299
- * Writable stream where the test run's warning/error output is written
300
- * @default process.stderr
301
- */
302
- stderr?: Writable;
303
- /**
304
- * Environment variables
305
- * @default process.env
306
- */
307
- env?: NodeJS.ProcessEnv;
308
- /**
309
- * Whether debug logging should be emitted to {@link IRunEnvironment.stderr}
310
- * @default false
311
- * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md}
312
- */
313
- debug?: boolean;
314
- }
315
280
  /**
316
281
  * Response from {@link runCucumber}
317
282
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\nimport { JsonObject } from 'type-fest'\nimport { IPublishConfig } from '../publish'\nimport { IConfiguration } from '../configuration'\nimport { IPickleOrder } from '../filter'\n\n/**\n * Options for {@link loadConfiguration}\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from, or `false` to skip\n * @default `cucumber.(json|yaml|yml|js|cjs|mjs)`\n */\n file?: string | false\n /**\n * Zero or more profile names from which to source configuration in the file\n * @remarks\n * If omitted or empty, the `default` profile will be used.\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be merged over the top of whatever is\n * loaded from the configuration file/profiles\n * @example\n * \\{\n * failFast: true,\n * parallel: 2\n * \\}\n * @example [\"--fail-fast\", \"--parallel\", \"2\"]\n * @example \"--fail-fast --parallel 2\"\n * @remarks\n * This can also be provided as an array or single string of argv-style\n * arguments.\n */\n provided?: Partial<IConfiguration> | string[] | string\n}\n\n/**\n * Response from {@link loadConfiguration}\n * @public\n */\nexport interface IResolvedConfiguration {\n /**\n * The final flat configuration object resolved from the configuration\n * file/profiles plus any extra provided\n */\n useConfiguration: IConfiguration\n /**\n * The format that can be passed into {@link runCucumber}\n */\n runConfiguration: IRunConfiguration\n}\n\n/**\n * Options relating to sources (i.e. feature files) - where to load them from,\n * how to interpret, filter and order them\n * @public\n */\nexport interface ISourcesCoordinates {\n /**\n * Default Gherkin dialect\n * @remarks\n * Used if no dialect is specified in the feature file itself.\n */\n defaultDialect: string\n /**\n * Paths and/or glob expressions to feature files\n */\n paths: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n */\n names: string[]\n /**\n * Tag expression to filter which scenarios should be run\n */\n tagExpression: string\n /**\n * Run in the order defined, or in a random order\n */\n order: IPickleOrder\n}\n\n/**\n * A pickle that has been successfully compiled from a source\n * @public\n */\nexport interface IPlannedPickle {\n /**\n * Name of the pickle (after parameter resolution)\n */\n name: string\n uri: string\n location: {\n line: number\n column?: number\n }\n}\n\n/**\n * An error encountered when parsing a source\n * @public\n */\nexport interface ISourcesError {\n uri: string\n location: {\n line: number\n column?: number\n }\n /**\n * Error message explaining what went wrong with the parse\n */\n message: string\n}\n\n/**\n * Response from {@link loadSources}\n * @public\n */\nexport interface ILoadSourcesResult {\n /**\n * Pickles that have been successfully compiled, in the order they would be\n * run in\n */\n plan: IPlannedPickle[]\n /**\n * Any errors encountered when parsing sources\n */\n errors: ISourcesError[]\n}\n\n/**\n * Options relating to user code (aka support code) - where to load it from and\n * how to preprocess it\n * @public\n */\nexport interface ISupportCodeCoordinates {\n /**\n * Names of transpilation modules to load, via `require()`\n */\n requireModules: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `require()`\n */\n requirePaths: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `import()`\n */\n importPaths: string[]\n /**\n * Specifiers of loaders to register, via `register()`\n */\n loaders: string[]\n}\n\n/**\n * Options for {@link loadSupport}\n * @public\n * @remarks\n * A subset of {@link IRunConfiguration}\n */\nexport interface ILoadSupportOptions {\n /**\n * @remarks\n * This is needed because the default support path locations are derived from\n * feature file locations.\n */\n sources: ISourcesCoordinates\n support: Partial<ISupportCodeCoordinates>\n}\n\n/**\n * Options relating to behaviour when actually running tests\n * @public\n */\nexport interface IRunOptionsRuntime {\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n */\n dryRun: boolean\n /**\n * Stop running tests when a test fails\n */\n failFast: boolean\n /**\n * Filter out stack frames from Cucumber's code when formatting stack traces\n */\n filterStacktraces: boolean\n /**\n * Run tests in parallel with the given number of worker processes\n */\n parallel: number\n /**\n * Retry failing tests up to the given number of times\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n */\n strict: boolean\n /**\n * Parameters to be passed to the World\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n\n/**\n * Options relating to formatters - which ones to use, where to write their\n * output, how they should behave\n * @public\n */\nexport interface IRunOptionsFormats {\n /**\n * Name/path of the formatter to use for `stdout` output\n */\n stdout: string\n /**\n * Zero or more mappings of file output path (key) to name/path of the\n * formatter to use (value)\n * @example\n * \\{\n * \"./reports/cucumber.html\": \"html\",\n * \"./reports/custom.txt\": \"./custom-formatter.js\"\n * \\}\n */\n files: Record<string, string>\n /**\n * Options for report publication, or `false` to disable publication\n */\n publish: IPublishConfig | false\n /**\n * Options to be provided to formatters\n * @remarks\n * The value must be a JSON-serializable object.\n */\n options: JsonObject\n}\n\n/**\n * Structured configuration object suitable for passing to {@link runCucumber}\n * @public\n */\nexport interface IRunConfiguration {\n sources: ISourcesCoordinates\n support: Partial<ISupportCodeCoordinates>\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * A collection of user-defined code and setup (\"support code\") that can be\n * used for a test run\n * @public\n * @remarks\n * This is mostly a marker interface. The actual instance is a complex object\n * that you shouldn't interact with directly, but some functions return and/or\n * accept it as a means of optimising a test workflow.\n */\nexport interface ISupportCodeLibrary {\n readonly originalCoordinates: ISupportCodeCoordinates\n}\n\n/**\n * Either an actual {@link ISupportCodeLibrary | support code library}, or the\n * {@link ISupportCodeCoordinates | coordinates} required to create and\n * populate one\n * @public\n * @remarks\n * This alias exists because {@link runCucumber} will accept an existing\n * support code library in its options and thus avoid trying to load it again,\n * improving performance and avoiding cache issues for use cases where multiple\n * test runs happen within the same process. Note this is only useful in serial\n * mode, as parallel workers will each load the support code themselves anyway.\n */\nexport type ISupportCodeCoordinatesOrLibrary =\n | Partial<ISupportCodeCoordinates>\n | ISupportCodeLibrary\n\n/**\n * Options for {@link runCucumber}\n * @public\n */\nexport interface IRunOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinatesOrLibrary\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * Contextual data about the project environment\n * @public\n */\nexport interface IRunEnvironment {\n /**\n * Working directory for the project\n * @default process.cwd()\n */\n cwd?: string\n /**\n * Writable stream where the test run's main formatter output is written\n * @default process.stdout\n */\n stdout?: Writable\n /**\n * Writable stream where the test run's warning/error output is written\n * @default process.stderr\n */\n stderr?: Writable\n /**\n * Environment variables\n * @default process.env\n */\n env?: NodeJS.ProcessEnv\n /**\n * Whether debug logging should be emitted to {@link IRunEnvironment.stderr}\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md}\n */\n debug?: boolean\n}\n\n/**\n * Response from {@link runCucumber}\n * @public\n */\nexport interface IRunResult {\n /**\n * Whether the test run was overall successful\n * @remarks\n * The exact meaning can vary based on the `strict` configuration option.\n */\n success: boolean\n /**\n * The support code library that was used in the test run\n * @remarks\n * This can be reused in subsequent {@link runCucumber} calls,\n * see {@link ISupportCodeCoordinatesOrLibrary}\n */\n support: ISupportCodeLibrary\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonObject } from 'type-fest'\nimport { IPublishConfig } from '../publish'\nimport { IConfiguration } from '../configuration'\nimport { IPickleOrder } from '../filter'\n\n/**\n * Options for {@link loadConfiguration}\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from, or `false` to skip\n * @default `cucumber.(json|yaml|yml|js|cjs|mjs)`\n */\n file?: string | false\n /**\n * Zero or more profile names from which to source configuration in the file\n * @remarks\n * If omitted or empty, the `default` profile will be used.\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be merged over the top of whatever is\n * loaded from the configuration file/profiles\n * @example\n * \\{\n * failFast: true,\n * parallel: 2\n * \\}\n * @example [\"--fail-fast\", \"--parallel\", \"2\"]\n * @example \"--fail-fast --parallel 2\"\n * @remarks\n * This can also be provided as an array or single string of argv-style\n * arguments.\n */\n provided?: Partial<IConfiguration> | string[] | string\n}\n\n/**\n * Response from {@link loadConfiguration}\n * @public\n */\nexport interface IResolvedConfiguration {\n /**\n * The final flat configuration object resolved from the configuration\n * file/profiles plus any extra provided\n */\n useConfiguration: IConfiguration\n /**\n * The format that can be passed into {@link runCucumber}\n */\n runConfiguration: IRunConfiguration\n}\n\n/**\n * Options relating to sources (i.e. feature files) - where to load them from,\n * how to interpret, filter and order them\n * @public\n */\nexport interface ISourcesCoordinates {\n /**\n * Default Gherkin dialect\n * @remarks\n * Used if no dialect is specified in the feature file itself.\n */\n defaultDialect: string\n /**\n * Paths and/or glob expressions to feature files\n */\n paths: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n */\n names: string[]\n /**\n * Tag expression to filter which scenarios should be run\n */\n tagExpression: string\n /**\n * Run in the order defined, or in a random order\n */\n order: IPickleOrder\n}\n\n/**\n * A pickle that has been successfully compiled from a source\n * @public\n */\nexport interface IPlannedPickle {\n /**\n * Name of the pickle (after parameter resolution)\n */\n name: string\n uri: string\n location: {\n line: number\n column?: number\n }\n}\n\n/**\n * An error encountered when parsing a source\n * @public\n */\nexport interface ISourcesError {\n uri: string\n location: {\n line: number\n column?: number\n }\n /**\n * Error message explaining what went wrong with the parse\n */\n message: string\n}\n\n/**\n * Response from {@link loadSources}\n * @public\n */\nexport interface ILoadSourcesResult {\n /**\n * Pickles that have been successfully compiled, in the order they would be\n * run in\n */\n plan: IPlannedPickle[]\n /**\n * Any errors encountered when parsing sources\n */\n errors: ISourcesError[]\n}\n\n/**\n * Options relating to user code (aka support code) - where to load it from and\n * how to preprocess it\n * @public\n */\nexport interface ISupportCodeCoordinates {\n /**\n * Names of transpilation modules to load, via `require()`\n */\n requireModules: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `require()`\n */\n requirePaths: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `import()`\n */\n importPaths: string[]\n /**\n * Specifiers of loaders to register, via `register()`\n */\n loaders: string[]\n}\n\n/**\n * Options for {@link loadSupport}\n * @public\n * @remarks\n * A subset of {@link IRunConfiguration}\n */\nexport interface ILoadSupportOptions {\n /**\n * @remarks\n * This is needed because the default support path locations are derived from\n * feature file locations.\n */\n sources: ISourcesCoordinates\n support: Partial<ISupportCodeCoordinates>\n}\n\n/**\n * Options relating to behaviour when actually running tests\n * @public\n */\nexport interface IRunOptionsRuntime {\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n */\n dryRun: boolean\n /**\n * Stop running tests when a test fails\n */\n failFast: boolean\n /**\n * Filter out stack frames from Cucumber's code when formatting stack traces\n */\n filterStacktraces: boolean\n /**\n * Run tests in parallel with the given number of worker processes\n */\n parallel: number\n /**\n * Retry failing tests up to the given number of times\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n */\n strict: boolean\n /**\n * Parameters to be passed to the World\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n\n/**\n * Options relating to formatters - which ones to use, where to write their\n * output, how they should behave\n * @public\n */\nexport interface IRunOptionsFormats {\n /**\n * Name/path of the formatter to use for `stdout` output\n */\n stdout: string\n /**\n * Zero or more mappings of file output path (key) to name/path of the\n * formatter to use (value)\n * @example\n * \\{\n * \"./reports/cucumber.html\": \"html\",\n * \"./reports/custom.txt\": \"./custom-formatter.js\"\n * \\}\n */\n files: Record<string, string>\n /**\n * Options for report publication, or `false` to disable publication\n */\n publish: IPublishConfig | false\n /**\n * Options to be provided to formatters\n * @remarks\n * The value must be a JSON-serializable object.\n */\n options: JsonObject\n}\n\n/**\n * Structured configuration object suitable for passing to {@link runCucumber}\n * @public\n */\nexport interface IRunConfiguration {\n sources: ISourcesCoordinates\n support: Partial<ISupportCodeCoordinates>\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * A collection of user-defined code and setup (\"support code\") that can be\n * used for a test run\n * @public\n * @remarks\n * This is mostly a marker interface. The actual instance is a complex object\n * that you shouldn't interact with directly, but some functions return and/or\n * accept it as a means of optimising a test workflow.\n */\nexport interface ISupportCodeLibrary {\n readonly originalCoordinates: ISupportCodeCoordinates\n}\n\n/**\n * Either an actual {@link ISupportCodeLibrary | support code library}, or the\n * {@link ISupportCodeCoordinates | coordinates} required to create and\n * populate one\n * @public\n * @remarks\n * This alias exists because {@link runCucumber} will accept an existing\n * support code library in its options and thus avoid trying to load it again,\n * improving performance and avoiding cache issues for use cases where multiple\n * test runs happen within the same process. Note this is only useful in serial\n * mode, as parallel workers will each load the support code themselves anyway.\n */\nexport type ISupportCodeCoordinatesOrLibrary =\n | Partial<ISupportCodeCoordinates>\n | ISupportCodeLibrary\n\n/**\n * Options for {@link runCucumber}\n * @public\n */\nexport interface IRunOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinatesOrLibrary\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * Response from {@link runCucumber}\n * @public\n */\nexport interface IRunResult {\n /**\n * Whether the test run was overall successful\n * @remarks\n * The exact meaning can vary based on the `strict` configuration option.\n */\n success: boolean\n /**\n * The support code library that was used in the test run\n * @remarks\n * This can be reused in subsequent {@link runCucumber} calls,\n * see {@link ISupportCodeCoordinatesOrLibrary}\n */\n support: ISupportCodeLibrary\n}\n"]}
@@ -3,9 +3,4 @@ import { EventEmitter } from 'node:events';
3
3
  import { IdGenerator } from '@cucumber/messages';
4
4
  import { SupportCodeLibrary } from '../support_code_library_builder/types';
5
5
  import { AssembledTestCase, SourcedPickle } from './types';
6
- export declare function assembleTestCases({ eventBroadcaster, newId, sourcedPickles, supportCodeLibrary, }: {
7
- eventBroadcaster: EventEmitter;
8
- newId: IdGenerator.NewId;
9
- sourcedPickles: ReadonlyArray<SourcedPickle>;
10
- supportCodeLibrary: SupportCodeLibrary;
11
- }): Promise<ReadonlyArray<AssembledTestCase>>;
6
+ export declare function assembleTestCases(testRunStartedId: string, eventBroadcaster: EventEmitter, newId: IdGenerator.NewId, sourcedPickles: ReadonlyArray<SourcedPickle>, supportCodeLibrary: SupportCodeLibrary): Promise<ReadonlyArray<AssembledTestCase>>;