@lynxwall/cucumber-tsflow 6.5.6 → 7.0.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 (214) hide show
  1. package/README.md +22 -12
  2. package/api/index.d.ts +6 -0
  3. package/bin/cucumber-tsflow +3 -3
  4. package/bin/cucumber-tsflow.js +3 -0
  5. package/lib/api/index.d.ts +17 -0
  6. package/lib/api/index.js +30 -0
  7. package/lib/api/index.js.map +1 -0
  8. package/lib/api/load-configuration.d.ts +21 -0
  9. package/lib/api/load-configuration.js +127 -0
  10. package/lib/api/load-configuration.js.map +1 -0
  11. package/lib/api/load-support.d.ts +10 -0
  12. package/lib/api/load-support.js +48 -0
  13. package/lib/api/load-support.js.map +1 -0
  14. package/lib/api/run-cucumber.d.ts +16 -0
  15. package/lib/api/run-cucumber.js +151 -0
  16. package/lib/api/run-cucumber.js.map +1 -0
  17. package/lib/api/wrapper.mjs +6 -0
  18. package/lib/behave.js +18 -8
  19. package/lib/behave.js.map +1 -0
  20. package/lib/bindings/binding-context.d.ts +17 -0
  21. package/lib/bindings/binding-context.js +36 -0
  22. package/lib/bindings/binding-context.js.map +1 -0
  23. package/lib/{cucumber → bindings}/binding-decorator.d.ts +2 -2
  24. package/lib/bindings/binding-decorator.js +201 -0
  25. package/lib/bindings/binding-decorator.js.map +1 -0
  26. package/lib/{cucumber → bindings}/binding-registry.d.ts +8 -8
  27. package/lib/bindings/binding-registry.js +232 -0
  28. package/lib/bindings/binding-registry.js.map +1 -0
  29. package/lib/{cucumber → bindings}/hook-decorators.d.ts +6 -6
  30. package/lib/{cucumber → bindings}/hook-decorators.js +17 -15
  31. package/lib/bindings/hook-decorators.js.map +1 -0
  32. package/lib/{cucumber/step-definition-decorators.d.ts → bindings/step-decorators.d.ts} +3 -3
  33. package/lib/bindings/step-decorators.js +97 -0
  34. package/lib/bindings/step-decorators.js.map +1 -0
  35. package/lib/cli/argv-parser.js +3 -3
  36. package/lib/cli/argv-parser.js.map +1 -0
  37. package/lib/cli/index.d.ts +1 -2
  38. package/lib/cli/index.js +12 -40
  39. package/lib/cli/index.js.map +1 -0
  40. package/lib/cli/load-configuration.d.ts +2 -1
  41. package/lib/cli/load-configuration.js +12 -10
  42. package/lib/cli/load-configuration.js.map +1 -0
  43. package/lib/cli/run.js +5 -7
  44. package/lib/cli/run.js.map +1 -0
  45. package/lib/cucumber/coordinator.d.ts +15 -0
  46. package/lib/cucumber/coordinator.js +40 -0
  47. package/lib/cucumber/coordinator.js.map +1 -0
  48. package/lib/cucumber/make-runtime.d.ts +12 -16
  49. package/lib/cucumber/make-runtime.js +10 -33
  50. package/lib/cucumber/make-runtime.js.map +1 -0
  51. package/lib/cucumber/managed-scenario-context.d.ts +3 -3
  52. package/lib/cucumber/managed-scenario-context.js +24 -24
  53. package/lib/cucumber/managed-scenario-context.js.map +1 -0
  54. package/lib/cucumber/message-collector.d.ts +3 -0
  55. package/lib/cucumber/message-collector.js +38 -16
  56. package/lib/cucumber/message-collector.js.map +1 -0
  57. package/lib/cucumber/parallel/adapter.d.ts +46 -0
  58. package/lib/cucumber/parallel/adapter.js +156 -0
  59. package/lib/cucumber/parallel/adapter.js.map +1 -0
  60. package/lib/cucumber/parallel/run-worker.d.ts +1 -1
  61. package/lib/cucumber/parallel/run-worker.js +8 -16
  62. package/lib/cucumber/parallel/run-worker.js.map +1 -0
  63. package/lib/cucumber/parallel/worker.d.ts +10 -14
  64. package/lib/cucumber/parallel/worker.js +59 -68
  65. package/lib/cucumber/parallel/worker.js.map +1 -0
  66. package/lib/cucumber/run-cucumber.d.ts +5 -3
  67. package/lib/cucumber/run-cucumber.js +59 -38
  68. package/lib/cucumber/run-cucumber.js.map +1 -0
  69. package/lib/cucumber/serial/adapter.d.ts +12 -0
  70. package/lib/cucumber/serial/adapter.js +24 -0
  71. package/lib/cucumber/serial/adapter.js.map +1 -0
  72. package/lib/cucumber/test-case-info.js +1 -1
  73. package/lib/cucumber/test-case-info.js.map +1 -0
  74. package/lib/cucumber/test-case-runner.d.ts +2 -2
  75. package/lib/cucumber/test-case-runner.js +47 -19
  76. package/lib/cucumber/test-case-runner.js.map +1 -0
  77. package/lib/cucumber/utils.js +1 -1
  78. package/lib/cucumber/utils.js.map +1 -0
  79. package/lib/cucumber/worker.d.ts +17 -0
  80. package/lib/cucumber/worker.js +57 -0
  81. package/lib/cucumber/worker.js.map +1 -0
  82. package/lib/esnode.d.ts +1 -0
  83. package/lib/esnode.js +5 -7
  84. package/lib/esnode.js.map +1 -0
  85. package/lib/esvue.js +3 -6
  86. package/lib/esvue.js.map +1 -0
  87. package/lib/formatters/behave-json-formatter.js +18 -8
  88. package/lib/formatters/behave-json-formatter.js.map +1 -0
  89. package/lib/formatters/junit-bamboo-formatter.js +2 -2
  90. package/lib/formatters/junit-bamboo-formatter.js.map +1 -0
  91. package/lib/formatters/tsflow-snippet-syntax.js +2 -3
  92. package/lib/formatters/tsflow-snippet-syntax.js.map +1 -0
  93. package/lib/gherkin/configuration.d.ts +4 -4
  94. package/lib/gherkin/configuration.js +1 -1
  95. package/lib/gherkin/configuration.js.map +1 -0
  96. package/lib/gherkin/gherkin-feature.js +18 -8
  97. package/lib/gherkin/gherkin-feature.js.map +1 -0
  98. package/lib/gherkin/gherkin-manager.js +2 -2
  99. package/lib/gherkin/gherkin-manager.js.map +1 -0
  100. package/lib/gherkin/models.d.ts +1 -1
  101. package/lib/gherkin/models.js +1 -1
  102. package/lib/gherkin/models.js.map +1 -0
  103. package/lib/index.d.ts +6 -3
  104. package/lib/index.js +30 -18
  105. package/lib/index.js.map +1 -0
  106. package/lib/junitbamboo.js +18 -8
  107. package/lib/junitbamboo.js.map +1 -0
  108. package/lib/runtime/coordinator.d.ts +15 -0
  109. package/lib/runtime/coordinator.js +40 -0
  110. package/lib/runtime/coordinator.js.map +1 -0
  111. package/lib/runtime/make-runtime.d.ts +22 -0
  112. package/lib/runtime/make-runtime.js +17 -0
  113. package/lib/runtime/make-runtime.js.map +1 -0
  114. package/lib/runtime/managed-scenario-context.d.ts +52 -0
  115. package/lib/runtime/managed-scenario-context.js +149 -0
  116. package/lib/runtime/managed-scenario-context.js.map +1 -0
  117. package/lib/runtime/message-collector.d.ts +98 -0
  118. package/lib/runtime/message-collector.js +284 -0
  119. package/lib/runtime/message-collector.js.map +1 -0
  120. package/lib/runtime/parallel/adapter.d.ts +47 -0
  121. package/lib/runtime/parallel/adapter.js +159 -0
  122. package/lib/runtime/parallel/adapter.js.map +1 -0
  123. package/lib/runtime/parallel/run-worker.d.ts +1 -0
  124. package/lib/runtime/parallel/run-worker.js +24 -0
  125. package/lib/runtime/parallel/run-worker.js.map +1 -0
  126. package/lib/runtime/parallel/types.d.ts +13 -0
  127. package/lib/runtime/parallel/types.js +3 -0
  128. package/lib/runtime/parallel/types.js.map +1 -0
  129. package/lib/runtime/parallel/worker.d.ts +44 -0
  130. package/lib/runtime/parallel/worker.js +118 -0
  131. package/lib/runtime/parallel/worker.js.map +1 -0
  132. package/lib/runtime/serial/adapter.d.ts +12 -0
  133. package/lib/runtime/serial/adapter.js +24 -0
  134. package/lib/runtime/serial/adapter.js.map +1 -0
  135. package/lib/runtime/test-case-info.d.ts +23 -0
  136. package/lib/runtime/test-case-info.js +3 -0
  137. package/lib/runtime/test-case-info.js.map +1 -0
  138. package/lib/runtime/test-case-runner.d.ts +48 -0
  139. package/lib/runtime/test-case-runner.js +359 -0
  140. package/lib/runtime/test-case-runner.js.map +1 -0
  141. package/lib/runtime/utils.d.ts +16 -0
  142. package/lib/runtime/utils.js +78 -0
  143. package/lib/runtime/utils.js.map +1 -0
  144. package/lib/runtime/worker.d.ts +17 -0
  145. package/lib/runtime/worker.js +57 -0
  146. package/lib/runtime/worker.js.map +1 -0
  147. package/lib/snippet.js +20 -10
  148. package/lib/snippet.js.map +1 -0
  149. package/lib/transpilers/esbuild-transpiler.d.ts +1 -1
  150. package/lib/transpilers/esbuild-transpiler.js +1 -1
  151. package/lib/transpilers/esbuild-transpiler.js.map +1 -0
  152. package/lib/transpilers/esbuild.js +4 -4
  153. package/lib/transpilers/esbuild.js.map +1 -0
  154. package/lib/transpilers/vue-sfc/compiler.js +1 -1
  155. package/lib/transpilers/vue-sfc/compiler.js.map +1 -0
  156. package/lib/transpilers/vue-sfc/index.d.ts +4 -4
  157. package/lib/transpilers/vue-sfc/index.js +1 -2
  158. package/lib/transpilers/vue-sfc/index.js.map +1 -0
  159. package/lib/transpilers/vue-sfc/main.d.ts +1 -1
  160. package/lib/transpilers/vue-sfc/main.js +1 -1
  161. package/lib/transpilers/vue-sfc/main.js.map +1 -0
  162. package/lib/transpilers/vue-sfc/script.js +1 -2
  163. package/lib/transpilers/vue-sfc/script.js.map +1 -0
  164. package/lib/transpilers/vue-sfc/template.d.ts +1 -1
  165. package/lib/transpilers/vue-sfc/template.js +2 -3
  166. package/lib/transpilers/vue-sfc/template.js.map +1 -0
  167. package/lib/transpilers/vue-sfc/types.d.ts +2 -2
  168. package/lib/transpilers/vue-sfc/types.js +1 -1
  169. package/lib/transpilers/vue-sfc/types.js.map +1 -0
  170. package/lib/transpilers/vue-sfc/utils/descriptorCache.js +1 -1
  171. package/lib/transpilers/vue-sfc/utils/descriptorCache.js.map +1 -0
  172. package/lib/transpilers/vue-sfc/utils/error.js +1 -1
  173. package/lib/transpilers/vue-sfc/utils/error.js.map +1 -0
  174. package/lib/transpilers/vue-sfc/utils/query.js +1 -1
  175. package/lib/transpilers/vue-sfc/utils/query.js.map +1 -0
  176. package/lib/tsconfig.node.tsbuildinfo +1 -0
  177. package/lib/tsnode.d.ts +1 -0
  178. package/lib/tsnode.js +4 -6
  179. package/lib/tsnode.js.map +1 -0
  180. package/lib/tsvue.js +3 -6
  181. package/lib/tsvue.js.map +1 -0
  182. package/lib/types/parallel.d.ts +11 -0
  183. package/lib/types/parallel.js +3 -0
  184. package/lib/types/parallel.js.map +1 -0
  185. package/lib/types/scenario-context.js +1 -1
  186. package/lib/types/scenario-context.js.map +1 -0
  187. package/lib/types/scenario-info.js +1 -1
  188. package/lib/types/scenario-info.js.map +1 -0
  189. package/lib/types/step-binding-flags.js +1 -1
  190. package/lib/types/step-binding-flags.js.map +1 -0
  191. package/lib/types/step-binding.d.ts +30 -20
  192. package/lib/types/step-binding.js +1 -1
  193. package/lib/types/step-binding.js.map +1 -0
  194. package/lib/types/types.js +1 -1
  195. package/lib/types/types.js.map +1 -0
  196. package/lib/utils/helpers.js +1 -1
  197. package/lib/utils/helpers.js.map +1 -0
  198. package/lib/utils/logger.d.ts +2 -2
  199. package/lib/utils/logger.js +7 -26
  200. package/lib/utils/logger.js.map +1 -0
  201. package/lib/utils/our-callsite.js +18 -8
  202. package/lib/utils/our-callsite.js.map +1 -0
  203. package/lib/version.d.ts +1 -1
  204. package/lib/version.js +2 -2
  205. package/lib/version.js.map +1 -0
  206. package/lib/wrapper.mjs +21 -0
  207. package/package.json +68 -27
  208. package/lib/cucumber/binding-decorator.js +0 -181
  209. package/lib/cucumber/binding-registry.js +0 -231
  210. package/lib/cucumber/parallel/coordinator.d.ts +0 -79
  211. package/lib/cucumber/parallel/coordinator.js +0 -247
  212. package/lib/cucumber/runtime.d.ts +0 -40
  213. package/lib/cucumber/runtime.js +0 -85
  214. package/lib/cucumber/step-definition-decorators.js +0 -92
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # cucumber-tsflow
4
4
 
