@cucumber/cucumber 8.0.0-rc.2 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/README.md +82 -51
  2. package/api/index.d.ts +6 -0
  3. package/bin/{cucumber-js → cucumber.js} +0 -0
  4. package/lib/api/convert_configuration.d.ts +4 -0
  5. package/lib/api/convert_configuration.js +65 -0
  6. package/lib/api/convert_configuration.js.map +1 -0
  7. package/lib/api/environment.d.ts +2 -0
  8. package/lib/api/environment.js +13 -0
  9. package/lib/api/environment.js.map +1 -0
  10. package/lib/{run → api}/formatters.d.ts +5 -3
  11. package/lib/{run → api}/formatters.js +13 -17
  12. package/lib/api/formatters.js.map +1 -0
  13. package/lib/api/gherkin.d.ts +21 -0
  14. package/lib/api/gherkin.js +65 -0
  15. package/lib/api/gherkin.js.map +1 -0
  16. package/lib/api/index.d.ts +11 -0
  17. package/lib/api/index.js +28 -0
  18. package/lib/api/index.js.map +1 -0
  19. package/lib/api/load_configuration.d.ts +9 -0
  20. package/lib/api/load_configuration.js +32 -0
  21. package/lib/api/load_configuration.js.map +1 -0
  22. package/lib/api/load_sources.d.ts +9 -0
  23. package/lib/api/load_sources.js +53 -0
  24. package/lib/api/load_sources.js.map +1 -0
  25. package/lib/api/load_support.d.ts +10 -0
  26. package/lib/api/load_support.js +28 -0
  27. package/lib/api/load_support.js.map +1 -0
  28. package/lib/api/paths.d.ts +7 -0
  29. package/lib/{run → api}/paths.js +25 -9
  30. package/lib/api/paths.js.map +1 -0
  31. package/lib/api/run_cucumber.d.ts +11 -0
  32. package/lib/api/run_cucumber.js +108 -0
  33. package/lib/api/run_cucumber.js.map +1 -0
  34. package/lib/{run → api}/runtime.d.ts +8 -7
  35. package/lib/api/runtime.js +36 -0
  36. package/lib/api/runtime.js.map +1 -0
  37. package/lib/{run → api}/support.d.ts +4 -3
  38. package/lib/{run → api}/support.js +5 -10
  39. package/lib/api/support.js.map +1 -0
  40. package/lib/api/types.d.ts +168 -0
  41. package/lib/{run → api}/types.js +0 -0
  42. package/lib/api/types.js.map +1 -0
  43. package/lib/api/wrapper.mjs +6 -0
  44. package/lib/cli/helpers.d.ts +16 -11
  45. package/lib/cli/helpers.js +25 -30
  46. package/lib/cli/helpers.js.map +1 -1
  47. package/lib/cli/index.d.ts +3 -1
  48. package/lib/cli/index.js +35 -19
  49. package/lib/cli/index.js.map +1 -1
  50. package/lib/cli/publish_banner.js +6 -6
  51. package/lib/cli/publish_banner.js.map +1 -1
  52. package/lib/cli/run.js +12 -3
  53. package/lib/cli/run.js.map +1 -1
  54. package/lib/cli/validate_node_engine_version.d.ts +10 -0
  55. package/lib/cli/validate_node_engine_version.js +24 -0
  56. package/lib/cli/validate_node_engine_version.js.map +1 -0
  57. package/lib/configuration/argv_parser.d.ts +20 -0
  58. package/lib/{cli → configuration}/argv_parser.js +45 -47
  59. package/lib/configuration/argv_parser.js.map +1 -0
  60. package/lib/configuration/check_schema.d.ts +2 -0
  61. package/lib/configuration/check_schema.js +60 -0
  62. package/lib/configuration/check_schema.js.map +1 -0
  63. package/lib/configuration/default_configuration.d.ts +2 -0
  64. package/lib/configuration/default_configuration.js +27 -0
  65. package/lib/configuration/default_configuration.js.map +1 -0
  66. package/lib/configuration/from_file.d.ts +2 -0
  67. package/lib/configuration/from_file.js +68 -0
  68. package/lib/configuration/from_file.js.map +1 -0
  69. package/lib/configuration/helpers.d.ts +1 -0
  70. package/lib/configuration/helpers.js +11 -0
  71. package/lib/configuration/helpers.js.map +1 -0
  72. package/lib/configuration/index.d.ts +6 -0
  73. package/lib/configuration/index.js +16 -1
  74. package/lib/configuration/index.js.map +1 -1
  75. package/lib/configuration/locate_file.d.ts +1 -0
  76. package/lib/configuration/locate_file.js +19 -0
  77. package/lib/configuration/locate_file.js.map +1 -0
  78. package/lib/configuration/merge_configurations.d.ts +2 -0
  79. package/lib/configuration/merge_configurations.js +48 -0
  80. package/lib/configuration/merge_configurations.js.map +1 -0
  81. package/lib/configuration/option_splitter.d.ts +3 -0
  82. package/lib/{cli → configuration}/option_splitter.js +3 -3
  83. package/lib/configuration/option_splitter.js.map +1 -0
  84. package/lib/configuration/types.d.ts +24 -28
  85. package/lib/configuration/types.js.map +1 -1
  86. package/lib/configuration/validate_configuration.d.ts +2 -0
  87. package/lib/configuration/validate_configuration.js +10 -0
  88. package/lib/configuration/validate_configuration.js.map +1 -0
  89. package/lib/formatter/builder.d.ts +3 -3
  90. package/lib/formatter/builder.js +30 -4
  91. package/lib/formatter/builder.js.map +1 -1
  92. package/lib/formatter/fixtures/typescript.d.ts +2 -0
  93. package/lib/formatter/fixtures/typescript.js +6 -0
  94. package/lib/formatter/fixtures/typescript.js.map +1 -0
  95. package/lib/formatter/get_color_fns.js +15 -16
  96. package/lib/formatter/get_color_fns.js.map +1 -1
  97. package/lib/formatter/helpers/event_data_collector.js +5 -1
  98. package/lib/formatter/helpers/event_data_collector.js.map +1 -1
  99. package/lib/formatter/helpers/index.js +5 -1
  100. package/lib/formatter/helpers/index.js.map +1 -1
  101. package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
  102. package/lib/formatter/helpers/issue_helpers.js +2 -2
  103. package/lib/formatter/helpers/issue_helpers.js.map +1 -1
  104. package/lib/formatter/helpers/summary_helpers.js +5 -1
  105. package/lib/formatter/helpers/summary_helpers.js.map +1 -1
  106. package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +2 -2
  107. package/lib/formatter/helpers/test_case_attempt_formatter.js +18 -10
  108. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
  109. package/lib/formatter/helpers/test_case_attempt_parser.d.ts +2 -2
  110. package/lib/formatter/helpers/test_case_attempt_parser.js +7 -2
  111. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
  112. package/lib/formatter/helpers/usage_helpers/index.d.ts +1 -2
  113. package/lib/formatter/helpers/usage_helpers/index.js +8 -4
  114. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
  115. package/lib/formatter/index.d.ts +14 -2
  116. package/lib/formatter/index.js +2 -0
  117. package/lib/formatter/index.js.map +1 -1
  118. package/lib/formatter/json_formatter.js +5 -1
  119. package/lib/formatter/json_formatter.js.map +1 -1
  120. package/lib/formatter/progress_bar_formatter.js +1 -1
  121. package/lib/formatter/progress_bar_formatter.js.map +1 -1
  122. package/lib/formatter/progress_formatter.js +5 -1
  123. package/lib/formatter/progress_formatter.js.map +1 -1
  124. package/lib/formatter/rerun_formatter.js +5 -1
  125. package/lib/formatter/rerun_formatter.js.map +1 -1
  126. package/lib/formatter/snippets_formatter.js +5 -2
  127. package/lib/formatter/snippets_formatter.js.map +1 -1
  128. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.d.ts +1 -0
  129. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +9 -1
  130. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
  131. package/lib/formatter/summary_formatter.js +1 -1
  132. package/lib/formatter/summary_formatter.js.map +1 -1
  133. package/lib/formatter/usage_formatter.js +5 -2
  134. package/lib/formatter/usage_formatter.js.map +1 -1
  135. package/lib/formatter/usage_json_formatter.js +0 -1
  136. package/lib/formatter/usage_json_formatter.js.map +1 -1
  137. package/lib/index.d.ts +12 -8
  138. package/lib/index.js +11 -2
  139. package/lib/index.js.map +1 -1
  140. package/lib/models/definition.d.ts +1 -0
  141. package/lib/models/definition.js.map +1 -1
  142. package/lib/models/pickle_order.d.ts +1 -0
  143. package/lib/models/pickle_order.js +3 -0
  144. package/lib/models/pickle_order.js.map +1 -0
  145. package/lib/models/test_case_hook_definition.d.ts +1 -0
  146. package/lib/models/test_case_hook_definition.js +1 -0
  147. package/lib/models/test_case_hook_definition.js.map +1 -1
  148. package/lib/runtime/attachment_manager/index.js +5 -1
  149. package/lib/runtime/attachment_manager/index.js.map +1 -1
  150. package/lib/runtime/helpers.js +5 -1
  151. package/lib/runtime/helpers.js.map +1 -1
  152. package/lib/runtime/index.d.ts +3 -5
  153. package/lib/runtime/index.js +7 -36
  154. package/lib/runtime/index.js.map +1 -1
  155. package/lib/runtime/parallel/command_types.d.ts +3 -2
  156. package/lib/runtime/parallel/command_types.js.map +1 -1
  157. package/lib/runtime/parallel/coordinator.d.ts +27 -8
  158. package/lib/runtime/parallel/coordinator.js +71 -20
  159. package/lib/runtime/parallel/coordinator.js.map +1 -1
  160. package/lib/runtime/parallel/worker.d.ts +2 -4
  161. package/lib/runtime/parallel/worker.js +11 -34
  162. package/lib/runtime/parallel/worker.js.map +1 -1
  163. package/lib/runtime/run_test_run_hooks.d.ts +3 -0
  164. package/lib/runtime/run_test_run_hooks.js +28 -0
  165. package/lib/runtime/run_test_run_hooks.js.map +1 -0
  166. package/lib/runtime/step_runner.js +5 -1
  167. package/lib/runtime/step_runner.js.map +1 -1
  168. package/lib/runtime/stopwatch.js +5 -1
  169. package/lib/runtime/stopwatch.js.map +1 -1
  170. package/lib/runtime/test_case_runner.js +5 -1
  171. package/lib/runtime/test_case_runner.js.map +1 -1
  172. package/lib/support_code_library_builder/index.d.ts +4 -2
  173. package/lib/support_code_library_builder/index.js +25 -2
  174. package/lib/support_code_library_builder/index.js.map +1 -1
  175. package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -0
  176. package/lib/support_code_library_builder/parallel_can_assign_helpers.js +16 -0
  177. package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -0
  178. package/lib/support_code_library_builder/types.d.ts +10 -0
  179. package/lib/support_code_library_builder/types.js.map +1 -1
  180. package/lib/support_code_library_builder/world.d.ts +7 -7
  181. package/lib/support_code_library_builder/world.js.map +1 -1
  182. package/lib/time.js +5 -1
  183. package/lib/time.js.map +1 -1
  184. package/lib/version.d.ts +1 -1
  185. package/lib/version.js +1 -1
  186. package/lib/version.js.map +1 -1
  187. package/lib/wrapper.mjs +5 -1
  188. package/package.json +61 -38
  189. package/lib/cli/argv_parser.d.ts +0 -51
  190. package/lib/cli/argv_parser.js.map +0 -1
  191. package/lib/cli/configuration_builder.d.ts +0 -5
  192. package/lib/cli/configuration_builder.js +0 -71
  193. package/lib/cli/configuration_builder.js.map +0 -1
  194. package/lib/cli/option_splitter.d.ts +0 -4
  195. package/lib/cli/option_splitter.js.map +0 -1
  196. package/lib/cli/profile_loader.d.ts +0 -7
  197. package/lib/cli/profile_loader.js +0 -49
  198. package/lib/cli/profile_loader.js.map +0 -1
  199. package/lib/run/formatters.js.map +0 -1
  200. package/lib/run/index.d.ts +0 -2
  201. package/lib/run/index.js +0 -15
  202. package/lib/run/index.js.map +0 -1
  203. package/lib/run/paths.d.ts +0 -6
  204. package/lib/run/paths.js.map +0 -1
  205. package/lib/run/runCucumber.d.ts +0 -3
  206. package/lib/run/runCucumber.js +0 -88
  207. package/lib/run/runCucumber.js.map +0 -1
  208. package/lib/run/runtime.js +0 -58
  209. package/lib/run/runtime.js.map +0 -1
  210. package/lib/run/support.js.map +0 -1
  211. package/lib/run/types.d.ts +0 -12
  212. package/lib/run/types.js.map +0 -1
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadSources = void 0;
4
+ const paths_1 = require("./paths");
5
+ const messages_1 = require("@cucumber/messages");
6
+ const console_1 = require("console");
7
+ const environment_1 = require("./environment");
8
+ const gherkin_1 = require("./gherkin");
9
+ /**
10
+ * Load and parse features, produce a filtered and ordered test plan and/or parse errors.
11
+ *
12
+ * @public
13
+ * @param coordinates - Coordinates required to find features
14
+ * @param environment - Project environment.
15
+ */
16
+ async function loadSources(coordinates, environment = {}) {
17
+ const { cwd, stderr } = (0, environment_1.mergeEnvironment)(environment);
18
+ const logger = new console_1.Console(stderr);
19
+ const newId = messages_1.IdGenerator.uuid();
20
+ const { unexpandedFeaturePaths, featurePaths } = await (0, paths_1.resolvePaths)(cwd, coordinates);
21
+ if (featurePaths.length === 0) {
22
+ return {
23
+ plan: [],
24
+ errors: [],
25
+ };
26
+ }
27
+ const { filteredPickles, parseErrors } = await (0, gherkin_1.getFilteredPicklesAndErrors)({
28
+ newId,
29
+ cwd,
30
+ logger,
31
+ unexpandedFeaturePaths,
32
+ featurePaths,
33
+ coordinates,
34
+ });
35
+ const plan = filteredPickles.map(({ location, pickle }) => ({
36
+ name: pickle.name,
37
+ uri: pickle.uri,
38
+ location,
39
+ }));
40
+ const errors = parseErrors.map(({ source, message }) => {
41
+ return {
42
+ uri: source.uri,
43
+ location: source.location,
44
+ message,
45
+ };
46
+ });
47
+ return {
48
+ plan,
49
+ errors,
50
+ };
51
+ }
52
+ exports.loadSources = loadSources;
53
+ //# sourceMappingURL=load_sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load_sources.js","sourceRoot":"","sources":["../../src/api/load_sources.ts"],"names":[],"mappings":";;;AAOA,mCAAsC;AACtC,iDAAgD;AAChD,qCAAiC;AACjC,+CAAgD;AAChD,uCAAuD;AAEvD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,WAAgC,EAChC,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACrD,MAAM,MAAM,GAAG,IAAI,iBAAO,CAAC,MAAM,CAAC,CAAA;IAClC,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,EAAE,sBAAsB,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,oBAAY,EACjE,GAAG,EACH,WAAW,CACZ,CAAA;IACD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO;YACL,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;SACX,CAAA;KACF;IACD,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,qCAA2B,EAAC;QACzE,KAAK;QACL,GAAG;QACH,MAAM;QACN,sBAAsB;QACtB,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;IACF,MAAM,IAAI,GAAqB,eAAe,CAAC,GAAG,CAChD,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QACzB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ;KACT,CAAC,CACH,CAAA;IACD,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,OAAO;QACL,IAAI;QACJ,MAAM;KACP,CAAA;AACH,CAAC;AA3CD,kCA2CC","sourcesContent":["import {\n ILoadSourcesResult,\n IPlannedPickle,\n IRunEnvironment,\n ISourcesCoordinates,\n ISourcesError,\n} from './types'\nimport { resolvePaths } from './paths'\nimport { IdGenerator } from '@cucumber/messages'\nimport { Console } from 'console'\nimport { mergeEnvironment } from './environment'\nimport { getFilteredPicklesAndErrors } from './gherkin'\n\n/**\n * Load and parse features, produce a filtered and ordered test plan and/or parse errors.\n *\n * @public\n * @param coordinates - Coordinates required to find features\n * @param environment - Project environment.\n */\nexport async function loadSources(\n coordinates: ISourcesCoordinates,\n environment: IRunEnvironment = {}\n): Promise<ILoadSourcesResult> {\n const { cwd, stderr } = mergeEnvironment(environment)\n const logger = new Console(stderr)\n const newId = IdGenerator.uuid()\n const { unexpandedFeaturePaths, featurePaths } = await resolvePaths(\n cwd,\n coordinates\n )\n if (featurePaths.length === 0) {\n return {\n plan: [],\n errors: [],\n }\n }\n const { filteredPickles, parseErrors } = await getFilteredPicklesAndErrors({\n newId,\n cwd,\n logger,\n unexpandedFeaturePaths,\n featurePaths,\n coordinates,\n })\n const plan: IPlannedPickle[] = filteredPickles.map(\n ({ location, pickle }) => ({\n name: pickle.name,\n uri: pickle.uri,\n location,\n })\n )\n const errors: ISourcesError[] = parseErrors.map(({ source, message }) => {\n return {\n uri: source.uri,\n location: source.location,\n message,\n }\n })\n return {\n plan,\n errors,\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { ILoadSupportOptions, IRunEnvironment } from './types';
2
+ import { ISupportCodeLibrary } from '../support_code_library_builder/types';
3
+ /**
4
+ * Load support code for use in test runs.
5
+ *
6
+ * @public
7
+ * @param options - Subset of `IRunnableConfiguration` required to find the support code.
8
+ * @param environment - Project environment.
9
+ */
10
+ export declare function loadSupport(options: ILoadSupportOptions, environment?: IRunEnvironment): Promise<ISupportCodeLibrary>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadSupport = void 0;
4
+ const messages_1 = require("@cucumber/messages");
5
+ const paths_1 = require("./paths");
6
+ const support_1 = require("./support");
7
+ const environment_1 = require("./environment");
8
+ /**
9
+ * Load support code for use in test runs.
10
+ *
11
+ * @public
12
+ * @param options - Subset of `IRunnableConfiguration` required to find the support code.
13
+ * @param environment - Project environment.
14
+ */
15
+ async function loadSupport(options, environment = {}) {
16
+ const { cwd } = (0, environment_1.mergeEnvironment)(environment);
17
+ const newId = messages_1.IdGenerator.uuid();
18
+ const { requirePaths, importPaths } = await (0, paths_1.resolvePaths)(cwd, options.sources, options.support);
19
+ return await (0, support_1.getSupportCodeLibrary)({
20
+ cwd,
21
+ newId,
22
+ requireModules: options.support.requireModules,
23
+ requirePaths,
24
+ importPaths,
25
+ });
26
+ }
27
+ exports.loadSupport = loadSupport;
28
+ //# sourceMappingURL=load_support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAEhD,mCAAsC;AACtC,uCAAiD;AACjD,+CAAgD;AAGhD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IAC7C,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,oBAAY,EACtD,GAAG,EACH,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,OAAO,CAChB,CAAA;IACD,OAAO,MAAM,IAAA,+BAAqB,EAAC;QACjC,GAAG;QACH,KAAK;QACL,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc;QAC9C,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;AACJ,CAAC;AAlBD,kCAkBC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { ILoadSupportOptions, IRunEnvironment } from './types'\nimport { resolvePaths } from './paths'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\n\n/**\n * Load support code for use in test runs.\n *\n * @public\n * @param options - Subset of `IRunnableConfiguration` 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 { cwd } = mergeEnvironment(environment)\n const newId = IdGenerator.uuid()\n const { requirePaths, importPaths } = await resolvePaths(\n cwd,\n options.sources,\n options.support\n )\n return await getSupportCodeLibrary({\n cwd,\n newId,\n requireModules: options.support.requireModules,\n requirePaths,\n importPaths,\n })\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { ISourcesCoordinates, ISupportCodeCoordinates } from './types';
2
+ export declare function resolvePaths(cwd: string, sources: Pick<ISourcesCoordinates, 'paths'>, support?: ISupportCodeCoordinates): Promise<{
3
+ unexpandedFeaturePaths: string[];
4
+ featurePaths: string[];
5
+ requirePaths: string[];
6
+ importPaths: string[];
7
+ }>;
@@ -8,19 +8,19 @@ const util_1 = require("util");
8
8
  const glob_1 = __importDefault(require("glob"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const fs_1 = __importDefault(require("mz/fs"));
11
- async function resolvePaths(cwd, configuration) {
12
- var _a;
13
- const unexpandedFeaturePaths = await getUnexpandedFeaturePaths(cwd, configuration.sources.paths);
11
+ async function resolvePaths(cwd, sources, support = {
12
+ requireModules: [],
13
+ requirePaths: [],
14
+ importPaths: [],
15
+ }) {
16
+ const unexpandedFeaturePaths = await getUnexpandedFeaturePaths(cwd, sources.paths);
14
17
  const featurePaths = await expandFeaturePaths(cwd, unexpandedFeaturePaths);
15
- let unexpandedSupportCodePaths = (_a = configuration.support.paths) !== null && _a !== void 0 ? _a : [];
16
- if (unexpandedSupportCodePaths.length === 0) {
17
- unexpandedSupportCodePaths = getFeatureDirectoryPaths(cwd, featurePaths);
18
- }
19
- const supportCodePaths = await expandPaths(cwd, unexpandedSupportCodePaths, '.@(js|mjs)');
18
+ const { requirePaths, importPaths } = await deriveSupportPaths(cwd, featurePaths, support.requirePaths, support.importPaths);
20
19
  return {
21
20
  unexpandedFeaturePaths,
22
21
  featurePaths,
23
- supportCodePaths,
22
+ requirePaths,
23
+ importPaths,
24
24
  };
25
25
  }
26
26
  exports.resolvePaths = resolvePaths;
@@ -80,4 +80,20 @@ async function expandFeaturePaths(cwd, featurePaths) {
80
80
  featurePaths = [...new Set(featurePaths)]; // Deduplicate the feature files
81
81
  return await expandPaths(cwd, featurePaths, '.feature');
82
82
  }
83
+ async function deriveSupportPaths(cwd, featurePaths, unexpandedRequirePaths, unexpandedImportPaths) {
84
+ if (unexpandedRequirePaths.length === 0 &&
85
+ unexpandedImportPaths.length === 0) {
86
+ const defaultPaths = getFeatureDirectoryPaths(cwd, featurePaths);
87
+ const requirePaths = await expandPaths(cwd, defaultPaths, '.js');
88
+ const importPaths = await expandPaths(cwd, defaultPaths, '.mjs');
89
+ return { requirePaths, importPaths };
90
+ }
91
+ const requirePaths = unexpandedRequirePaths.length > 0
92
+ ? await expandPaths(cwd, unexpandedRequirePaths, '.js')
93
+ : [];
94
+ const importPaths = unexpandedImportPaths.length > 0
95
+ ? await expandPaths(cwd, unexpandedImportPaths, '.@(js|cjs|mjs)')
96
+ : [];
97
+ return { requirePaths, importPaths };
98
+ }
83
99
  //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/api/paths.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAgC;AAChC,gDAAuB;AACvB,gDAAuB;AACvB,+CAAsB;AAGf,KAAK,UAAU,YAAY,CAChC,GAAW,EACX,OAA2C,EAC3C,UAAmC;IACjC,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,EAAE;CAChB;IAOD,MAAM,sBAAsB,GAAG,MAAM,yBAAyB,CAC5D,GAAG,EACH,OAAO,CAAC,KAAK,CACd,CAAA;IACD,MAAM,YAAY,GAAa,MAAM,kBAAkB,CACrD,GAAG,EACH,sBAAsB,CACvB,CAAA;IACD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,kBAAkB,CAC5D,GAAG,EACH,YAAY,EACZ,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,WAAW,CACpB,CAAA;IACD,OAAO;QACL,sBAAsB;QACtB,YAAY;QACZ,YAAY;QACZ,WAAW;KACZ,CAAA;AACH,CAAC;AAlCD,oCAkCC;AAED,KAAK,UAAU,WAAW,CACxB,GAAW,EACX,eAAyB,EACzB,gBAAwB;IAExB,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACrC,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,MAAM,IAAA,gBAAS,EAAC,cAAI,CAAC,CAAC,cAAc,EAAE;YACpD,QAAQ,EAAE,IAAI;YACd,GAAG;SACJ,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,OAAO,C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AM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;AACzD,CAAC;AAED,KAAK,UAAU,kBAAkB,CAC/B,GAAW,EACX,YAAsB,EACtB,sBAAgC,EAChC,qBAA+B;IAK/B,IACE,sBAAsB,CAAC,MAAM,KAAK,CAAC;QACnC,qBAAqB,CAAC,MAAM,KAAK,CAAC,EAClC;QACA,MAAM,YAAY,GAAG,wBAAwB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QAChE,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;QAChE,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;QAChE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAA;KACrC;IACD,MAAM,YAAY,GAChB,sBAAsB,CAAC,MAAM,GAAG,CAAC;QAC/B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,CAAC;QACvD,CAAC,CAAC,EAAE,CAAA;IACR,MAAM,WAAW,GACf,qBAAqB,CAAC,MAAM,GAAG,CAAC;QAC9B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,qBAAqB,EAAE,gBAAgB,CAAC;QACjE,CAAC,CAAC,EAAE,CAAA;IACR,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAA;AACtC,CAAC","sourcesContent":["import { promisify } from 'util'\nimport glob from 'glob'\nimport path from 'path'\nimport fs from 'mz/fs'\nimport { ISourcesCoordinates, ISupportCodeCoordinates } from './types'\n\nexport async function resolvePaths(\n cwd: string,\n sources: Pick<ISourcesCoordinates, 'paths'>,\n support: ISupportCodeCoordinates = {\n requireModules: [],\n requirePaths: [],\n importPaths: [],\n }\n): Promise<{\n unexpandedFeaturePaths: string[]\n featurePaths: string[]\n requirePaths: string[]\n importPaths: string[]\n}> {\n const unexpandedFeaturePaths = await getUnexpandedFeaturePaths(\n cwd,\n sources.paths\n )\n const featurePaths: string[] = await expandFeaturePaths(\n cwd,\n unexpandedFeaturePaths\n )\n const { requirePaths, importPaths } = await deriveSupportPaths(\n cwd,\n featurePaths,\n support.requirePaths,\n support.importPaths\n )\n return {\n unexpandedFeaturePaths,\n featurePaths,\n requirePaths,\n importPaths,\n }\n}\n\nasync function expandPaths(\n cwd: string,\n unexpandedPaths: string[],\n defaultExtension: string\n): Promise<string[]> {\n const expandedPaths = await Promise.all(\n unexpandedPaths.map(async (unexpandedPath) => {\n const matches = await promisify(glob)(unexpandedPath, {\n absolute: true,\n cwd,\n })\n const expanded = await Promise.all(\n matches.map(async (match) => {\n if (path.extname(match) === '') {\n return await promisify(glob)(`${match}/**/*${defaultExtension}`)\n }\n return [match]\n })\n )\n return expanded.flat()\n })\n )\n return expandedPaths.flat().map((x) => path.normalize(x))\n}\n\nasync function getUnexpandedFeaturePaths(\n cwd: string,\n args: string[]\n): Promise<string[]> {\n if (args.length > 0) {\n const nestedFeaturePaths = await Promise.all(\n args.map(async (arg) => {\n const filename = path.basename(arg)\n if (filename[0] === '@') {\n const filePath = path.join(cwd, arg)\n const content = await fs.readFile(filePath, 'utf8')\n return content.split('\\n').map((x) => x.trim())\n }\n return [arg]\n })\n )\n const featurePaths = nestedFeaturePaths.flat()\n if (featurePaths.length > 0) {\n return featurePaths.filter((x) => x !== '')\n }\n }\n return ['features/**/*.{feature,feature.md}']\n}\n\nfunction getFeatureDirectoryPaths(\n cwd: string,\n featurePaths: string[]\n): string[] {\n const featureDirs = featurePaths.map((featurePath) => {\n let featureDir = path.dirname(featurePath)\n let childDir: string\n let parentDir = featureDir\n while (childDir !== parentDir) {\n childDir = parentDir\n parentDir = path.dirname(childDir)\n if (path.basename(parentDir) === 'features') {\n featureDir = parentDir\n break\n }\n }\n return path.relative(cwd, featureDir)\n })\n return [...new Set(featureDirs)]\n}\n\nasync function expandFeaturePaths(\n cwd: string,\n featurePaths: string[]\n): Promise<string[]> {\n featurePaths = featurePaths.map((p) => p.replace(/(:\\d+)*$/g, '')) // Strip line numbers\n featurePaths = [...new Set(featurePaths)] // Deduplicate the feature files\n return await expandPaths(cwd, featurePaths, '.feature')\n}\n\nasync function deriveSupportPaths(\n cwd: string,\n featurePaths: string[],\n unexpandedRequirePaths: string[],\n unexpandedImportPaths: string[]\n): Promise<{\n requirePaths: string[]\n importPaths: string[]\n}> {\n if (\n unexpandedRequirePaths.length === 0 &&\n unexpandedImportPaths.length === 0\n ) {\n const defaultPaths = getFeatureDirectoryPaths(cwd, featurePaths)\n const requirePaths = await expandPaths(cwd, defaultPaths, '.js')\n const importPaths = await expandPaths(cwd, defaultPaths, '.mjs')\n return { requirePaths, importPaths }\n }\n const requirePaths =\n unexpandedRequirePaths.length > 0\n ? await expandPaths(cwd, unexpandedRequirePaths, '.js')\n : []\n const importPaths =\n unexpandedImportPaths.length > 0\n ? await expandPaths(cwd, unexpandedImportPaths, '.@(js|cjs|mjs)')\n : []\n return { requirePaths, importPaths }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { Envelope } from '@cucumber/messages';
2
+ import { IRunOptions, IRunEnvironment, IRunResult } from './types';
3
+ /**
4
+ * Execute a Cucumber test run.
5
+ *
6
+ * @public
7
+ * @param configuration - Configuration loaded from `loadConfiguration`.
8
+ * @param environment - Project environment.
9
+ * @param onMessage - Callback fired each time Cucumber emits a message.
10
+ */
11
+ export declare function runCucumber(configuration: IRunOptions, environment?: IRunEnvironment, onMessage?: (message: Envelope) => void): Promise<IRunResult>;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runCucumber = void 0;
4
+ const messages_1 = require("@cucumber/messages");
5
+ const events_1 = require("events");
6
+ const helpers_1 = require("../formatter/helpers");
7
+ const helpers_2 = require("../cli/helpers");
8
+ const paths_1 = require("./paths");
9
+ const runtime_1 = require("./runtime");
10
+ const formatters_1 = require("./formatters");
11
+ const support_1 = require("./support");
12
+ const console_1 = require("console");
13
+ const environment_1 = require("./environment");
14
+ const gherkin_1 = require("./gherkin");
15
+ /**
16
+ * Execute a Cucumber test run.
17
+ *
18
+ * @public
19
+ * @param configuration - Configuration loaded from `loadConfiguration`.
20
+ * @param environment - Project environment.
21
+ * @param onMessage - Callback fired each time Cucumber emits a message.
22
+ */
23
+ async function runCucumber(configuration, environment = {}, onMessage) {
24
+ const { cwd, stdout, stderr, env } = (0, environment_1.mergeEnvironment)(environment);
25
+ const logger = new console_1.Console(stdout, stderr);
26
+ const newId = messages_1.IdGenerator.uuid();
27
+ const supportCoordinates = 'World' in configuration.support
28
+ ? configuration.support.originalCoordinates
29
+ : configuration.support;
30
+ const { unexpandedFeaturePaths, featurePaths, requirePaths, importPaths } = await (0, paths_1.resolvePaths)(cwd, configuration.sources, supportCoordinates);
31
+ const supportCodeLibrary = 'World' in configuration.support
32
+ ? configuration.support
33
+ : await (0, support_1.getSupportCodeLibrary)({
34
+ cwd,
35
+ newId,
36
+ requirePaths,
37
+ importPaths,
38
+ requireModules: supportCoordinates.requireModules,
39
+ });
40
+ const eventBroadcaster = new events_1.EventEmitter();
41
+ if (onMessage) {
42
+ eventBroadcaster.on('envelope', onMessage);
43
+ }
44
+ const eventDataCollector = new helpers_1.EventDataCollector(eventBroadcaster);
45
+ let formatterStreamError = false;
46
+ const cleanup = await (0, formatters_1.initializeFormatters)({
47
+ cwd,
48
+ stdout,
49
+ logger,
50
+ onStreamError: () => (formatterStreamError = true),
51
+ eventBroadcaster,
52
+ eventDataCollector,
53
+ configuration: configuration.formats,
54
+ supportCodeLibrary,
55
+ });
56
+ await (0, helpers_2.emitMetaMessage)(eventBroadcaster, env);
57
+ let pickleIds = [];
58
+ let parseErrors = [];
59
+ if (featurePaths.length > 0) {
60
+ const gherkinResult = await (0, gherkin_1.getFilteredPicklesAndErrors)({
61
+ newId,
62
+ cwd,
63
+ logger,
64
+ unexpandedFeaturePaths,
65
+ featurePaths,
66
+ coordinates: configuration.sources,
67
+ onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),
68
+ });
69
+ pickleIds = gherkinResult.filteredPickles.map(({ pickle }) => pickle.id);
70
+ parseErrors = gherkinResult.parseErrors;
71
+ }
72
+ if (parseErrors.length) {
73
+ parseErrors.forEach((parseError) => {
74
+ logger.error(`Parse error in "${parseError.source.uri}" ${parseError.message}`);
75
+ });
76
+ await cleanup();
77
+ return {
78
+ success: false,
79
+ support: supportCodeLibrary,
80
+ };
81
+ }
82
+ (0, helpers_2.emitSupportCodeMessages)({
83
+ eventBroadcaster,
84
+ supportCodeLibrary,
85
+ newId,
86
+ });
87
+ const runtime = (0, runtime_1.makeRuntime)({
88
+ cwd,
89
+ logger,
90
+ eventBroadcaster,
91
+ eventDataCollector,
92
+ pickleIds,
93
+ newId,
94
+ supportCodeLibrary,
95
+ requireModules: supportCoordinates.requireModules,
96
+ requirePaths,
97
+ importPaths,
98
+ options: configuration.runtime,
99
+ });
100
+ const success = await runtime.start();
101
+ await cleanup();
102
+ return {
103
+ success: success && !formatterStreamError,
104
+ support: supportCodeLibrary,
105
+ };
106
+ }
107
+ exports.runCucumber = runCucumber;
108
+ //# sourceMappingURL=run_cucumber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;;AAAA,iDAAsE;AACtE,mCAAqC;AACrC,kDAAyD;AACzD,4CAAyE;AAEzE,mCAAsC;AACtC,uCAAuC;AACvC,6CAAmD;AACnD,uCAAiD;AACjD,qCAAiC;AACjC,+CAAgD;AAChD,uCAAuD;AAEvD;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAC/B,aAA0B,EAC1B,cAA+B,EAAE,EACjC,SAAuC;IAEvC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IAClE,MAAM,MAAM,GAAG,IAA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M,OAAO,CAAC,KAAK,EAAE,CAAA;IACrC,MAAM,OAAO,EAAE,CAAA;IAEf,OAAO;QACL,OAAO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC5B,CAAA;AACH,CAAC;AArGD,kCAqGC","sourcesContent":["import { Envelope, IdGenerator, ParseError } from '@cucumber/messages'\nimport { EventEmitter } from 'events'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { emitMetaMessage, emitSupportCodeMessages } from '../cli/helpers'\nimport { IRunOptions, IRunEnvironment, IRunResult } from './types'\nimport { resolvePaths } from './paths'\nimport { makeRuntime } from './runtime'\nimport { initializeFormatters } from './formatters'\nimport { getSupportCodeLibrary } from './support'\nimport { Console } from 'console'\nimport { mergeEnvironment } from './environment'\nimport { getFilteredPicklesAndErrors } from './gherkin'\n\n/**\n * Execute a Cucumber test run.\n *\n * @public\n * @param configuration - Configuration loaded from `loadConfiguration`.\n * @param environment - Project environment.\n * @param onMessage - Callback fired each time Cucumber emits a message.\n */\nexport async function runCucumber(\n configuration: IRunOptions,\n environment: IRunEnvironment = {},\n onMessage?: (message: Envelope) => void\n): Promise<IRunResult> {\n const { cwd, stdout, stderr, env } = mergeEnvironment(environment)\n const logger = new Console(stdout, stderr)\n const newId = IdGenerator.uuid()\n\n const supportCoordinates =\n 'World' in configuration.support\n ? configuration.support.originalCoordinates\n : configuration.support\n\n const { unexpandedFeaturePaths, featurePaths, requirePaths, importPaths } =\n await resolvePaths(cwd, configuration.sources, supportCoordinates)\n\n const supportCodeLibrary =\n 'World' in configuration.support\n ? configuration.support\n : await getSupportCodeLibrary({\n cwd,\n newId,\n requirePaths,\n importPaths,\n requireModules: supportCoordinates.requireModules,\n })\n\n const eventBroadcaster = new EventEmitter()\n if (onMessage) {\n eventBroadcaster.on('envelope', onMessage)\n }\n const eventDataCollector = new EventDataCollector(eventBroadcaster)\n\n let formatterStreamError = false\n const cleanup = await initializeFormatters({\n cwd,\n stdout,\n logger,\n onStreamError: () => (formatterStreamError = true),\n eventBroadcaster,\n eventDataCollector,\n configuration: configuration.formats,\n supportCodeLibrary,\n })\n await emitMetaMessage(eventBroadcaster, env)\n\n let pickleIds: string[] = []\n let parseErrors: ParseError[] = []\n if (featurePaths.length > 0) {\n const gherkinResult = await getFilteredPicklesAndErrors({\n newId,\n cwd,\n logger,\n unexpandedFeaturePaths,\n featurePaths,\n coordinates: configuration.sources,\n onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),\n })\n pickleIds = gherkinResult.filteredPickles.map(({ pickle }) => pickle.id)\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 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 = makeRuntime({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n newId,\n supportCodeLibrary,\n requireModules: supportCoordinates.requireModules,\n requirePaths,\n importPaths,\n options: configuration.runtime,\n })\n const success = await runtime.start()\n await cleanup()\n\n return {\n success: success && !formatterStreamError,\n support: supportCodeLibrary,\n }\n}\n"]}
@@ -1,19 +1,20 @@
1
1
  /// <reference types="node" />
2
- import { IRuntime, IRuntimeOptions } from '../runtime';
2
+ import { IRuntime } from '../runtime';
3
3
  import { EventEmitter } from 'events';
4
4
  import { EventDataCollector } from '../formatter/helpers';
5
5
  import { IdGenerator } from '@cucumber/messages';
6
6
  import { ISupportCodeLibrary } from '../support_code_library_builder/types';
7
- export declare function makeRuntime({ cwd, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, supportCodePaths, supportCodeRequiredModules, options: { parallel, ...runtimeOptions }, }: {
7
+ import { IRunOptionsRuntime } from './types';
8
+ export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options }, }: {
8
9
  cwd: string;
10
+ logger: Console;
9
11
  eventBroadcaster: EventEmitter;
10
12
  eventDataCollector: EventDataCollector;
11
13
  newId: IdGenerator.NewId;
12
14
  pickleIds: string[];
13
15
  supportCodeLibrary: ISupportCodeLibrary;
14
- supportCodePaths: string[];
15
- supportCodeRequiredModules: string[];
16
- options: Partial<IRuntimeOptions> & {
17
- parallel?: number;
18
- };
16
+ requireModules: string[];
17
+ requirePaths: string[];
18
+ importPaths: string[];
19
+ options: IRunOptionsRuntime;
19
20
  }): IRuntime;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.makeRuntime = void 0;
7
+ const runtime_1 = __importDefault(require("../runtime"));
8
+ const coordinator_1 = __importDefault(require("../runtime/parallel/coordinator"));
9
+ function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options }, }) {
10
+ if (parallel > 0) {
11
+ return new coordinator_1.default({
12
+ cwd,
13
+ logger,
14
+ eventBroadcaster,
15
+ eventDataCollector,
16
+ pickleIds,
17
+ options,
18
+ newId,
19
+ supportCodeLibrary,
20
+ requireModules,
21
+ requirePaths,
22
+ importPaths,
23
+ numberOfWorkers: parallel,
24
+ });
25
+ }
26
+ return new runtime_1.default({
27
+ eventBroadcaster,
28
+ eventDataCollector,
29
+ newId,
30
+ pickleIds,
31
+ supportCodeLibrary,
32
+ options,
33
+ });
34
+ }
35
+ exports.makeRuntime = makeRuntime;
36
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/api/runtime.ts"],"names":[],"mappings":";;;;;;AAAA,yDAA8C;AAK9C,kFAAyD;AAGzD,SAAgB,WAAW,CAAC,EAC1B,GAAG,EACH,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,KAAK,EACL,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAalC;IACC,IAAI,QAAQ,GAAG,CAAC,EAAE;QAChB,OAAO,IAAI,qBAAW,CAAC;YACrB,GAAG;YACH,MAAM;YACN,gBAAgB;YAChB,kBAAkB;YAClB,SAAS;YACT,OAAO;YACP,KAAK;YACL,kBAAkB;YAClB,cAAc;YACd,YAAY;YACZ,WAAW;YACX,eAAe,EAAE,QAAQ;SAC1B,CAAC,CAAA;KACH;IACD,OAAO,IAAI,iBAAO,CAAC;QACjB,gBAAgB;QAChB,kBAAkB;QAClB,KAAK;QACL,SAAS;QACT,kBAAkB;QAClB,OAAO;KACR,CAAC,CAAA;AACJ,CAAC;AAjDD,kCAiDC","sourcesContent":["import Runtime, { IRuntime } from '../runtime'\nimport { EventEmitter } from 'events'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport Coordinator from '../runtime/parallel/coordinator'\nimport { IRunOptionsRuntime } from './types'\n\nexport function makeRuntime({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n newId,\n supportCodeLibrary,\n requireModules,\n requirePaths,\n importPaths,\n options: { parallel, ...options },\n}: {\n cwd: string\n logger: Console\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n newId: IdGenerator.NewId\n pickleIds: string[]\n supportCodeLibrary: ISupportCodeLibrary\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n options: IRunOptionsRuntime\n}): IRuntime {\n if (parallel > 0) {\n return new Coordinator({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n options,\n newId,\n supportCodeLibrary,\n requireModules,\n requirePaths,\n importPaths,\n numberOfWorkers: parallel,\n })\n }\n return new Runtime({\n eventBroadcaster,\n eventDataCollector,\n newId,\n pickleIds,\n supportCodeLibrary,\n options,\n })\n}\n"]}
@@ -1,8 +1,9 @@
1
1
  import { IdGenerator } from '@cucumber/messages';
