@lynxwall/cucumber-tsflow 7.1.1 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +122 -53
  2. package/lib/api/convert-configuration.d.ts +7 -0
  3. package/lib/api/convert-configuration.js +65 -0
  4. package/lib/api/convert-configuration.js.map +1 -0
  5. package/lib/api/index.d.ts +1 -0
  6. package/lib/api/index.js +1 -0
  7. package/lib/api/index.js.map +1 -1
  8. package/lib/api/load-configuration.d.ts +3 -2
  9. package/lib/api/load-configuration.js +27 -11
  10. package/lib/api/load-configuration.js.map +1 -1
  11. package/lib/api/run-cucumber.d.ts +5 -1
  12. package/lib/api/run-cucumber.js +12 -0
  13. package/lib/api/run-cucumber.js.map +1 -1
  14. package/lib/api/wrapper.mjs +1 -0
  15. package/lib/bindings/binding-context.d.ts +15 -0
  16. package/lib/bindings/binding-context.js +32 -1
  17. package/lib/bindings/binding-context.js.map +1 -1
  18. package/lib/bindings/binding-decorator.js +57 -31
  19. package/lib/bindings/binding-decorator.js.map +1 -1
  20. package/lib/bindings/hook-decorators.js +43 -19
  21. package/lib/bindings/hook-decorators.js.map +1 -1
  22. package/lib/bindings/step-decorators.js +117 -51
  23. package/lib/bindings/step-decorators.js.map +1 -1
  24. package/lib/bindings/types.js.map +1 -1
  25. package/lib/cli/argv-parser.d.ts +1 -0
  26. package/lib/cli/argv-parser.js +1 -0
  27. package/lib/cli/argv-parser.js.map +1 -1
  28. package/lib/cli/index.js +1 -4
  29. package/lib/cli/index.js.map +1 -1
  30. package/lib/runtime/make-runtime.d.ts +3 -2
  31. package/lib/runtime/make-runtime.js.map +1 -1
  32. package/lib/runtime/message-collector.d.ts +1 -1
  33. package/lib/runtime/message-collector.js.map +1 -1
  34. package/lib/runtime/parallel/adapter.d.ts +3 -2
  35. package/lib/runtime/parallel/adapter.js +2 -1
  36. package/lib/runtime/parallel/adapter.js.map +1 -1
  37. package/lib/runtime/parallel/run-worker.js +3 -2
  38. package/lib/runtime/parallel/run-worker.js.map +1 -1
  39. package/lib/runtime/parallel/worker.d.ts +3 -2
  40. package/lib/runtime/parallel/worker.js +3 -1
  41. package/lib/runtime/parallel/worker.js.map +1 -1
  42. package/lib/runtime/{parallel/types.d.ts → types.d.ts} +12 -1
  43. package/lib/runtime/types.js.map +1 -0
  44. package/lib/transpilers/esbuild.js +18 -1
  45. package/lib/transpilers/esbuild.js.map +1 -1
  46. package/lib/transpilers/esnode.js +8 -0
  47. package/lib/transpilers/esnode.js.map +1 -0
  48. package/lib/transpilers/esvue.js +29 -0
  49. package/lib/transpilers/esvue.js.map +1 -0
  50. package/lib/{esnode.js → transpilers/tsnode-exp.js} +7 -5
  51. package/lib/transpilers/tsnode-exp.js.map +1 -0
  52. package/lib/{tsnode.js → transpilers/tsnode.js} +4 -1
  53. package/lib/transpilers/tsnode.js.map +1 -0
  54. package/lib/transpilers/tsvue-exp.d.ts +1 -0
  55. package/lib/{esvue.js → transpilers/tsvue-exp.js} +8 -6
  56. package/lib/transpilers/tsvue-exp.js.map +1 -0
  57. package/lib/transpilers/tsvue.d.ts +1 -0
  58. package/lib/{tsvue.js → transpilers/tsvue.js} +5 -2
  59. package/lib/transpilers/tsvue.js.map +1 -0
  60. package/lib/tsconfig.node.tsbuildinfo +1 -1
  61. package/lib/version.d.ts +1 -1
  62. package/lib/version.js +1 -1
  63. package/lib/version.js.map +1 -1
  64. package/package.json +12 -7
  65. package/lib/cli/load-configuration.d.ts +0 -21
  66. package/lib/cli/load-configuration.js +0 -124
  67. package/lib/cli/load-configuration.js.map +0 -1
  68. package/lib/cucumber/coordinator.d.ts +0 -15
  69. package/lib/cucumber/coordinator.js +0 -40
  70. package/lib/cucumber/coordinator.js.map +0 -1
  71. package/lib/cucumber/make-runtime.d.ts +0 -21
  72. package/lib/cucumber/make-runtime.js +0 -17
  73. package/lib/cucumber/make-runtime.js.map +0 -1
  74. package/lib/cucumber/managed-scenario-context.d.ts +0 -52
  75. package/lib/cucumber/managed-scenario-context.js +0 -149
  76. package/lib/cucumber/managed-scenario-context.js.map +0 -1
  77. package/lib/cucumber/message-collector.d.ts +0 -87
  78. package/lib/cucumber/message-collector.js +0 -280
  79. package/lib/cucumber/message-collector.js.map +0 -1
  80. package/lib/cucumber/parallel/adapter.d.ts +0 -46
  81. package/lib/cucumber/parallel/adapter.js +0 -156
  82. package/lib/cucumber/parallel/adapter.js.map +0 -1
  83. package/lib/cucumber/parallel/run-worker.d.ts +0 -1
  84. package/lib/cucumber/parallel/run-worker.js +0 -24
  85. package/lib/cucumber/parallel/run-worker.js.map +0 -1
  86. package/lib/cucumber/parallel/worker.d.ts +0 -26
  87. package/lib/cucumber/parallel/worker.js +0 -95
  88. package/lib/cucumber/parallel/worker.js.map +0 -1
  89. package/lib/cucumber/run-cucumber.d.ts +0 -16
  90. package/lib/cucumber/run-cucumber.js +0 -139
  91. package/lib/cucumber/run-cucumber.js.map +0 -1
  92. package/lib/cucumber/serial/adapter.d.ts +0 -12
  93. package/lib/cucumber/serial/adapter.js +0 -24
  94. package/lib/cucumber/serial/adapter.js.map +0 -1
  95. package/lib/cucumber/test-case-info.d.ts +0 -23
  96. package/lib/cucumber/test-case-info.js +0 -3
  97. package/lib/cucumber/test-case-info.js.map +0 -1
  98. package/lib/cucumber/test-case-runner.d.ts +0 -48
  99. package/lib/cucumber/test-case-runner.js +0 -359
  100. package/lib/cucumber/test-case-runner.js.map +0 -1
  101. package/lib/cucumber/utils.d.ts +0 -16
  102. package/lib/cucumber/utils.js +0 -78
  103. package/lib/cucumber/utils.js.map +0 -1
  104. package/lib/cucumber/worker.d.ts +0 -17
  105. package/lib/cucumber/worker.js +0 -57
  106. package/lib/cucumber/worker.js.map +0 -1
  107. package/lib/esnode.js.map +0 -1
  108. package/lib/esvue.js.map +0 -1
  109. package/lib/formatters/behave-json-formatter.d.ts +0 -49
  110. package/lib/formatters/behave-json-formatter.js +0 -85
  111. package/lib/formatters/behave-json-formatter.js.map +0 -1
  112. package/lib/formatters/junit-bamboo-formatter.d.ts +0 -17
  113. package/lib/formatters/junit-bamboo-formatter.js +0 -175
  114. package/lib/formatters/junit-bamboo-formatter.js.map +0 -1
  115. package/lib/formatters/tsflow-snippet-syntax.d.ts +0 -9
  116. package/lib/formatters/tsflow-snippet-syntax.js +0 -89
  117. package/lib/formatters/tsflow-snippet-syntax.js.map +0 -1
  118. package/lib/runtime/parallel/types.js.map +0 -1
  119. package/lib/tsnode.js.map +0 -1
  120. package/lib/tsvue.js.map +0 -1
  121. package/lib/types/parallel.d.ts +0 -11
  122. package/lib/types/parallel.js +0 -3
  123. package/lib/types/parallel.js.map +0 -1
  124. package/lib/types/scenario-context.d.ts +0 -16
  125. package/lib/types/scenario-context.js +0 -18
  126. package/lib/types/scenario-context.js.map +0 -1
  127. package/lib/types/scenario-info.d.ts +0 -16
  128. package/lib/types/scenario-info.js +0 -23
  129. package/lib/types/scenario-info.js.map +0 -1
  130. package/lib/types/step-binding-flags.d.ts +0 -53
  131. package/lib/types/step-binding-flags.js +0 -59
  132. package/lib/types/step-binding-flags.js.map +0 -1
  133. package/lib/types/step-binding.d.ts +0 -60
  134. package/lib/types/step-binding.js +0 -18
  135. package/lib/types/step-binding.js.map +0 -1
  136. package/lib/types/types.d.ts +0 -22
  137. package/lib/types/types.js +0 -3
  138. package/lib/types/types.js.map +0 -1
  139. /package/lib/runtime/{parallel/types.js → types.js} +0 -0
  140. /package/lib/{esnode.d.ts → transpilers/esnode.d.ts} +0 -0
  141. /package/lib/{esvue.d.ts → transpilers/esvue.d.ts} +0 -0
  142. /package/lib/{tsnode.d.ts → transpilers/tsnode-exp.d.ts} +0 -0
  143. /package/lib/{tsvue.d.ts → transpilers/tsnode.d.ts} +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # cucumber-tsflow