5
- Provides 'specflow' like bindings for CucumberJS 9.6.0+ in TypeScript 5.0+.
5
+ Provides 'specflow' like bindings for CucumberJS 11.2.0+ in TypeScript 5.8+.
6
6
 
7
7
  Supports Vue3 files in cucumber tests.
8
8
 
@@ -20,7 +20,7 @@ In addition, the following features have been added:
20
20
  - **2** - Implemented scenarios are passing but there are pending, undefined or unknown scenario steps.
21
21
  - **3** - One or more scenario steps have failed.
22
22
 
23
- - Typescript and esbuild transpiler support.
23
+ - CommonJS transpilers using either esbuild or ts-node.
24
24
 
25
25
  - Vue3 transformer used to handle .vue files in tests.
26
26
 
@@ -61,6 +61,12 @@ cucumber-tsflow uses TypeScript Decorators to create SpecFlow like bindings for
61
61
  npm install @lynxwall/cucumber-tsflow --save-dev
62
62
  ```
63
63
 
64
+ #### pnpm
65
+
66
+ ```bash
67
+ pnpm add @lynxwall/cucumber-tsflow --save-dev
68
+ ```
69
+
64
70
  #### yarn
65
71
 
66
72
  ```bash
@@ -230,9 +236,9 @@ In addition to cucumber configuration options the following two options have bee
230
236
  | `debugFile` | `string` | No | `--debug-file` | Path to a file with steps for debugging | |
231
237
  | `enableVueStyle` | `boolean` | No | `--enable-vue-style` | Enable Vue `<style>` block when compiling Vue SFC. | false |
232
238
 
233
- #### Transpiler and Vue3 supported
239
+ ### Transpiler and Vue3 supported
234
240
 