2
2
  import { ISupportCodeLibrary } from '../support_code_library_builder/types';
3
- export declare function getSupportCodeLibrary({ cwd, newId, supportCodeRequiredModules, supportCodePaths, }: {
3
+ export declare function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths, importPaths, }: {
4
4
  cwd: string;
5
5
  newId: IdGenerator.NewId;
6
- supportCodeRequiredModules: string[];
7
- supportCodePaths: string[];
6
+ requireModules: string[];
7
+ requirePaths: string[];
8
+ importPaths: string[];
8
9
  }): Promise<ISupportCodeLibrary>;
@@ -6,19 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getSupportCodeLibrary = void 0;
7
7
  const support_code_library_builder_1 = __importDefault(require("../support_code_library_builder"));
8
8
  const url_1 = require("url");
9
- const helpers_1 = require("../cli/helpers");
10
9
  // eslint-disable-next-line @typescript-eslint/no-var-requires
11
10
  const { importer } = require('../importer');
12
- async function getSupportCodeLibrary({ cwd, newId, supportCodeRequiredModules, supportCodePaths, }) {
11
+ async function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths, importPaths, }) {
13
12
  support_code_library_builder_1.default.reset(cwd, newId);
14
- supportCodeRequiredModules.map((module) => require(module));
15
- for (const codePath of supportCodePaths) {
16
- if (supportCodeRequiredModules.length || !(0, helpers_1.isJavaScript)(codePath)) {
17
- require(codePath);
18
- }
19
- else {
20
- await importer((0, url_1.pathToFileURL)(codePath));
21
- }
13
+ requireModules.map((module) => require(module));
14
+ requirePaths.map((path) => require(path));
15
+ for (const path of importPaths) {
16
+ await importer((0, url_1.pathToFileURL)(path));
22
17
  }
23
18
  return support_code_library_builder_1.default.finalize();
24
19
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAEA,mGAAuE;AACvE,6BAAmC;AAEnC,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AAEpC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,GAOZ;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC3C,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IAC/C,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IACzC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,QAAQ,CAAC,IAAA,mBAAa,EAAC,IAAI,CAAC,CAAC,CAAA;KACpC;IACD,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AApBD,sDAoBC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport supportCodeLibraryBuilder from '../support_code_library_builder'\nimport { pathToFileURL } from 'url'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../importer')\n\nexport async function getSupportCodeLibrary({\n cwd,\n newId,\n requireModules,\n requirePaths,\n importPaths,\n}: {\n cwd: string\n newId: IdGenerator.NewId\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n}): Promise<ISupportCodeLibrary> {\n supportCodeLibraryBuilder.reset(cwd, newId)\n requireModules.map((module) => require(module))\n requirePaths.map((path) => require(path))\n for (const path of importPaths) {\n await importer(pathToFileURL(path))\n }\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
@@ -0,0 +1,168 @@
1
+ /// <reference types="node" />
2
+ import { ISupportCodeLibrary } from '../support_code_library_builder/types';
3
+ import { FormatOptions, IFormatterStream } from '../formatter';
4
+ import { PickleOrder } from '../models/pickle_order';
5
+ import { IRuntimeOptions } from '../runtime';
6
+ import { IConfiguration } from '../configuration';
7
+ /**
8
+ * @public
9
+ */
10
+ export interface ILoadConfigurationOptions {
11
+ /**
12
+ * Path to load configuration file from (defaults to `cucumber.(js|cjs|mjs|json)` if omitted).
13
+ */
14
+ file?: string;
15
+ /**
16
+ * Zero or more profile names from which to source configuration (if omitted or empty, the `default` profile will be used).
17
+ */
18
+ profiles?: string[];
19
+ /**
20
+ * Ad-hoc configuration options to be applied over the top of whatever is loaded from the configuration file/profiles.
21
+ */
22
+ provided?: Partial<IConfiguration>;
23
+ }
24
+ /**
25
+ * @public
26
+ */
27
+ export interface IResolvedConfiguration {
28
+ /**
29
+ * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.
30
+ */
31
+ useConfiguration: IConfiguration;
32
+ /**
33
+ * The format that can be passed into `runCucumber`.
34
+ */
35
+ runConfiguration: IRunConfiguration;
36
+ }
37
+ /**
38
+ * @public
39
+ */
40
+ export interface ISourcesCoordinates {
41
+ defaultDialect: string;
42
+ paths: string[];
43
+ names: string[];
44
+ tagExpression: string;
45
+ order: PickleOrder;
46
+ }
47
+ /**
48
+ * @public
49
+ */
50
+ export interface IPlannedPickle {
51
+ name: string;
52
+ uri: string;
53
+ location: {
54
+ line: number;
55
+ column?: number;
56
+ };
57
+ }
58
+ /**
59
+ * @public
60
+ */
61
+ export interface ISourcesError {
62
+ uri: string;
63
+ location: {
64
+ line: number;
65
+ column?: number;
66
+ };
67
+ message: string;
68
+ }
69
+ /**
70
+ * @public
71
+ */
72
+ export interface ILoadSourcesResult {
73
+ plan: IPlannedPickle[];
74
+ errors: ISourcesError[];
75
+ }
76
+ /**
77
+ * @public
78
+ */
79
+ export interface ISupportCodeCoordinates {
80
+ requireModules: string[];
81
+ requirePaths: string[];
82
+ importPaths: string[];
83
+ }
84
+ /**
85
+ * @public
86
+ */
87
+ export interface ILoadSupportOptions {
88
+ sources: ISourcesCoordinates;
89
+ support: ISupportCodeCoordinates;
90
+ }
91
+ /**
92
+ * @public
93
+ */
94
+ export interface IRunOptionsRuntime extends IRuntimeOptions {
95
+ parallel: number;
96
+ }
97
+ /**
98
+ * @public
99
+ */
100
+ export interface IRunOptionsFormats {
101
+ stdout: string;
102
+ files: Record<string, string>;
103
+ publish: {
104
+ url?: string;
105
+ token?: string;
106
+ } | false;
107
+ options: FormatOptions;
108
+ }
109
+ /**
110
+ * @public
111
+ */
112
+ export interface IRunConfiguration {
113
+ sources: ISourcesCoordinates;
114
+ support: ISupportCodeCoordinates;
115
+ runtime: IRunOptionsRuntime;
116
+ formats: IRunOptionsFormats;
117
+ }
118
+ /**
119
+ * @public
120
+ */
121
+ export declare type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
122
+ /**
123
+ * @public
124
+ */
125
+ export interface IRunOptions {
126
+ sources: ISourcesCoordinates;
127
+ support: ISupportCodeCoordinatesOrLibrary;
128
+ runtime: IRunOptionsRuntime;
129
+ formats: IRunOptionsFormats;
130
+ }
131
+ /**
132
+ * Contextual data about the project environment.
133
+ *
134
+ * @public
135
+ */
136
+ export interface IRunEnvironment {
137
+ /**
138
+ * Working directory for the project (defaults to `process.cwd()` if omitted).
139
+ */
140
+ cwd?: string;
141
+ /**
142
+ * Writable stream where the test run's main output is written (defaults to `process.stdout` if omitted).
143
+ */
144
+ stdout?: IFormatterStream;
145
+ /**
146
+ * Writable stream where the test run's warning/error output is written (defaults to `process.stderr` if omitted).
147
+ */
148
+ stderr?: IFormatterStream;
149
+ /**
150
+ * Environment variables (defaults to `process.env` if omitted).
151
+ */
152
+ env?: NodeJS.ProcessEnv;
153
+ }
154
+ /**
155
+ * Result of a Cucumber test run.
156
+ *
157
+ * @public
158
+ */
159
+ export interface IRunResult {
160
+ /**
161
+ * Whether the test run was overall successful i.e. no failed scenarios. The exact meaning can vary based on the `strict` configuration option.
162
+ */
163
+ success: boolean;
164
+ /**
165
+ * The support code library that was used in the test run; can be reused in subsequent `runCucumber` calls.
166
+ */
167
+ support: ISupportCodeLibrary;
168
+ }
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { FormatOptions, IFormatterStream } from '../formatter'\nimport { PickleOrder } from '../models/pickle_order'\nimport { IRuntimeOptions } from '../runtime'\nimport { IConfiguration } from '../configuration'\n\n/**\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from (defaults to `cucumber.(js|cjs|mjs|json)` if omitted).\n */\n file?: string\n /**\n * Zero or more profile names from which to source configuration (if omitted or empty, the `default` profile will be used).\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be applied over the top of whatever is loaded from the configuration file/profiles.\n */\n provided?: Partial<IConfiguration>\n}\n\n/**\n * @public\n */\nexport interface IResolvedConfiguration {\n /**\n * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.\n */\n useConfiguration: IConfiguration\n /**\n * The format that can be passed into `runCucumber`.\n */\n runConfiguration: IRunConfiguration\n}\n\n/**\n * @public\n */\nexport interface ISourcesCoordinates {\n defaultDialect: string\n paths: string[]\n names: string[]\n tagExpression: string\n order: PickleOrder\n}\n\n/**\n * @public\n */\nexport interface IPlannedPickle {\n name: string\n uri: string\n location: {\n line: number\n column?: number\n }\n}\n\n/**\n * @public\n */\nexport interface ISourcesError {\n uri: string\n location: {\n line: number\n column?: number\n }\n message: string\n}\n\n/**\n * @public\n */\nexport interface ILoadSourcesResult {\n plan: IPlannedPickle[]\n errors: ISourcesError[]\n}\n\n/**\n * @public\n */\nexport interface ISupportCodeCoordinates {\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n}\n\n/**\n * @public\n */\nexport interface ILoadSupportOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates\n}\n\n/**\n * @public\n */\nexport interface IRunOptionsRuntime extends IRuntimeOptions {\n parallel: number\n}\n\n/**\n * @public\n */\nexport interface IRunOptionsFormats {\n stdout: string\n files: Record<string, string>\n publish:\n | {\n url?: string\n token?: string\n }\n | false\n options: FormatOptions\n}\n\n/**\n * @public\n */\nexport interface IRunConfiguration {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * @public\n */\nexport type ISupportCodeCoordinatesOrLibrary =\n | ISupportCodeCoordinates\n | ISupportCodeLibrary\n\n/**\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 *\n * @public\n */\nexport interface IRunEnvironment {\n /**\n * Working directory for the project (defaults to `process.cwd()` if omitted).\n */\n cwd?: string\n /**\n * Writable stream where the test run's main output is written (defaults to `process.stdout` if omitted).\n */\n stdout?: IFormatterStream\n /**\n * Writable stream where the test run's warning/error output is written (defaults to `process.stderr` if omitted).\n */\n stderr?: IFormatterStream\n /**\n * Environment variables (defaults to `process.env` if omitted).\n */\n env?: NodeJS.ProcessEnv\n}\n\n/**\n * Result of a Cucumber test run.\n *\n * @public\n */\nexport interface IRunResult {\n /**\n * Whether the test run was overall successful i.e. no failed scenarios. 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; can be reused in subsequent `runCucumber` calls.\n */\n support: ISupportCodeLibrary\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import api from './index.js'
2
+
3
+ export const loadConfiguration = api.loadConfiguration
4
+ export const loadSupport = api.loadSupport
5
+ export const loadSources = api.loadSources
6
+ export const runCucumber = api.runCucumber