4
4
 
5
- Provides 'specflow' like bindings for CucumberJS 11.2.0 in TypeScript 5.8+.
5
+ Provides 'specflow' like bindings for Cucumber-JS 11.3.0 in TypeScript 5.8+.
6
6
 
7
7
  Supports Vue3 files in cucumber tests.
8
8
 
@@ -12,6 +12,14 @@ This is a detached fork of <https://github.com/timjroberts/cucumber-js-tsflow>.
12
12
 
13
13
  This fork has been drastically modified from the original and will eventually be moved to a new project. In addition, the SpecFlow project has reached [end of life](https://reqnroll.net/news/2025/01/specflow-end-of-life-has-been-announced/), and this project will be rebranded. Further details will be provided in future updates. However, the new project will support the same functionality as cucumber-tsflow while providing additional tools and extensions.
14
14
 
15
+ ## Release Updates (7.2.0)
16
+
17
+ With this release, support for **Experimental Decorators** was added for backwards compatibility with any code under test that is using experimental decorators.
18
+
19
+ - Cucumber-JS updated to version 11.3.0
20
+ - New configuration parameter named **experimentalDecorators** that can be used to enable support for older experimental decorators.
21
+ - Issue with using the companion [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=lynxwall.cucumber-tsflow-vscode) has been resolved.
22
+
15
23
  ## Release Updates (7.1.0)
16
24
 
17
25
  With this latest release, cucumber-tsflow has been refactored to support cucumber-js version 11.2.0 along with other updates that include:
@@ -20,7 +28,6 @@ With this latest release, cucumber-tsflow has been refactored to support cucumbe
20
28
  - **API support** that implements and extends the cucumber-js API.
21
29
  - Support for Node 22 and Typescript 5.8.
22
30
  - Switched to **official Typescript Decorators** with metadata support implemented in [Typescript 5.2](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#decorator-metadata).
23
- **NOTE:** Please **remove *experimentalDecorators*** from your TypeScript configuration as it is no longer supported with the update to use official decorators, which are very different.
24
31
  - Transpiler configuration updates to support node and Typescript changes.
25
32
  - Added a new section to this readme that describes [Transpilers and TypeScript](#transpilers-and-typescript) in more detail.
26
33
 
@@ -39,6 +46,8 @@ This fork of cucumber-tsflow provides the following features that extend the ori
39
46
 
40
47
  - CommonJS transpilers using either esbuild or ts-node.
41
48
 
49
+ - Support for both Official and Experimental Decorators in TypeScript.
50
+
42
51
  - Vue3 transformer used to handle .vue files in tests.
43
52
 
44
53
  **NOTE**: Supports browserless unit testing of Vue SFC components by loading only the `<template>` and `<script>` blocks. Vue SFC `<style>` blocks are disabled by default. However, when testing Vue components from a compiled library, styles can be enabled with the `enableVueStyle` configuration setting.
@@ -69,7 +78,7 @@ This fork of cucumber-tsflow provides the following features that extend the ori
69
78
 
70
79
  ## Quick Start
71
80
 
72
- cucumber-tsflow uses TypeScript Decorators to create SpecFlow like bindings for TypeScript classes and methods that allow those classes and methods to be used in your CucumberJS support files. As such, cucumber-tsflow has a dependency on CucumberJS and extends CucumberJS functionality. However, you run your specifications using the cucumber-tsflow command line tool.
81
+ cucumber-tsflow uses TypeScript Decorators to create bindings for TypeScript classes and methods that allow those classes and methods to be used in your Cucumber-JS support files. As such, cucumber-tsflow has a dependency on Cucumber-JS and extends Cucumber-JS functionality. However, you run your specifications using the cucumber-tsflow command line tool.
73
82
 
74
83
  ### Install @lynxwall/cucumber-tsflow
75
84
 
@@ -95,7 +104,7 @@ yarn add --dev @lynxwall/cucumber-tsflow
95
104
 
96
105
  ### Create .feature files to describe your specifications
97
106
 
98
- By default, CucumberJS looks for .feature files in a folder called 'features', so create that folder and then create a new file called 'my_feature.feature':
107
+ By default, Cucumber-JS looks for .feature files in a folder called 'features', so create that folder and then create a new file called 'my_feature.feature':
99
108
 
100
109
  ```gherkin
101
110
  # features/my_feature.feature
@@ -111,7 +120,11 @@ Feature: Example Feature
111
120
 
112
121
  ### Create the Support Files to support the Feature
113
122
 
114
- By default, CucumberJS looks for support files beneath the 'features' folder. You can override this on the cucumber-tsflow command line by specifying the '-r' option. However, let's work with the default and create our code in the default location. We need to write step definitions to support the three steps that we created above.
123
+ <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;">
124
+ <strong><span style="color: #000">Note:</span></strong> Cucumber-JS refers to any files that are used to implement tests (step definitions) along with any fixtures or utilities used in your tests as <strong><span style="color: #000">Support Files</span></strong>. As a result, any time you see references to support files or support code it is referring to test code.
125
+ </div>
126
+
127
+ By default, Cucumber-JS looks for support files beneath the 'features' folder. You can override this on the cucumber-tsflow command line by specifying the '-r' option. However, let's work with the default and create our code in the default location. We need to write step definitions to support the three steps that we created above.
115
128
 
116
129
  Create a new 'ArithmeticSteps.ts' file:
117
130
 
@@ -147,17 +160,15 @@ export default class ArithmeticSteps {
147
160
 
148
161
  ### Compiling your TypeScript Support Code
149
162
 
150
- If not using one of the [transpilers](#transpiler-and-vue3-supported) listed below you'll need a `tsconfig.json` file to compile your code. You'll also need to ensure that the `"moduleResolution": "node"` compiler option is set in order to bring in the typings that are shipped with cucumber-tsflow.
163
+ All support code, which includes your step definition files along with any test fixtures, utilities and references to source code are transpiled on the fly using transpilers that are included with cucumber-tsflow. This eliminates the requirement to prebuild any test code along with associated management of those builds.
151
164
 
152
- Running the cucumber-tsflow command will execute your features along with the support code that you've created in the class.
153
-
154
- In this quick example test state is encapsulated directly in the class. As your test suite grows larger and step definitions get shared between multiple classes, you can begin using '[Context Injection](#context-injection)' to share state between running step definitions.
165
+ If not using one of the [transpilers](#transpiler-and-vue3-supported) listed below you'll need to implement your own transpiler using guidance found in Cucumber-JS documentation: [Transpiling](https://github.com/cucumber/cucumber-js/blob/v11.3.0/docs/transpiling.md)
155
166
 
156
167
  ## Transpilers and TypeScript
157
168
 
158
169
  Cucumber-tsflow provides several [transpilers](#transpiler-and-vue3-supported) that can be used in your configuration. However, you are not required to use them. If a different configuration or transpiler is needed you can copy code from one of the provided transpilers.
159
170
 
160
- This section focuses on the Typescript configuration used to transpile your test code, and any dependencies, into JavaScript that is executed within the cucumber-js test runner.
171
+ This section focuses on the configuration used to transpile your test code, and any dependencies, into JavaScript that is executed within the Cucumber-JS test runner.
161
172
 
162
173
  ### CommonJS and ESM
163
174
 
@@ -165,20 +176,46 @@ The transpilers included with cucumber-tsflow transpile to **CommonJS** and do n
165
176
 
166
177
  ### TypeScript Configuration
167
178
 
168
- All of the transpilers included with cucumber-tsflow use the same TypeScript configuration, which take precedence when running your tests using one of these transpilers. In other words, while each transpiler is different, they all use the same tsconfig settings, which are shown below:
179
+ There are two different bundlers, or transpilers, used in cucumber-tsflow: **ts-node** and **esbuild**. This section covers the typescript configuration used for each bundler. Included with cucumber-ts are six variations of these transpilers used to support different types of projects. However, there are only two variations of typescript configurations used for each bundler, one that uses official decorators and one that uses experimental decorators.
180
+
181
+ #### ts-node
182
+
183
+ The following typescript configuration is used in the ts-node transpilers configured for official decorators:
169
184
 
170
185
  ```typescript
171
186
  compilerOptions: {
172
187
  module: 'nodeNext',
173
188
  target: 'es2022',
174
189
  strict: true,
175
- resolveJsonModule: true,
190
+ allowJs: true,
191
+ allowSyntheticDefaultImports: true,
176
192
  esModuleInterop: true,
193
+ experimentalDecorators: false,
194
+ resolveJsonModule: true,
177
195
  skipLibCheck: true,
178
196
  lib: ['es2022', 'esnext.decorators']
179
- },
197
+ }
198
+ ```
199
+
200
+ This next typescript configuration is used in the ts-node transpilers configured for official decorators:
201
+
202
+ ```typescript
203
+ compilerOptions: {
204
+ module: 'nodeNext',
205
+ target: 'es2022',
206
+ strict: true,
207
+ allowJs: true,
208
+ allowSyntheticDefaultImports: true,
209
+ esModuleInterop: true,
210
+ experimentalDecorators: true,
211
+ resolveJsonModule: true,
212
+ skipLibCheck: true,
213
+ lib: ['es2022']
214
+ }
180
215
  ```
181
216
 
217
+ As you can see the only difference is the setting for experimentalDecorators and the lib imports.
218
+
182
219
  When test runs are started, the settings from your local tsconfig.json are loaded first and then the settings from the transpiler will override the specific settings shown above. As a result, you should use these transpilers in projects that will support these settings.
183
220
 
184
221
  For example, the settings from the cucumber-tsflow vue test project is shown below:
@@ -186,33 +223,34 @@ For example, the settings from the cucumber-tsflow vue test project is shown bel
186
223
  ```json
187
224
  "compilerOptions": {
188
225
  "baseUrl": ".",
226
+ "module": "nodeNext",
189
227
  "target": "es2022",
190
- "module": "Node18",
191
228
  "strict": true,
192
- "importHelpers": true,
193
- "skipLibCheck": true,
194
- "esModuleInterop": true,
195
- "forceConsistentCasingInFileNames": true,
196
- "useDefineForClassFields": true,
197
- "inlineSourceMap": true,
198
229
  "allowJs": true,
199
- "removeComments": false,
230
+ "allowSyntheticDefaultImports": true,
231
+ "esModuleInterop": true,
232
+ "resolveJsonModule": true,
233
+ "skipLibCheck": true,
200
234
  "lib": ["es2022", "esnext.decorators"],
201
235
  "typeRoots": ["../../node_modules/@types"]
202
- },
236
+ }
203
237
  ```
204
238
 
205
- These settings are similar to the default transpiler settings, which will not cause an issue. The only change will be the module from Node18 to nodeNext. Any other settings that are not included in the transpiler default will also be applied when the transpiler is executed.
239
+ These settings are similar to the default transpiler settings, which will not cause an issue.
206
240
 
207
241
  ### esbuild Transpilers
208
242
 
209
- Cucumber-tsflow provides two esbuild transpilers: one with esbuild and support for Vue using the vue-sfc transpiler, and another that only uses the esbuild transpiler. Both cucumber-tsflow transpilers use the same esbuild transpiler, which is configured to generate CommonJS, as shown below:
243
+ <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;">
244
+ <strong><span style="color: #000">Note:</span></strong> The esbuild transpilers do not use compilerOptions from tsconfig. Instead, all of the options are configured within the esbuild module that's included with cucumber-tsflow.
245
+ </div>
246
+
247
+ Cucumber-tsflow provides two esbuild transpilers: one with esbuild and support for Vue using the vue-sfc transpiler, and another that only uses the esbuild transpiler. Both cucumber-tsflow transpilers use the same esbuild transpiler, which uses the following Common set of options:
210
248
 
211
249
  ```typescript
212
250
  const commonOptions: CommonOptions = {
213
251
  format: 'cjs',
214
252
  logLevel: 'info',
215
- target: [`es2020`],
253
+ target: [`es2022`],
216
254
  minify: false,
217
255
  sourcemap: 'external'
218
256
  };
@@ -220,6 +258,35 @@ const commonOptions: CommonOptions = {
220
258
 
221
259
  As you can see, this also uses the same target as the typescript configuration. In addition, minify is set to false, which makes it easy to debug and step into code when running tests.
222
260
 
261
+ In order to support both official and experimental decorators the esbuild transpiler will use different configurations based on the experimentalDecorators flag in the cucumber configuration.
262
+
263
+ #### Official Decorators
264
+
265
+ When using official decorators the following settings are added using the esbuild tsconfigRaw setting.
266
+
267
+ ```typescript
268
+ commonOptions.tsconfigRaw = {
269
+ compilerOptions: {
270
+ importsNotUsedAsValues: 'remove',
271
+ strict: true
272
+ }
273
+ };
274
+ ```
275
+
276
+ #### Experimental Decorators
277
+
278
+ When using experimental decorators the experimentalDecorators setting is added to the tsconfigRaw settings. As mentioned, esbuild does not use tsconfig settings from ts-node or from a tsconfig file. As a result, this is the only option available to turn on experimental decorators when using esbuild.
279
+
280
+ ```typescript
281
+ commonOptions.tsconfigRaw = {
282
+ compilerOptions: {
283
+ experimentalDecorators: true,
284
+ importsNotUsedAsValues: 'remove',
285
+ strict: true
286
+ }
287
+ };
288
+ ```
289
+
223
290
  As mentioned at the beginning of this section, there are several transpilers provided, which can be used with your test project. The [transpilers](#transpiler-and-vue3-supported) section below provides information on how to configure your project to use one of these transpilers.
224
291
 
225
292
  ## Cucumber-tsflow Test Runner
@@ -229,22 +296,23 @@ As mentioned previously, with recent updates cucumber-tsflow must be used to exe
229
296
  The following example demonstrates executing cucumber-tsflow from the command line to execute tests:
230
297
 
231
298
  ```bash
232
- C:\GitHub\cucumber-js-tsflow (dev -> origin)
233
- λ npx cucumber-tsflow
234
- Loading configuration and step definitions...
299
+ C:\GitHub\cucumber-js-tsflow\cucumber-tsflow-specs\node (dev-0525 -> origin)
300
+ λ npx cucumber-tsflow -p esnode
301
+ Loading configuration from "cucumber.json".
302
+ Running Cucumber-TsFlow in Serial mode.
235
303
 
236
304
  beforeAll was called
237
- ......@basic after hook is called.
305
+ ......................@basic after hook is called.
238
306
  .......@basic after hook is called.
239
307
  .......@basic after hook is called.
240
- ...........@tags1 after hook is called.
308
+ .......................................@tags1 after hook is called.
241
309
  ......@tagging afterTag method is called
242
- .........<Suspense> is an experimental feature and its API will likely change.
243
- ..afterAll was called
310
+ .afterAll was called
311
+
244
312
 
245
- 8 scenarios (8 passed)
246
- 24 steps (24 passed)
247
- 0m00.076s (executing steps: 0m00.040s)
313
+ 15 scenarios (15 passed)
314
+ 44 steps (44 passed)
315
+ 0m00.072s (executing steps: 0m00.013s)
248
316
  ```
249
317
 
250
318
  To recap, cucumber-tsflow extends cucumber-js, which means that all options and features provided by cucumber-js are supported with cucumber-tsflow. In other words, when executing tests using cucumber-tsflow the underlying cucumber API is actually used to run the tests.
@@ -255,7 +323,7 @@ You can also add a script to package.json to execute the tests as shown below:
255
323
 
256
324
  ```json
257
325
  "scripts": {
258
- "test": "cucumber-tsflow -p default"
326
+ "test": "cucumber-tsflow -p esnode"
259
327
  }
260
328
  ```
261
329
 
@@ -313,32 +381,33 @@ echo $?
313
381
 
314
382
  ## New Configuration options
315
383
 
316
- As mentioned, when using cucumber-tsflow to execute tests all of the configuration options documented here are supported: <https://github.com/cucumber/cucumber-js/blob/v11.2.0/docs/configuration.md>
384
+ As mentioned, when using cucumber-tsflow to execute tests all of the configuration options documented here are supported: <https://github.com/cucumber/cucumber-js/blob/v11.3.0/docs/configuration.md>
317
385
 
318
386
  In addition to cucumber configuration options the following two options have been added:
319
387
 
320
- | Name | Type | Repeatable | CLI Option | Description | Default |
321
- | ---------------- | --------- | ---------- | -------------------- | ------------------------------------------------------------- | ------- |
322
- | `transpiler` | `string` | No | `--transpiler` | Name of the transpiler to use: esnode, esvue, tsnode or tsvue | esnode |
323
- | `debugFile` | `string` | No | `--debug-file` | Path to a file with steps for debugging | |
324
- | `enableVueStyle` | `boolean` | No | `--enable-vue-style` | Enable Vue `<style>` block when compiling Vue SFC. | false |
388
+ | Name | Type | Repeatable | CLI Option | Description | Default |
389
+ | ------------------------ | --------- | ---------- | --------------------------- | ------------------------------------------------------------ | ------- |
390
+ | `transpiler` | `string` | No | `--transpiler` | Name of the transpiler to use: esnode, esvue, tsnode or tsvue | esnode |
391
+ | `debugFile` | `string` | No | `--debug-file` | Path to a file with steps for debugging | |
392
+ | `enableVueStyle` | `boolean` | No | `--enable-vue-style` | Enable Vue `<style>` block when compiling Vue SFC. | false |
393
+ | `experimentalDecorators` | `boolean` | No | `--experimental-decorators` | Enable TypeScript Experimental Decorators. | false |
325
394
 
326
395
  ### Transpiler and Vue3 supported
327
396
 
328
- Using TypeScript with cucumber-js requires setting tsconfig.json parameters as described here: [cucumber-js 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 cucumber-js.
397
+ Using TypeScript with cucumber-js requires setting tsconfig.json parameters as described here: [cucumber-js Transpiling](https://github.com/cucumber/cucumber-js/blob/v11.3.0/docs/transpiling.md). In addition, there is no support for transpiling Vue files with cucumber-js.
329
398
 
330
399
  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.
331
400
 
332
401
  **NOTE**: By default, the `<style>` block in Vue SFC components will not be loaded when .vue files are transformed. However, that behavior can be overridden when testing compiled Vue components from a library using the `enableVueStyle` configuration setting.
333
402
 
334
- The following transpilers are provided:
403
+ Cucumber-TsFlow provides the following transpilers:
335
404
 
336
- - **esnode**: Uses esbuild to transpile TypeScript code for node test execution.
337
- - **esvue**: Uses esbuild to transpile TypeScript code and adds a hook for .vue files, which transforms Vue SFC components into commonJS.
338
- - **jsdom** is also loaded globally to support loading and testing Vue SFC components.
339
- - **tsnode**: Uses typescript to transpile TypeScript code for node test execution.
340
- - **tsvue**: Uses typescript to transpile TypeScript code and adds a hook for .vue files, which transforms Vue SFC components into commonJS.
341
- - **jsdom** is also loaded globally to support loading and testing Vue SFC components.
405
+ | Name | Bundler | Description |
406
+ | ---------- | ------- | ------------------------------------------------------------ |
407
+ | **esnode** | esbuild | Uses esbuild to transpile TypeScript code for node test execution. |
408
+ | **esvue** | esbuild | Uses esbuild to transpile TypeScript code and adds a hook for .vue files, which transforms Vue SFC components into common-JS. **jsdom** is also loaded globally to support loading and testing Vue SFC components. |
409
+ | **tsnode** | ts-node | Uses typescript to transpile TypeScript code for node test execution.<br />**NOTE:** When Experimental Decorators are enabled, cucumber-tsflow loads a different transpiler named tsnode-exp. |
410
+ | **tsvue** | ts-node | Uses typescript to transpile TypeScript code and adds a hook for .vue files, which transforms Vue SFC components into common-JS. **jsdom** is also loaded globally to support loading and testing Vue SFC components.<br />**NOTE:** When Experimental Decorators are enabled, cucumber-tsflow loads a different transpiler named tsvue-exp. |
342
411
 
343
412
  <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;">
344
413
  <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>
@@ -513,7 +582,7 @@ public givenAValueBasedSearch(searchValue: string): void {
513
582
  }
514
583
  ```
515
584
 
516
- **Note**: Tags added to steps work the same as "Tagged Hooks" documented here: <https://github.com/cucumber/cucumber-js/blob/v11.2.0/docs/support_files/hooks.md>
585
+ **Note**: Tags added to steps work the same as "Tagged Hooks" documented here: <https://github.com/cucumber/cucumber-js/blob/v11.3.0/docs/support_files/hooks.md>
517
586
 
518
587
  ## Hooks
519
588
 
@@ -589,7 +658,7 @@ public givenAValueBasedSearch(searchValue: string): void {
589
658
 
590
659
  tsflow currently doesn't have a way to define a global default step timeout,
591
660
 
592
- but it can be easily done through CucumberJS `setDefaultTimeout` function.
661
+ but it can be easily done through Cucumber-JS `setDefaultTimeout` function.
593
662
 
594
663
  ### Passing WrapperOptions
595
664
 
@@ -608,7 +677,7 @@ public givenAValueBasedSearch(searchValue: string): void {
608
677
 
609
678
  ### Using different report formatters and tsflow-snippet-syntax
610
679
 
611
- Changing the formatter used for generating json along with changing the Snippet Syntax can be done through the CucumberJS configuration file.
680
+ Changing the formatter used for generating json along with changing the Snippet Syntax can be done through the Cucumber-JS configuration file.
612
681
 
613
682
  If it doesn't already exist, create a file named cucumber.json at the root of your project. This is where we can configure different options for CucumberJS.
614
683
 
@@ -0,0 +1,7 @@
1
+ import { IConfiguration } from '@cucumber/cucumber/lib/configuration/index';
2
+ import { ILogger } from '@cucumber/cucumber/lib/environment/index';
3
+ import { ITsFlowRunConfiguration } from '../runtime/types';
4
+ export interface IConfigurationExt extends IConfiguration {
5
+ experimentalDecorators: boolean;
6
+ }
7
+ export declare function convertConfiguration(logger: ILogger, flatConfiguration: IConfigurationExt, env: NodeJS.ProcessEnv): Promise<ITsFlowRunConfiguration>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertConfiguration = convertConfiguration;
4
+ const index_1 = require("@cucumber/cucumber/lib/configuration/index");
5
+ async function convertConfiguration(logger, flatConfiguration, env) {
6
+ return {
7
+ sources: {
8
+ paths: flatConfiguration.paths,
9
+ defaultDialect: flatConfiguration.language,
10
+ names: flatConfiguration.name,
11
+ tagExpression: flatConfiguration.tags,
12
+ order: flatConfiguration.order
13
+ },
14
+ support: {
15
+ requireModules: flatConfiguration.requireModule,
16
+ requirePaths: flatConfiguration.require,
17
+ importPaths: flatConfiguration.import,
18
+ loaders: flatConfiguration.loader
19
+ },
20
+ runtime: {
21
+ dryRun: flatConfiguration.dryRun,
22
+ experimentalDecorators: flatConfiguration.experimentalDecorators,
23
+ failFast: flatConfiguration.failFast,
24
+ filterStacktraces: !flatConfiguration.backtrace,
25
+ parallel: flatConfiguration.parallel,
26
+ retry: flatConfiguration.retry,
27
+ retryTagFilter: flatConfiguration.retryTagFilter,
28
+ strict: flatConfiguration.strict,
29
+ worldParameters: flatConfiguration.worldParameters
30
+ },
31
+ formats: convertFormats(logger, flatConfiguration, env)
32
+ };
33
+ }
34
+ function convertFormats(logger, flatConfiguration, env) {
35
+ const splitFormats = flatConfiguration.format.map(item => Array.isArray(item) ? item : (0, index_1.splitFormatDescriptor)(logger, item));
36
+ return {
37
+ stdout: [...splitFormats].reverse().find(([, target]) => !target)?.[0] ?? 'progress',
38
+ files: splitFormats
39
+ .filter(([, target]) => !!target)
40
+ .reduce((mapped, [type, target]) => {
41
+ return {
42
+ ...mapped,
43
+ [target]: type
44
+ };
45
+ }, {}),
46
+ publish: makePublishConfig(flatConfiguration, env),
47
+ options: flatConfiguration.formatOptions
48
+ };
49
+ }
50
+ function makePublishConfig(flatConfiguration, env) {
51
+ const enabled = isPublishing(flatConfiguration, env);
52
+ if (!enabled) {
53
+ return false;
54
+ }
55
+ return {
56
+ url: env.CUCUMBER_PUBLISH_URL,
57
+ token: env.CUCUMBER_PUBLISH_TOKEN
58
+ };
59
+ }
60
+ function isPublishing(flatConfiguration, env) {
61
+ return (flatConfiguration.publish ||
62
+ (0, index_1.isTruthyString)(env.CUCUMBER_PUBLISH_ENABLED) ||
63
+ env.CUCUMBER_PUBLISH_TOKEN !== undefined);
64
+ }
65
+ //# sourceMappingURL=convert-configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-configuration.js","sourceRoot":"","sources":["../../src/api/convert-configuration.ts"],"names":[],"mappings":";;AAYA,oDAgCC;AA5CD,sEAAmH;AAY5G,KAAK,UAAU,oBAAoB,CACzC,MAAe,EACf,iBAAoC,EACpC,GAAsB;IAEtB,OAAO;QACN,OAAO,EAAE;YACR,KAAK,EAAE,iBAAiB,CAAC,KAAK;YAC9B,cAAc,EAAE,iBAAiB,CAAC,QAAQ;YAC1C,KAAK,EAAE,iBAAiB,CAAC,IAAI;YAC7B,aAAa,EAAE,iBAAiB,CAAC,IAAI;YACrC,KAAK,EAAE,iBAAiB,CAAC,KAAK;SAC9B;QACD,OAAO,EAAE;YACR,cAAc,EAAE,iBAAiB,CAAC,aAAa;YAC/C,YAAY,EAAE,iBAAiB,CAAC,OAAO;YACvC,WAAW,EAAE,iBAAiB,CAAC,MAAM;YACrC,OAAO,E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AAI;aACd,CAAC;QACH,CAAC,EAAE,EAAE,CAAC;QACP,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,EAAE,GAAG,CAAC;QAClD,OAAO,EAAE,iBAAiB,CAAC,aAAa;KACxC,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,iBAAiC,EAAE,GAAsB;IACnF,MAAM,OAAO,GAAG,YAAY,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IACrD,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO;QACN,GAAG,EAAE,GAAG,CAAC,oBAAoB;QAC7B,KAAK,EAAE,GAAG,CAAC,sBAAsB;KACjC,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,iBAAiC,EAAE,GAAsB;IAC9E,OAAO,CACN,iBAAiB,CAAC,OAAO;QACzB,IAAA,sBAAc,EAAC,GAAG,CAAC,wBAAwB,CAAC;QAC5C,GAAG,CAAC,sBAAsB,KAAK,SAAS,CACxC,CAAC;AACH,CAAC","sourcesContent":["import { IConfiguration, isTruthyString, splitFormatDescriptor } from '@cucumber/cucumber/lib/configuration/index';\r\nimport { IPublishConfig } from '@cucumber/cucumber/lib/publish/index';\r\nimport { ILogger } from '@cucumber/cucumber/lib/environment/index';\r\n\r\n// imports the namespace needed for NodeJS - keeps eslint happy\r\nimport NodeJS from 'node:process';\r\nimport { ITsFlowRunConfiguration } from '../runtime/types';\r\n\r\nexport interface IConfigurationExt extends IConfiguration {\r\n\texperimentalDecorators: boolean;\r\n}\r\n\r\nexport async function convertConfiguration(\r\n\tlogger: ILogger,\r\n\tflatConfiguration: IConfigurationExt,\r\n\tenv: NodeJS.ProcessEnv\r\n): Promise<ITsFlowRunConfiguration> {\r\n\treturn {\r\n\t\tsources: {\r\n\t\t\tpaths: flatConfiguration.paths,\r\n\t\t\tdefaultDialect: flatConfiguration.language,\r\n\t\t\tnames: flatConfiguration.name,\r\n\t\t\ttagExpression: flatConfiguration.tags,\r\n\t\t\torder: flatConfiguration.order\r\n\t\t},\r\n\t\tsupport: {\r\n\t\t\trequireModules: flatConfiguration.requireModule,\r\n\t\t\trequirePaths: flatConfiguration.require,\r\n\t\t\timportPaths: flatConfiguration.import,\r\n\t\t\tloaders: flatConfiguration.loader\r\n\t\t},\r\n\t\truntime: {\r\n\t\t\tdryRun: flatConfiguration.dryRun,\r\n\t\t\texperimentalDecorators: flatConfiguration.experimentalDecorators,\r\n\t\t\tfailFast: flatConfiguration.failFast,\r\n\t\t\tfilterStacktraces: !flatConfiguration.backtrace,\r\n\t\t\tparallel: flatConfiguration.parallel,\r\n\t\t\tretry: flatConfiguration.retry,\r\n\t\t\tretryTagFilter: flatConfiguration.retryTagFilter,\r\n\t\t\tstrict: flatConfiguration.strict,\r\n\t\t\tworldParameters: flatConfiguration.worldParameters\r\n\t\t},\r\n\t\tformats: convertFormats(logger, flatConfiguration, env)\r\n\t};\r\n}\r\n\r\nfunction convertFormats(logger: ILogger, flatConfiguration: IConfiguration, env: NodeJS.ProcessEnv) {\r\n\tconst splitFormats: string[][] = flatConfiguration.format.map(item =>\r\n\t\tArray.isArray(item) ? item : splitFormatDescriptor(logger, item)\r\n\t);\r\n\treturn {\r\n\t\tstdout: [...splitFormats].reverse().find(([, target]) => !target)?.[0] ?? 'progress',\r\n\t\tfiles: splitFormats\r\n\t\t\t.filter(([, target]) => !!target)\r\n\t\t\t.reduce((mapped, [type, target]) => {\r\n\t\t\t\treturn {\r\n\t\t\t\t\t...mapped,\r\n\t\t\t\t\t[target]: type\r\n\t\t\t\t};\r\n\t\t\t}, {}),\r\n\t\tpublish: makePublishConfig(flatConfiguration, env),\r\n\t\toptions: flatConfiguration.formatOptions\r\n\t};\r\n}\r\n\r\nfunction makePublishConfig(flatConfiguration: IConfiguration, env: NodeJS.ProcessEnv): IPublishConfig | false {\r\n\tconst enabled = isPublishing(flatConfiguration, env);\r\n\tif (!enabled) {\r\n\t\treturn false;\r\n\t}\r\n\treturn {\r\n\t\turl: env.CUCUMBER_PUBLISH_URL,\r\n\t\ttoken: env.CUCUMBER_PUBLISH_TOKEN\r\n\t};\r\n}\r\n\r\nfunction isPublishing(flatConfiguration: IConfiguration, env: NodeJS.ProcessEnv): boolean {\r\n\treturn (\r\n\t\tflatConfiguration.publish ||\r\n\t\tisTruthyString(env.CUCUMBER_PUBLISH_ENABLED) ||\r\n\t\tenv.CUCUMBER_PUBLISH_TOKEN !== undefined\r\n\t);\r\n}\r\n"]}
@@ -10,6 +10,7 @@ export { IConfiguration } from '@cucumber/cucumber/lib/configuration/index';
10
10
  export { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';
11
11
  export { IPickleOrder } from '@cucumber/cucumber/lib/filter/index';
12
12
  export { IPublishConfig } from '@cucumber/cucumber/lib/publish/index';
13
+ export * from './convert-configuration';
13
14
  export * from './load-configuration';
14
15
  export * from '@cucumber/cucumber/lib/api/load_sources';
15
16
  export * from './load-support';
package/lib/api/index.js CHANGED
@@ -22,6 +22,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
22
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
+ __exportStar(require("./convert-configuration"), exports);
25
26
  __exportStar(require("./load-configuration"), exports);
26
27
  __exportStar(require("@cucumber/cucumber/lib/api/load_sources"), exports);
27
28
  __exportStar(require("./load-support"), exports);
@@ -1 +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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAMH,0DAAwC;AACxC,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 './convert-configuration';\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"]}
@@ -1,6 +1,7 @@
1
- import { ILoadConfigurationOptions, IRunConfiguration } from '@cucumber/cucumber/lib/api/types';
1
+ import { ILoadConfigurationOptions } from '@cucumber/cucumber/lib/api/types';
2
2
  import { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';
3
3
  import { ITsflowConfiguration } from '../cli/argv-parser';
4
+ import { ITsFlowRunConfiguration } from '../runtime/types';
4
5
  export interface ITsflowResolvedConfiguration {
5
6
  /**
6
7
  * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.
@@ -9,7 +10,7 @@ export interface ITsflowResolvedConfiguration {
9
10
  /**
10
11
  * The format that can be passed into `runCucumber`.
11
12
  */
12
- runConfiguration: IRunConfiguration;
13
+ runConfiguration: ITsFlowRunConfiguration;
13
14
  }
14
15
  /**
15
16
  * Load user-authored configuration to be used in a test run.
@@ -7,11 +7,12 @@ exports.loadConfiguration = void 0;
7
7
  const locate_file_1 = require("@cucumber/cucumber/lib/configuration/locate_file");
8
8
  const index_1 = require("@cucumber/cucumber/lib/configuration/index");
9
9
  const validate_configuration_1 = require("@cucumber/cucumber/lib/configuration/validate_configuration");
10
- const convert_configuration_1 = require("@cucumber/cucumber/lib/api/convert_configuration");
10
+ const convert_configuration_1 = require("./convert-configuration");
11
11
  const index_2 = require("@cucumber/cucumber/lib/environment/index");
12
12
  const helpers_1 = require("../utils/helpers");
13
13
  const gherkin_manager_1 = __importDefault(require("../gherkin/gherkin-manager"));
14
14
  const ansis_1 = __importDefault(require("ansis"));
15
+ const console_1 = require("console");
15
16
  /**
16
17
  * Load user-authored configuration to be used in a test run.
17
18
  *
@@ -22,15 +23,20 @@ const ansis_1 = __importDefault(require("ansis"));
22
23
  const loadConfiguration = async (options = {}, environment = {}) => {
23
24
  const { cwd, env, logger } = (0, index_2.makeEnvironment)(environment);
24
25
  const configFile = options.file ?? (0, locate_file_1.locateFile)(cwd);
26
+ let msg = '';
25
27
  if (configFile) {
26
- logger.debug(`Configuration will be loaded from "${configFile}"`);
28
+ msg = `Loading configuration from "${configFile}".`;
27
29
  }
28
30
  else if (configFile === false) {
29
- logger.debug('Skipping configuration file resolution');
31
+ msg = 'Skipping configuration file resolution';
30
32
  }
31
33
  else {
32
- logger.debug('No configuration file found');
34
+ msg = 'No configuration file found';
33
35
  }
36
+ // log this to debug and console
37
+ const consoleLogger = new console_1.Console(environment.stdout, environment.stderr);
38
+ logger.debug(msg);
39
+ consoleLogger.log(ansis_1.default.cyanBright(msg));
34
40
  const profileConfiguration = configFile ? await (0, index_1.fromFile)(logger, cwd, configFile, options.profiles) : {};
35
41
  // if a feature was passed in on command line it's added
36
42
  // to the provided configuration as paths. We need to clear
@@ -41,19 +47,29 @@ const loadConfiguration = async (options = {}, environment = {}) => {
41
47
  profileConfiguration.paths = [];
42
48
  }
43
49
  const original = (0, index_1.mergeConfigurations)(index_1.DEFAULT_CONFIGURATION, profileConfiguration, (0, index_1.parseConfiguration)(logger, 'Provided', options.provided));
50
+ // Get the experimental decorators setting
51
+ if (original.experimentalDecorators === undefined) {
52
+ original.experimentalDecorators = false;
53
+ }
54
+ const experimentalDecorators = original.experimentalDecorators;
55
+ global.experimentalDecorators = experimentalDecorators;
44
56
  switch (original.transpiler) {
45
57
  case 'esvue':
46
- original.requireModule.push('@lynxwall/cucumber-tsflow/lib/esvue');
58
+ original.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esvue');
47
59
  break;
48
- case 'tsvue':
49
- original.requireModule.push('@lynxwall/cucumber-tsflow/lib/tsvue');
60
+ case 'tsvue': {
61
+ const module = experimentalDecorators ? 'tsvue-exp' : 'tsvue';
62
+ original.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);
50
63
  break;
51
- case 'tsnode':
52
- original.requireModule.push('@lynxwall/cucumber-tsflow/lib/tsnode');
64
+ }
65
+ case 'tsnode': {
66
+ const module = experimentalDecorators ? 'tsnode-exp' : 'tsnode';
67
+ original.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);
53
68
  break;
69
+ }
54
70
  default:
55
- // defaulting to esbuild
56
- original.requireModule.push('@lynxwall/cucumber-tsflow/lib/esnode');
71
+ // defaulting to esnode
72
+ original.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esnode');
57
73
  break;
58
74
  }
59
75
  // set the snippet syntax
@@ -1 +1 @@
1
- {"version":3,"file":"load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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"]}
1
+ {"version":3,"file":"load-configuration.js","sourceRoot":"","sources":["../../src/api/load-configuration.ts"],"names":[],"mappings":";;;;;;AACA,kFAA8E;AAC9E,sEAMoD;AACpD,wGAAoG;AACpG,mEAA+D;AAC/D,oEAA4F;AAE5F,8CAAkD;AAClD,iFAAwD;AACxD,kDAA0B;AAE1B,qCAAkC;AAalC;;;;;;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,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,UAAU,EAAE,CAAC;QAChB,GAAG,GAAG,+BAA+B,UAAU,IA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AAC;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;AAjIW,QAAA,iBAAiB,qBAiI5B","sourcesContent":["import { ILoadConfigurationOptions } 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 './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 ansis from 'ansis';\r\nimport { ITsFlowRunConfiguration } from '../runtime/types';\r\nimport { Console } from 'console';\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: ITsFlowRunConfiguration;\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\tlet msg = '';\r\n\tif (configFile) {\r\n\t\tmsg = `Loading configuration from \"${configFile}\".`;\r\n\t} else if (configFile === false) {\r\n\t\tmsg = 'Skipping configuration file resolution';\r\n\t} else {\r\n\t\tmsg = 'No configuration file found';\r\n\t}\r\n\t// log this to debug and console\r\n\tconst consoleLogger = new Console(environment.stdout as any, environment.stderr);\r\n\tlogger.debug(msg);\r\n\tconsoleLogger.log(ansis.cyanBright(msg));\r\n\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\t// Get the experimental decorators setting\r\n\tif (original.experimentalDecorators === undefined) {\r\n\t\toriginal.experimentalDecorators = false;\r\n\t}\r\n\tconst experimentalDecorators = original.experimentalDecorators;\r\n\tglobal.experimentalDecorators = experimentalDecorators;\r\n\r\n\tswitch (original.transpiler) {\r\n\t\tcase 'esvue':\r\n\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esvue');\r\n\t\t\tbreak;\r\n\t\tcase 'tsvue': {\r\n\t\t\tconst module = experimentalDecorators ? 'tsvue-exp' : 'tsvue';\r\n\t\t\toriginal.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase 'tsnode': {\r\n\t\t\tconst module = experimentalDecorators ? 'tsnode-exp' : 'tsnode';\r\n\t\t\toriginal.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tdefault:\r\n\t\t\t// defaulting to esnode\r\n\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/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(ansis.yellow(`\\nUnable to find feature for debugFile: ${original.debugFile}`));\r\n\t\t\tlogger.warn(ansis.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"]}