235
- Using TypeScript with cucumberJs requires a couple of tsconfig.json parameters as described here: [Transpiling](https://github.com/cucumber/cucumber-js/blob/v9.1.0/docs/transpiling.md)
241
+ Using TypeScript with CucumberJs requires a couple of tsconfig.json parameters as described here: [Transpiling](https://github.com/cucumber/cucumber-js/blob/v11.2.0/docs/transpiling.md). In addition, there is no support for transpiling Vue files with CucumberJS.
236
242
 
237
243
  As a result, cucumber-tsflow adds several configurations for transpiling TypeScript code using the recommended configuration. In addition, support has been added to transform .vue files during test execution allowing you to test Vue SFC components using cucumber.
238
244
 
@@ -247,6 +253,10 @@ The following transpilers are provided:
247
253
  - **tsvue**: Uses typescript to transpile TypeScript code and adds a hook for .vue files, which transforms Vue SFC components into commonJS.
248
254
  - **jsdom** is also loaded globally to support loading and testing Vue SFC components.
249
255
 
256
+ <div style="padding: 15px; border: 1px solid transparent; border-color: transparent; margin-bottom: 20px; border-radius: 4px; color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc;">
257
+ <strong><span style="color: #000">Note:</span></strong> The transpilers provide with cucumber-tsflow will only support CommonJS modules. In other words, if your package.json file has 'type: module' you will not be able to use these transpilers. However, you can use ts-node for transpiling as documented here: <a ref='https://github.com/cucumber/cucumber-js/blob/v11.2.0/docs/transpiling.md#esm'>Transpiling</a>
258
+ </div>
259
+
250
260
  ##### Using the transpiler configuration option
251
261
 
252
262
  When configuring cucumber to execute tests you can specify which transpiler to use with the `transpiler` configuration option as shown below:
@@ -266,12 +276,12 @@ You can also use the `requireModule` parameter to configure a transpiler. The fo
266
276
  ```json
267
277
  {
268
278
  "default": {
269
- "requireModule": ["@lynxwall/cucumber-tsflow/lib/esvue"]
279
+ "requireModule": ["@lynxwall/cucumber-tsflow/esvue"]
270
280
  }
271
281
  }
272
282
  ```
273
283
 
274
- #### Debug File support
284
+ ### Debug File support
275
285
 
276
286
  The new `debugFile` configuration option allows you to specify a .ts file with step definitions that you want to debug. This will search for a matching feature and execute the tests in that feature. This option is helpful when debugging tests and you don't want to run all of the tests.
277
287
 
@@ -284,9 +294,9 @@ If using VSCode to edit your project the following launch configurations can be
284
294
  "name": "Debug All",
285
295
  "type": "node",
286
296
  "request": "launch",
287
- "program": "${workspaceRoot}/node_modules/@lynxwall/cucumber-tsflow/bin/cucumber-tsflow",
297
+ "program": "${workspaceRoot}/node_modules/@lynxwall/cucumber-tsflow/bin/cucumber-tsflow/vue",
288
298
  "stopOnEntry": true,
289
- "args": ["-p", "default"],
299
+ "args": ["-p", "esvue"],
290
300
  "cwd": "${workspaceRoot}",
291
301
  "runtimeExecutable": null,
292
302
  "runtimeArgs": ["--nolazy"],
@@ -305,9 +315,9 @@ If using VSCode to edit your project the following launch configurations can be
305
315
  "name": "Debug Feature",
306
316
  "type": "node",
307
317
  "request": "launch",
308
- "program": "${workspaceRoot}/node_modules/@lynxwall/cucumber-tsflow/bin/cucumber-tsflow",
318
+ "program": "${workspaceRoot}/node_modules/@lynxwall/cucumber-tsflow/bin/cucumber-tsflow/vue",
309
319
  "stopOnEntry": true,
310
- "args": ["--debug-file", "${file}", "-p", "default"],
320
+ "args": ["--debug-file", "${file}", "-p", "esvue"],
311
321
  "cwd": "${workspaceRoot}",
312
322
  "runtimeExecutable": null,
313
323
  "runtimeArgs": ["--nolazy"],
@@ -580,7 +590,7 @@ With Context Injection you first need to define one or more classes that will be
580
590
 
581
591
  ```typescript
582
592
  import { World } from '@cucumber/cucumber';
583
- import { EndTestCaseInfo, StartTestCaseInfo } from '@lynxwall/cucumber-tsflow/lib/cucumber/test-case-info';
593
+ import { EndTestCaseInfo, StartTestCaseInfo } from '@lynxwall/cucumber-tsflow';
584
594
 
585
595
  export class ScenarioContext {
586
596
  public world: World;
@@ -614,7 +624,7 @@ export class ScenarioContext {
614
624
 
615
625
  ```typescript
616
626
  import { World } from '@cucumber/cucumber';
617
- import { EndTestCaseInfo, StartTestCaseInfo } from '@lynxwall/cucumber-tsflow/lib/cucumber/test-case-info';
627
+ import { EndTestCaseInfo, StartTestCaseInfo } from '@lynxwall/cucumber-tsflow';
618
628
 
619
629
  export class ScenarioContext {
620
630
  public world: World;
package/api/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /*
2
+ allows TypeScript to see `@cucumber/cucumber/api` where it doesn't yet support
3
+ subpath exports, see <https://github.com/microsoft/TypeScript/issues/33079>
4
+ */
5
+
6
+ export * from '../lib/api';
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node
2
-
3
- require('../lib/cli/run.js').default();
1
+ #!/usr/bin/env node
2
+
3
+ require('../lib/cli/run.js').default();
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../lib/cli/run.js').default();
@@ -0,0 +1,17 @@
1
+ /**
2
+ * JavaScript API for running and extending Cucumber
3
+ *
4
+ * @packageDocumentation
5
+ * @module api
6
+ * @remarks
7
+ * These docs cover the API used for running Cucumber-tsflow programmatically. The entry point is `@lynxwall/cucumber-tsflow/api`.
8
+ */
9
+ export { IConfiguration } from '@cucumber/cucumber/lib/configuration/index';
10
+ export { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';
11
+ export { IPickleOrder } from '@cucumber/cucumber/lib/filter/index';
12
+ export { IPublishConfig } from '@cucumber/cucumber/lib/publish/index';
13
+ export * from './load-configuration';
14
+ export * from '@cucumber/cucumber/lib/api/load_sources';
15
+ export * from './load-support';
16
+ export * from './run-cucumber';
17
+ export * from '@cucumber/cucumber/lib/api/types';
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * JavaScript API for running and extending Cucumber
4
+ *
5
+ * @packageDocumentation
6
+ * @module api
7
+ * @remarks
8
+ * These docs cover the API used for running Cucumber-tsflow programmatically. The entry point is `@lynxwall/cucumber-tsflow/api`.
9
+ */
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ __exportStar(require("./load-configuration"), exports);
26
+ __exportStar(require("@cucumber/cucumber/lib/api/load_sources"), exports);
27
+ __exportStar(require("./load-support"), exports);
28
+ __exportStar(require("./run-cucumber"), exports);
29
+ __exportStar(require("@cucumber/cucumber/lib/api/types"), exports);
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAMH,uDAAqC;AACrC,0EAAwD;AACxD,iDAA+B;AAC/B,iDAA+B;AAC/B,mEAAiD","sourcesContent":["/**\r\n * JavaScript API for running and extending Cucumber\r\n *\r\n * @packageDocumentation\r\n * @module api\r\n * @remarks\r\n * These docs cover the API used for running Cucumber-tsflow programmatically. The entry point is `@lynxwall/cucumber-tsflow/api`.\r\n */\r\n\r\nexport { IConfiguration } from '@cucumber/cucumber/lib/configuration/index';\r\nexport { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nexport { IPickleOrder } from '@cucumber/cucumber/lib/filter/index';\r\nexport { IPublishConfig } from '@cucumber/cucumber/lib/publish/index';\r\nexport * from './load-configuration';\r\nexport * from '@cucumber/cucumber/lib/api/load_sources';\r\nexport * from './load-support';\r\nexport * from './run-cucumber';\r\nexport * from '@cucumber/cucumber/lib/api/types';\r\n"]}
@@ -0,0 +1,21 @@
1
+ import { ILoadConfigurationOptions, IRunConfiguration } from '@cucumber/cucumber/lib/api/types';
2
+ import { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';
3
+ import { ITsflowConfiguration } from '../cli/argv-parser';
4
+ export interface ITsflowResolvedConfiguration {
5
+ /**
6
+ * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.
7
+ */
8
+ useConfiguration: ITsflowConfiguration;
9
+ /**
10
+ * The format that can be passed into `runCucumber`.
11
+ */
12
+ runConfiguration: IRunConfiguration;
13
+ }
14
+ /**
15
+ * Load user-authored configuration to be used in a test run.
16
+ *
17
+ * @public
18
+ * @param options - Coordinates required to find configuration.
19
+ * @param environment - Project environment.
20
+ */
21
+ export declare const loadConfiguration: (options?: ILoadConfigurationOptions, environment?: IRunEnvironment) => Promise<ITsflowResolvedConfiguration>;
@@ -0,0 +1,127 @@
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.loadConfiguration = void 0;
7
+ const locate_file_1 = require("@cucumber/cucumber/lib/configuration/locate_file");
8
+ const index_1 = require("@cucumber/cucumber/lib/configuration/index");
9
+ const validate_configuration_1 = require("@cucumber/cucumber/lib/configuration/validate_configuration");
10
+ const convert_configuration_1 = require("@cucumber/cucumber/lib/api/convert_configuration");
11
+ const index_2 = require("@cucumber/cucumber/lib/environment/index");
12
+ const helpers_1 = require("../utils/helpers");
13
+ const gherkin_manager_1 = __importDefault(require("../gherkin/gherkin-manager"));
14
+ const ansis_1 = __importDefault(require("ansis"));
15
+ /**
16
+ * Load user-authored configuration to be used in a test run.
17
+ *
18
+ * @public
19
+ * @param options - Coordinates required to find configuration.
20
+ * @param environment - Project environment.
21
+ */
22
+ const loadConfiguration = async (options = {}, environment = {}) => {
23
+ const { cwd, env, logger } = (0, index_2.makeEnvironment)(environment);
24
+ const configFile = options.file ?? (0, locate_file_1.locateFile)(cwd);
25
+ if (configFile) {
26
+ logger.debug(`Configuration will be loaded from "${configFile}"`);
27
+ }
28
+ else if (configFile === false) {
29
+ logger.debug('Skipping configuration file resolution');
30
+ }
31
+ else {
32
+ logger.debug('No configuration file found');
33
+ }
34
+ const profileConfiguration = configFile ? await (0, index_1.fromFile)(logger, cwd, configFile, options.profiles) : {};
35
+ // if a feature was passed in on command line it's added
36
+ // to the provided configuration as paths. We need to clear
37
+ // any paths from configuration so that only the feature passed
38
+ // in is executed.
39
+ const paths = options.provided.paths;
40
+ if (paths && paths?.length > 0) {
41
+ profileConfiguration.paths = [];
42
+ }
43
+ const original = (0, index_1.mergeConfigurations)(index_1.DEFAULT_CONFIGURATION, profileConfiguration, (0, index_1.parseConfiguration)(logger, 'Provided', options.provided));
44
+ switch (original.transpiler) {
45
+ case 'esvue':
46
+ original.requireModule.push('@lynxwall/cucumber-tsflow/lib/esvue');
47
+ break;
48
+ case 'tsvue':
49
+ original.requireModule.push('@lynxwall/cucumber-tsflow/lib/tsvue');
50
+ break;
51
+ case 'tsnode':
52
+ original.requireModule.push('@lynxwall/cucumber-tsflow/lib/tsnode');
53
+ break;
54
+ default:
55
+ // defaulting to esbuild
56
+ original.requireModule.push('@lynxwall/cucumber-tsflow/lib/esnode');
57
+ break;
58
+ }
59
+ // set the snippet syntax
60
+ if (!original.formatOptions.snippetSyntax) {
61
+ original.formatOptions.snippetSyntax = '@lynxwall/cucumber-tsflow/snippet';
62
+ }
63
+ // look for behave format
64
+ for (let idx = 0; idx < original.format.length; idx++) {
65
+ if (typeof original.format[idx] === 'string') {
66
+ const formatItem = original.format[idx];
67
+ if (formatItem.startsWith('behave:')) {
68
+ original.format[idx] = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');
69
+ }
70
+ }
71
+ else if (original.format[idx].length > 0) {
72
+ const formatItem = original.format[idx][0];
73
+ if (formatItem.startsWith('behave')) {
74
+ const newVal = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');
75
+ original.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];
76
+ }
77
+ }
78
+ }
79
+ // look for junitbamboo format
80
+ for (let idx = 0; idx < original.format.length; idx++) {
81
+ if (typeof original.format[idx] === 'string') {
82
+ const formatItem = original.format[idx];
83
+ if (formatItem.startsWith('junitbamboo:')) {
84
+ original.format[idx] = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');
85
+ }
86
+ }
87
+ else if (original.format[idx].length > 0) {
88
+ const formatItem = original.format[idx][0];
89
+ if (formatItem.startsWith('junitbamboo')) {
90
+ const newVal = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');
91
+ original.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];
92
+ }
93
+ }
94
+ }
95
+ // check to see if a debugFile was passed in
96
+ if ((0, helpers_1.hasStringValue)(original.debugFile)) {
97
+ // Initialize gherkin manager with path to feature files
98
+ const gherkin = new gherkin_manager_1.default();
99
+ await gherkin.loadFeatures(original.paths);
100
+ const features = gherkin.findFeaturesByStepFile(original.debugFile);
101
+ if (features.length > 0) {
102
+ original.paths = [];
103
+ features.forEach(x => original.paths.push(x.featureFile));
104
+ }
105
+ else {
106
+ // log a message if the feature path is not found
107
+ logger.warn(ansis_1.default.yellow(`\nUnable to find feature for debugFile: ${original.debugFile}`));
108
+ logger.warn(ansis_1.default.yellow('All tests will be executed\n'));
109
+ }
110
+ }
111
+ // check to see if enable-vue-style was set
112
+ // if not, default it to false
113
+ if (original.enableVueStyle === null || original.enableVueStyle === undefined) {
114
+ original.enableVueStyle = false;
115
+ }
116
+ // set our global parameter used by the Vue transpiler
117
+ // to determine if Vue Style Blocks should be enabled
118
+ global.enableVueStyle = original.enableVueStyle;
119
+ (0, validate_configuration_1.validateConfiguration)(original, logger);
120
+ const runnable = await (0, convert_configuration_1.convertConfiguration)(logger, original, env);
121
+ return {
122
+ useConfiguration: original,
123
+ runConfiguration: runnable
124
+ };
125
+ };
126
+ exports.loadConfiguration = loadConfiguration;
127
+ //# sourceMappingURL=load-configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-configuration.js","sourceRoot":"","sources":["../../src/api/load-configuration.ts"],"names":[],"mappings":";;;;;;AACA,kFAA8E;AAC9E,sEAMoD;AACpD,wGAAoG;AACpG,4FAAwF;AACxF,oEAA4F;AAE5F,8CAAkD;AAClD,iFAAwD;AACxD,kDAA0B;AAc1B;;;;;;GAMG;AACI,MAAM,iBAAiB,GAAG,KAAK,EACrC,UAAqC,EAAE,EACvC,cAA+B,EAAE,EACO,EAAE;IAC1C,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,IAAA,wBAAU,EAAC,GAAG,CAAC,CAAC;IACnD,IAAI,UAAU,EAAE,CAAC;QAChB,MAAM,CAAC,KAAK,CAAC,sCAAsC,UAAU,GAAG,CAAC,CAAC;IACnE,CAAC;SAAM,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACjC,MAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACxD,CAAC;SAAM,CAAC;QACP,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,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O,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACP,iDAAiD;YACjD,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,MAAM,CAAC,2CAA2C,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;YAC3F,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC,CAAC;QAC3D,CAAC;IACF,CAAC;IAED,2CAA2C;IAC3C,8BAA8B;IAC9B,IAAI,QAAQ,CAAC,cAAc,KAAK,IAAI,IAAI,QAAQ,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QAC/E,QAAQ,CAAC,cAAc,GAAG,KAAK,CAAC;IACjC,CAAC;IACD,sDAAsD;IACtD,qDAAqD;IACrD,MAAM,CAAC,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;IAEhD,IAAA,8CAAqB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,IAAA,4CAAoB,EAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;IACnE,OAAO;QACN,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;KAC1B,CAAC;AACH,CAAC,CAAC;AAhHW,QAAA,iBAAiB,qBAgH5B","sourcesContent":["import { ILoadConfigurationOptions, IRunConfiguration } from '@cucumber/cucumber/lib/api/types';\r\nimport { locateFile } from '@cucumber/cucumber/lib/configuration/locate_file';\r\nimport {\r\n\tDEFAULT_CONFIGURATION,\r\n\tfromFile,\r\n\tIConfiguration,\r\n\tparseConfiguration,\r\n\tmergeConfigurations\r\n} from '@cucumber/cucumber/lib/configuration/index';\r\nimport { validateConfiguration } from '@cucumber/cucumber/lib/configuration/validate_configuration';\r\nimport { convertConfiguration } from '@cucumber/cucumber/lib/api/convert_configuration';\r\nimport { IRunEnvironment, makeEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { ITsflowConfiguration } from '../cli/argv-parser';\r\nimport { hasStringValue } from '../utils/helpers';\r\nimport GherkinManager from '../gherkin/gherkin-manager';\r\nimport chalk from 'ansis';\r\nimport logger from '../utils/logger';\r\n\r\nexport interface ITsflowResolvedConfiguration {\r\n\t/**\r\n\t * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.\r\n\t */\r\n\tuseConfiguration: ITsflowConfiguration;\r\n\t/**\r\n\t * The format that can be passed into `runCucumber`.\r\n\t */\r\n\trunConfiguration: IRunConfiguration;\r\n}\r\n\r\n/**\r\n * Load user-authored configuration to be used in a test run.\r\n *\r\n * @public\r\n * @param options - Coordinates required to find configuration.\r\n * @param environment - Project environment.\r\n */\r\nexport const loadConfiguration = async (\r\n\toptions: ILoadConfigurationOptions = {},\r\n\tenvironment: IRunEnvironment = {}\r\n): Promise<ITsflowResolvedConfiguration> => {\r\n\tconst { cwd, env, logger } = makeEnvironment(environment);\r\n\tconst configFile = options.file ?? locateFile(cwd);\r\n\tif (configFile) {\r\n\t\tlogger.debug(`Configuration will be loaded from \"${configFile}\"`);\r\n\t} else if (configFile === false) {\r\n\t\tlogger.debug('Skipping configuration file resolution');\r\n\t} else {\r\n\t\tlogger.debug('No configuration file found');\r\n\t}\r\n\tconst profileConfiguration = configFile ? await fromFile(logger, cwd, configFile, options.profiles) : {};\r\n\r\n\t// if a feature was passed in on command line it's added\r\n\t// to the provided configuration as paths. We need to clear\r\n\t// any paths from configuration so that only the feature passed\r\n\t// in is executed.\r\n\tconst paths = (options.provided as Partial<IConfiguration>).paths;\r\n\tif (paths && paths?.length > 0) {\r\n\t\tprofileConfiguration.paths = [];\r\n\t}\r\n\r\n\tconst original = mergeConfigurations(\r\n\t\tDEFAULT_CONFIGURATION,\r\n\t\tprofileConfiguration,\r\n\t\tparseConfiguration(logger, 'Provided', options.provided)\r\n\t) as ITsflowConfiguration;\r\n\r\n\tswitch (original.transpiler) {\r\n\t\tcase 'esvue':\r\n\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/esvue');\r\n\t\t\tbreak;\r\n\t\tcase 'tsvue':\r\n\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/tsvue');\r\n\t\t\tbreak;\r\n\t\tcase 'tsnode':\r\n\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/tsnode');\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t// defaulting to esbuild\r\n\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/esnode');\r\n\t\t\tbreak;\r\n\t}\r\n\t// set the snippet syntax\r\n\tif (!original.formatOptions.snippetSyntax) {\r\n\t\toriginal.formatOptions.snippetSyntax = '@lynxwall/cucumber-tsflow/snippet';\r\n\t}\r\n\t// look for behave format\r\n\tfor (let idx = 0; idx < original.format.length; idx++) {\r\n\t\tif (typeof original.format[idx] === 'string') {\r\n\t\t\tconst formatItem = original.format[idx] as string;\r\n\t\t\tif (formatItem.startsWith('behave:')) {\r\n\t\t\t\toriginal.format[idx] = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');\r\n\t\t\t}\r\n\t\t} else if (original.format[idx].length > 0) {\r\n\t\t\tconst formatItem = original.format[idx][0] as string;\r\n\t\t\tif (formatItem.startsWith('behave')) {\r\n\t\t\t\tconst newVal = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');\r\n\t\t\t\toriginal.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// look for junitbamboo format\r\n\tfor (let idx = 0; idx < original.format.length; idx++) {\r\n\t\tif (typeof original.format[idx] === 'string') {\r\n\t\t\tconst formatItem = original.format[idx] as string;\r\n\t\t\tif (formatItem.startsWith('junitbamboo:')) {\r\n\t\t\t\toriginal.format[idx] = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');\r\n\t\t\t}\r\n\t\t} else if (original.format[idx].length > 0) {\r\n\t\t\tconst formatItem = original.format[idx][0] as string;\r\n\t\t\tif (formatItem.startsWith('junitbamboo')) {\r\n\t\t\t\tconst newVal = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');\r\n\t\t\t\toriginal.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// check to see if a debugFile was passed in\r\n\tif (hasStringValue(original.debugFile)) {\r\n\t\t// Initialize gherkin manager with path to feature files\r\n\t\tconst gherkin = new GherkinManager();\r\n\t\tawait gherkin.loadFeatures(original.paths);\r\n\t\tconst features = gherkin.findFeaturesByStepFile(original.debugFile);\r\n\t\tif (features.length > 0) {\r\n\t\t\toriginal.paths = [];\r\n\t\t\tfeatures.forEach(x => original.paths.push(x.featureFile));\r\n\t\t} else {\r\n\t\t\t// log a message if the feature path is not found\r\n\t\t\tlogger.warn(chalk.yellow(`\\nUnable to find feature for debugFile: ${original.debugFile}`));\r\n\t\t\tlogger.warn(chalk.yellow('All tests will be executed\\n'));\r\n\t\t}\r\n\t}\r\n\r\n\t// check to see if enable-vue-style was set\r\n\t// if not, default it to false\r\n\tif (original.enableVueStyle === null || original.enableVueStyle === undefined) {\r\n\t\toriginal.enableVueStyle = false;\r\n\t}\r\n\t// set our global parameter used by the Vue transpiler\r\n\t// to determine if Vue Style Blocks should be enabled\r\n\tglobal.enableVueStyle = original.enableVueStyle;\r\n\r\n\tvalidateConfiguration(original, logger);\r\n\tconst runnable = await convertConfiguration(logger, original, env);\r\n\treturn {\r\n\t\tuseConfiguration: original,\r\n\t\trunConfiguration: runnable\r\n\t};\r\n};\r\n"]}
@@ -0,0 +1,10 @@
1
+ import { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';
2
+ import { ILoadSupportOptions, ISupportCodeLibrary } from '@cucumber/cucumber/lib/api/types';
3
+ /**
4
+ * Load support code for use in test runs
5
+ *
6
+ * @public
7
+ * @param options - Options 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,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadSupport = loadSupport;
4
+ const messages_1 = require("@cucumber/messages");
5
+ const index_1 = require("@cucumber/cucumber/lib/paths/index");
6
+ const index_2 = require("@cucumber/cucumber/lib/environment/index");
7
+ const support_1 = require("@cucumber/cucumber/lib/api/support");
8
+ const plugins_1 = require("@cucumber/cucumber/lib/api/plugins");
9
+ const binding_registry_1 = require("../bindings/binding-registry");
10
+ /**
11
+ * Load support code for use in test runs
12
+ *
13
+ * @public
14
+ * @param options - Options required to find the support code
15
+ * @param environment - Project environment
16
+ */
17
+ async function loadSupport(options, environment = {}) {
18
+ const mergedEnvironment = (0, index_2.makeEnvironment)(environment);
19
+ const { cwd, logger } = mergedEnvironment;
20
+ const newId = messages_1.IdGenerator.uuid();
21
+ const supportCoordinates = Object.assign({
22
+ requireModules: [],
23
+ requirePaths: [],
24
+ loaders: [],
25
+ importPaths: []
26
+ }, options.support);
27
+ const pluginManager = await (0, plugins_1.initializeForLoadSupport)(mergedEnvironment);
28
+ const resolvedPaths = await (0, index_1.resolvePaths)(logger, cwd, options.sources, supportCoordinates);
29
+ pluginManager.emit('paths:resolve', resolvedPaths);
30
+ const { requirePaths, importPaths } = resolvedPaths;
31
+ let supportCodeLibrary = await (0, support_1.getSupportCodeLibrary)({
32
+ logger,
33
+ cwd,
34
+ newId,
35
+ requireModules: supportCoordinates.requireModules,
36
+ requirePaths,
37
+ loaders: supportCoordinates.loaders,
38
+ importPaths
39
+ });
40
+ await pluginManager.cleanup();
41
+ // Set support to the updated step and hook definitions
42
+ // in the supportCodeLibrary. We also need to initialize originalCoordinates
43
+ // to support parallel execution.
44
+ supportCodeLibrary = binding_registry_1.BindingRegistry.instance.updateSupportCodeLibrary(supportCodeLibrary);
45
+ supportCodeLibrary = { ...supportCodeLibrary, ...{ originalCoordinates: supportCoordinates } };
46
+ return supportCodeLibrary;
47
+ }
48
+ //# sourceMappingURL=load-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-support.js","sourceRoot":"","sources":["../../src/api/load-support.ts"],"names":[],"mappings":";;AAeA,kCAsCC;AArDD,iDAAiD;AACjD,8DAAkE;AAClE,oEAA4F;AAE5F,gEAA2E;AAC3E,gEAA8E;AAC9E,mEAA+D;AAE/D;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAChC,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,iBAAiB,GAAG,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAC;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC;IAC1C,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CACvC;QACC,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,EAAE;QAChB,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE;KACf,EACD,OAAO,CAAC,OAAO,CACf,CAAC;IACF,MAAM,aAAa,GAAG,MAAM,IAAA,kCAAwB,EAAC,iBAAiB,CAAC,CAAC;IACxE,MAAM,aAAa,GAAG,MAAM,IAAA,oBAAY,EAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC3F,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IACnD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,aAAa,CAAC;IACpD,IAAI,kBAAkB,GAAG,MAAM,IAAA,+BAAqB,EAAC;QACpD,MAAM;QACN,GAAG;QACH,KAAK;QACL,cAAc,EAAE,kBAAkB,CAAC,cAAc;QACjD,YAAY;QACZ,OAAO,EAAE,kBAAkB,CAAC,OAAO;QACnC,WAAW;KACX,CAAC,CAAC;IACH,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;IAE9B,uDAAuD;IACvD,4EAA4E;IAC5E,iCAAiC;IACjC,kBAAkB,GAAG,kCAAe,CAAC,QAAQ,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;IAC3F,kBAAkB,GAAG,EAAE,GAAG,kBAAkB,EAAE,GAAG,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,EAAE,CAAC;IAE/F,OAAO,kBAAkB,CAAC;AAC3B,CAAC","sourcesContent":["import { IdGenerator } from '@cucumber/messages';\r\nimport { resolvePaths } from '@cucumber/cucumber/lib/paths/index';\r\nimport { IRunEnvironment, makeEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { ILoadSupportOptions, ISupportCodeLibrary } from '@cucumber/cucumber/lib/api/types';\r\nimport { getSupportCodeLibrary } from '@cucumber/cucumber/lib/api/support';\r\nimport { initializeForLoadSupport } from '@cucumber/cucumber/lib/api/plugins';\r\nimport { BindingRegistry } from '../bindings/binding-registry';\r\n\r\n/**\r\n * Load support code for use in test runs\r\n *\r\n * @public\r\n * @param options - Options required to find the support code\r\n * @param environment - Project environment\r\n */\r\nexport async function loadSupport(\r\n\toptions: ILoadSupportOptions,\r\n\tenvironment: IRunEnvironment = {}\r\n): Promise<ISupportCodeLibrary> {\r\n\tconst mergedEnvironment = makeEnvironment(environment);\r\n\tconst { cwd, logger } = mergedEnvironment;\r\n\tconst newId = IdGenerator.uuid();\r\n\tconst supportCoordinates = Object.assign(\r\n\t\t{\r\n\t\t\trequireModules: [],\r\n\t\t\trequirePaths: [],\r\n\t\t\tloaders: [],\r\n\t\t\timportPaths: []\r\n\t\t},\r\n\t\toptions.support\r\n\t);\r\n\tconst pluginManager = await initializeForLoadSupport(mergedEnvironment);\r\n\tconst resolvedPaths = await resolvePaths(logger, cwd, options.sources, supportCoordinates);\r\n\tpluginManager.emit('paths:resolve', resolvedPaths);\r\n\tconst { requirePaths, importPaths } = resolvedPaths;\r\n\tlet supportCodeLibrary = await getSupportCodeLibrary({\r\n\t\tlogger,\r\n\t\tcwd,\r\n\t\tnewId,\r\n\t\trequireModules: supportCoordinates.requireModules,\r\n\t\trequirePaths,\r\n\t\tloaders: supportCoordinates.loaders,\r\n\t\timportPaths\r\n\t});\r\n\tawait pluginManager.cleanup();\r\n\r\n\t// Set support to the updated step and hook definitions\r\n\t// in the supportCodeLibrary. We also need to initialize originalCoordinates\r\n\t// to support parallel execution.\r\n\tsupportCodeLibrary = BindingRegistry.instance.updateSupportCodeLibrary(supportCodeLibrary);\r\n\tsupportCodeLibrary = { ...supportCodeLibrary, ...{ originalCoordinates: supportCoordinates } };\r\n\r\n\treturn supportCodeLibrary;\r\n}\r\n"]}
@@ -0,0 +1,16 @@
1
+ import { Envelope } from '@cucumber/messages';
2
+ import { IRunOptions, IRunResult } from '@cucumber/cucumber/lib/api/types';
3
+ import { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';
4
+ import 'polyfill-symbol-metadata';
5
+ /**
6
+ * Execute a Cucumber test run.
7
+ *
8
+ * Extended from cucumber.js so that we can use our own implementation
9
+ * of makeRuntime
10
+ *
11
+ * @public
12
+ * @param options - Configuration loaded from `loadConfiguration`.
13
+ * @param environment - Project environment.
14
+ * @param onMessage - Callback fired each time Cucumber emits a message.
15
+ */
16
+ export declare function runCucumber(options: IRunOptions, environment?: IRunEnvironment, onMessage?: (message: Envelope) => void): Promise<IRunResult>;
@@ -0,0 +1,151 @@
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.runCucumber = runCucumber;
7
+ const messages_1 = require("@cucumber/messages");
8
+ const events_1 = require("events");
9
+ const helpers_1 = require("@cucumber/cucumber/lib/cli/helpers");
10
+ const index_1 = require("@cucumber/cucumber/lib/paths/index");
11
+ const make_runtime_1 = require("../runtime/make-runtime");
12
+ const formatters_1 = require("@cucumber/cucumber/lib/api/formatters");
13
+ const support_1 = require("@cucumber/cucumber/lib/api/support");
14
+ const index_2 = require("@cucumber/cucumber/lib/environment/index");
15
+ const gherkin_1 = require("@cucumber/cucumber/lib/api/gherkin");
16
+ const message_collector_1 = __importDefault(require("../runtime/message-collector"));
17
+ const version_1 = require("../version");
18
+ const plugins_1 = require("@cucumber/cucumber/lib/api/plugins");
19
+ require("polyfill-symbol-metadata");
20
+ const binding_registry_1 = require("../bindings/binding-registry");
21
+ /**
22
+ * Execute a Cucumber test run.
23
+ *
24
+ * Extended from cucumber.js so that we can use our own implementation
25
+ * of makeRuntime
26
+ *
27
+ * @public
28
+ * @param options - Configuration loaded from `loadConfiguration`.
29
+ * @param environment - Project environment.
30
+ * @param onMessage - Callback fired each time Cucumber emits a message.
31
+ */
32
+ async function runCucumber(options, environment = {}, onMessage) {
33
+ const mergedEnvironment = (0, index_2.makeEnvironment)(environment);
34
+ const { cwd, stdout, stderr, env, logger } = mergedEnvironment;
35
+ logger.debug(`Running cucumber-tsflow ${version_1.version}
36
+ Working directory: ${cwd}
37
+ Running from: ${__dirname}
38
+ `);
39
+ const newId = messages_1.IdGenerator.uuid();
40
+ const supportCoordinates = 'originalCoordinates' in options.support
41
+ ? options.support.originalCoordinates
42
+ : Object.assign({
43
+ requireModules: [],
44
+ requirePaths: [],
45
+ loaders: [],
46
+ importPaths: []
47
+ }, options.support);
48
+ const pluginManager = await (0, plugins_1.initializeForRunCucumber)({
49
+ ...options,
50
+ support: supportCoordinates
51
+ }, mergedEnvironment);
52
+ const resolvedPaths = await (0, index_1.resolvePaths)(logger, cwd, options.sources, supportCoordinates);
53
+ pluginManager.emit('paths:resolve', resolvedPaths);
54
+ const { sourcePaths, requirePaths, importPaths } = resolvedPaths;
55
+ /**
56
+ * The support code library contains all of the hook and step definitions.
57
+ * These are loaded into the library when calling getSupportCodeLibrary,
58
+ * which loads all of the step definitions using require or import.
59
+ */
60
+ let supportCodeLibrary = 'originalCoordinates' in options.support
61
+ ? options.support
62
+ : await (0, support_1.getSupportCodeLibrary)({
63
+ logger,
64
+ cwd,
65
+ newId,
66
+ requirePaths,
67
+ requireModules: supportCoordinates.requireModules,
68
+ importPaths,
69
+ loaders: supportCoordinates.loaders
70
+ });
71
+ // Set support to the updated step and hook definitions
72
+ // in the supportCodeLibrary. We also need to initialize originalCoordinates
73
+ // to support parallel execution.
74
+ supportCodeLibrary = binding_registry_1.BindingRegistry.instance.updateSupportCodeLibrary(supportCodeLibrary);
75
+ supportCodeLibrary = { ...supportCodeLibrary, ...{ originalCoordinates: supportCoordinates } };
76
+ options.support = supportCodeLibrary;
77
+ const eventBroadcaster = new events_1.EventEmitter();
78
+ if (onMessage) {
79
+ eventBroadcaster.on('envelope', onMessage);
80
+ }
81
+ eventBroadcaster.on('envelope', value => pluginManager.emit('message', value));
82
+ // create a global instance of the message collector and bind it
83
+ // to the event broadcaster. This is used by cucumber and for tests
84
+ // that are not running in parallel.
85
+ global.messageCollector = new message_collector_1.default(eventBroadcaster);
86
+ // cast the MessageCollector to an EventDataCollector
87
+ const eventDataCollector = global.messageCollector;
88
+ let formatterStreamError = false;
89
+ const cleanupFormatters = await (0, formatters_1.initializeFormatters)({
90
+ env,
91
+ cwd,
92
+ stdout,
93
+ stderr,
94
+ logger,
95
+ onStreamError: () => (formatterStreamError = true),
96
+ eventBroadcaster,
97
+ eventDataCollector: eventDataCollector,
98
+ configuration: options.formats,
99
+ supportCodeLibrary,
100
+ pluginManager
101
+ });
102
+ await (0, helpers_1.emitMetaMessage)(eventBroadcaster, env);
103
+ let filteredPickles = [];
104
+ let parseErrors = [];
105
+ if (sourcePaths.length > 0) {
106
+ const gherkinResult = await (0, gherkin_1.getPicklesAndErrors)({
107
+ newId,
108
+ cwd,
109
+ sourcePaths,
110
+ coordinates: options.sources,
111
+ onEnvelope: envelope => eventBroadcaster.emit('envelope', envelope)
112
+ });
113
+ filteredPickles = await pluginManager.transform('pickles:filter', gherkinResult.filterablePickles);
114
+ filteredPickles = await pluginManager.transform('pickles:order', filteredPickles);
115
+ parseErrors = gherkinResult.parseErrors;
116
+ }
117
+ if (parseErrors.length) {
118
+ parseErrors.forEach(parseError => {
119
+ logger.error(`Parse error in "${parseError.source.uri}" ${parseError.message}`);
120
+ });
121
+ await cleanupFormatters();
122
+ await pluginManager.cleanup();
123
+ return {
124
+ success: false,
125
+ support: supportCodeLibrary
126
+ };
127
+ }
128
+ (0, helpers_1.emitSupportCodeMessages)({
129
+ eventBroadcaster,
130
+ supportCodeLibrary,
131
+ newId
132
+ });
133
+ const runtime = await (0, make_runtime_1.makeRuntime)({
134
+ environment,
135
+ logger,
136
+ eventBroadcaster,
137
+ sourcedPickles: filteredPickles,
138
+ newId,
139
+ supportCodeLibrary,
140
+ options: options.runtime,
141
+ coordinates: options.sources
142
+ });
143
+ const success = await runtime.run();
144
+ await pluginManager.cleanup();
145
+ await cleanupFormatters();
146
+ return {
147
+ success: success && !formatterStreamError,
148
+ support: supportCodeLibrary
149
+ };
150
+ }
151
+ //# sourceMappingURL=run-cucumber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-cucumber.js","sourceRoot":"","sources":["../../src/api/run-cucumber.ts"],"names":[],"mappings":";;;;;AA8BA,kCAiJC;AA/KD,iDAAuE;AACvE,mCAAsC;AAEtC,gEAA8F;AAE9F,8DAAkE;AAElE,0DAAsD;AACtD,sEAA6E;AAC7E,gEAA2E;AAC3E,oEAA4F;AAC5F,gEAAyE;AACzE,qFAA4D;AAC5D,wCAAqC;AACrC,gEAA8E;AAE9E,oCAAkC;AAClC,mEAA+D;AAE/D;;;;;;;;;;GAUG;AACI,KAAK,UAAU,WAAW,CAChC,OAAoB,EACpB,cAA+B,EAAE,EACjC,SAAuC;IAEvC,MAAM,iBAAiB,GAAG,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAC;IACvD,MAAM,E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pC,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;IAC9B,MAAM,iBAAiB,EAAE,CAAC;IAE1B,OAAO;QACN,OAAO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC3B,CAAC;AACH,CAAC","sourcesContent":["import { Envelope, IdGenerator, ParseError } from '@cucumber/messages';\r\nimport { EventEmitter } from 'events';\r\nimport { EventDataCollector } from '@cucumber/cucumber/lib/formatter/helpers/index';\r\nimport { emitMetaMessage, emitSupportCodeMessages } from '@cucumber/cucumber/lib/cli/helpers';\r\nimport { IRunOptions, IRunResult } from '@cucumber/cucumber/lib/api/types';\r\nimport { resolvePaths } from '@cucumber/cucumber/lib/paths/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport { makeRuntime } from '../runtime/make-runtime';\r\nimport { initializeFormatters } from '@cucumber/cucumber/lib/api/formatters';\r\nimport { getSupportCodeLibrary } from '@cucumber/cucumber/lib/api/support';\r\nimport { IRunEnvironment, makeEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { getPicklesAndErrors } from '@cucumber/cucumber/lib/api/gherkin';\r\nimport MessageCollector from '../runtime/message-collector';\r\nimport { version } from '../version';\r\nimport { initializeForRunCucumber } from '@cucumber/cucumber/lib/api/plugins';\r\nimport { IFilterablePickle } from '@cucumber/cucumber/lib/filter/index';\r\nimport 'polyfill-symbol-metadata';\r\nimport { BindingRegistry } from '../bindings/binding-registry';\r\n\r\n/**\r\n * Execute a Cucumber test run.\r\n *\r\n * Extended from cucumber.js so that we can use our own implementation\r\n * of makeRuntime\r\n *\r\n * @public\r\n * @param options - Configuration loaded from `loadConfiguration`.\r\n * @param environment - Project environment.\r\n * @param onMessage - Callback fired each time Cucumber emits a message.\r\n */\r\nexport async function runCucumber(\r\n\toptions: IRunOptions,\r\n\tenvironment: IRunEnvironment = {},\r\n\tonMessage?: (message: Envelope) => void\r\n): Promise<IRunResult> {\r\n\tconst mergedEnvironment = makeEnvironment(environment);\r\n\tconst { cwd, stdout, stderr, env, logger } = mergedEnvironment;\r\n\r\n\tlogger.debug(`Running cucumber-tsflow ${version}\r\nWorking directory: ${cwd}\r\nRunning from: ${__dirname}\r\n`);\r\n\r\n\tconst newId = IdGenerator.uuid();\r\n\r\n\tconst supportCoordinates =\r\n\t\t'originalCoordinates' in options.support\r\n\t\t\t? options.support.originalCoordinates\r\n\t\t\t: Object.assign(\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\trequireModules: [],\r\n\t\t\t\t\t\trequirePaths: [],\r\n\t\t\t\t\t\tloaders: [],\r\n\t\t\t\t\t\timportPaths: []\r\n\t\t\t\t\t},\r\n\t\t\t\t\toptions.support\r\n\t\t\t\t);\r\n\r\n\tconst pluginManager = await initializeForRunCucumber(\r\n\t\t{\r\n\t\t\t...options,\r\n\t\t\tsupport: supportCoordinates\r\n\t\t},\r\n\t\tmergedEnvironment\r\n\t);\r\n\r\n\tconst resolvedPaths = await resolvePaths(logger, cwd, options.sources, supportCoordinates);\r\n\tpluginManager.emit('paths:resolve', resolvedPaths);\r\n\tconst { sourcePaths, requirePaths, importPaths } = resolvedPaths;\r\n\r\n\t/**\r\n\t * The support code library contains all of the hook and step definitions.\r\n\t * These are loaded into the library when calling getSupportCodeLibrary,\r\n\t * which loads all of the step definitions using require or import.\r\n\t */\r\n\tlet supportCodeLibrary =\r\n\t\t'originalCoordinates' in options.support\r\n\t\t\t? (options.support as SupportCodeLibrary)\r\n\t\t\t: await getSupportCodeLibrary({\r\n\t\t\t\t\tlogger,\r\n\t\t\t\t\tcwd,\r\n\t\t\t\t\tnewId,\r\n\t\t\t\t\trequirePaths,\r\n\t\t\t\t\trequireModules: supportCoordinates.requireModules,\r\n\t\t\t\t\timportPaths,\r\n\t\t\t\t\tloaders: supportCoordinates.loaders\r\n\t\t\t\t});\r\n\r\n\t// Set support to the updated step and hook definitions\r\n\t// in the supportCodeLibrary. We also need to initialize originalCoordinates\r\n\t// to support parallel execution.\r\n\tsupportCodeLibrary = BindingRegistry.instance.updateSupportCodeLibrary(supportCodeLibrary);\r\n\tsupportCodeLibrary = { ...supportCodeLibrary, ...{ originalCoordinates: supportCoordinates } };\r\n\toptions.support = supportCodeLibrary;\r\n\r\n\tconst eventBroadcaster = new EventEmitter();\r\n\tif (onMessage) {\r\n\t\teventBroadcaster.on('envelope', onMessage);\r\n\t}\r\n\teventBroadcaster.on('envelope', value => pluginManager.emit('message', value));\r\n\r\n\t// create a global instance of the message collector and bind it\r\n\t// to the event broadcaster. This is used by cucumber and for tests\r\n\t// that are not running in parallel.\r\n\tglobal.messageCollector = new MessageCollector(eventBroadcaster);\r\n\r\n\t// cast the MessageCollector to an EventDataCollector\r\n\tconst eventDataCollector = global.messageCollector as unknown as EventDataCollector;\r\n\r\n\tlet formatterStreamError = false;\r\n\tconst cleanupFormatters = await initializeFormatters({\r\n\t\tenv,\r\n\t\tcwd,\r\n\t\tstdout,\r\n\t\tstderr,\r\n\t\tlogger,\r\n\t\tonStreamError: () => (formatterStreamError = true),\r\n\t\teventBroadcaster,\r\n\t\teventDataCollector: eventDataCollector,\r\n\t\tconfiguration: options.formats,\r\n\t\tsupportCodeLibrary,\r\n\t\tpluginManager\r\n\t});\r\n\tawait emitMetaMessage(eventBroadcaster, env);\r\n\r\n\tlet filteredPickles: ReadonlyArray<IFilterablePickle> = [];\r\n\tlet parseErrors: ParseError[] = [];\r\n\tif (sourcePaths.length > 0) {\r\n\t\tconst gherkinResult = await getPicklesAndErrors({\r\n\t\t\tnewId,\r\n\t\t\tcwd,\r\n\t\t\tsourcePaths,\r\n\t\t\tcoordinates: options.sources,\r\n\t\t\tonEnvelope: envelope => eventBroadcaster.emit('envelope', envelope)\r\n\t\t});\r\n\t\tfilteredPickles = await pluginManager.transform('pickles:filter', gherkinResult.filterablePickles);\r\n\t\tfilteredPickles = await pluginManager.transform('pickles:order', filteredPickles);\r\n\t\tparseErrors = gherkinResult.parseErrors;\r\n\t}\r\n\tif (parseErrors.length) {\r\n\t\tparseErrors.forEach(parseError => {\r\n\t\t\tlogger.error(`Parse error in \"${parseError.source.uri}\" ${parseError.message}`);\r\n\t\t});\r\n\t\tawait cleanupFormatters();\r\n\t\tawait pluginManager.cleanup();\r\n\t\treturn {\r\n\t\t\tsuccess: false,\r\n\t\t\tsupport: supportCodeLibrary\r\n\t\t};\r\n\t}\r\n\r\n\temitSupportCodeMessages({\r\n\t\teventBroadcaster,\r\n\t\tsupportCodeLibrary,\r\n\t\tnewId\r\n\t});\r\n\r\n\tconst runtime = await makeRuntime({\r\n\t\tenvironment,\r\n\t\tlogger,\r\n\t\teventBroadcaster,\r\n\t\tsourcedPickles: filteredPickles,\r\n\t\tnewId,\r\n\t\tsupportCodeLibrary,\r\n\t\toptions: options.runtime,\r\n\t\tcoordinates: options.sources\r\n\t});\r\n\tconst success = await runtime.run();\r\n\tawait pluginManager.cleanup();\r\n\tawait cleanupFormatters();\r\n\r\n\treturn {\r\n\t\tsuccess: success && !formatterStreamError,\r\n\t\tsupport: supportCodeLibrary\r\n\t};\r\n}\r\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;