@lynxwall/cucumber-tsflow 7.1.2 → 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 (74) 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 +13 -10
  65. package/lib/esnode.js.map +0 -1
  66. package/lib/esvue.js.map +0 -1
  67. package/lib/runtime/parallel/types.js.map +0 -1
  68. package/lib/tsnode.js.map +0 -1
  69. package/lib/tsvue.js.map +0 -1
  70. /package/lib/runtime/{parallel/types.js → types.js} +0 -0
  71. /package/lib/{esnode.d.ts → transpilers/esnode.d.ts} +0 -0
  72. /package/lib/{esvue.d.ts → transpilers/esvue.d.ts} +0 -0
  73. /package/lib/{tsnode.d.ts → transpilers/tsnode-exp.d.ts} +0 -0
  74. /package/lib/{tsvue.d.ts → transpilers/tsnode.d.ts} +0 -0
@@ -19,24 +19,46 @@ const binding_context_1 = require("./binding-context");
19
19
  */
20
20
  function given(stepPattern, tag, timeout, wrapperOption) {
21
21
  const callsite = our_callsite_1.Callsite.capture();
22
- return function givenDecorator(target, context) {
23
- const stepBinding = {
24
- stepPattern: stepPattern,
25
- bindingType: step_binding_1.StepBindingFlags.given,
26
- classPrototype: undefined,
27
- classPropertyKey: context.name,
28
- stepFunction: target,
29
- stepIsStatic: context.static,
30
- stepArgsLength: target.length,
31
- tags: tag,
32
- timeout: timeout,
33
- wrapperOption: wrapperOption,
34
- callsite: callsite,
35
- cucumberKey: (0, short_uuid_1.default)().new()
22
+ if (global.experimentalDecorators) {
23
+ return (target, propertyKey, descriptor) => {
24
+ const stepBinding = {
25
+ stepPattern: stepPattern,
26
+ bindingType: step_binding_1.StepBindingFlags.given,
27
+ classPrototype: target,
28
+ classPropertyKey: propertyKey,
29
+ stepFunction: target[propertyKey],
30
+ stepIsStatic: false,
31
+ stepArgsLength: target[propertyKey].length,
32
+ tags: tag,
33
+ timeout: timeout,
34
+ wrapperOption: wrapperOption,
35
+ callsite: callsite,
36
+ cucumberKey: (0, short_uuid_1.default)().new()
37
+ };
38
+ (0, binding_context_1.addStepBindingExp)(stepBinding);
39
+ return descriptor;
36
40
  };
37
- (0, binding_context_1.addStepBinding)(context, stepBinding);
38
- return;
39
- };
41
+ }
42
+ else {
43
+ return function givenDecorator(target, context) {
44
+ const stepBinding = {
45
+ stepPattern: stepPattern,
46
+ bindingType: step_binding_1.StepBindingFlags.given,
47
+ classPrototype: undefined,
48
+ classPropertyKey: context.name,
49
+ stepFunction: target,
50
+ stepIsStatic: context.static,
51
+ stepArgsLength: target.length,
52
+ tags: tag,
53
+ timeout: timeout,
54
+ wrapperOption: wrapperOption,
55
+ callsite: callsite,
56
+ cucumberKey: (0, short_uuid_1.default)().new()
57
+ };
58
+ (0, binding_context_1.addStepBinding)(context, stepBinding);
59
+ return;
60
+ };
61
+ }
40
62
  }
41
63
  /**
42
64
  * A method decorator that marks the associated function as a 'When' step.
@@ -47,24 +69,46 @@ function given(stepPattern, tag, timeout, wrapperOption) {
47
69
  */
48
70
  function when(stepPattern, tag, timeout, wrapperOption) {
49
71
  const callsite = our_callsite_1.Callsite.capture();
50
- return function whenDecorator(target, context) {
51
- const stepBinding = {
52
- stepPattern: stepPattern,
53
- bindingType: step_binding_1.StepBindingFlags.when,
54
- classPrototype: undefined,
55
- classPropertyKey: context.name,
56
- stepFunction: target,
57
- stepIsStatic: context.static,
58
- stepArgsLength: target.length,
59
- tags: tag,
60
- timeout: timeout,
61
- wrapperOption: wrapperOption,
62
- callsite: callsite,
63
- cucumberKey: (0, short_uuid_1.default)().new()
72
+ if (global.experimentalDecorators) {
73
+ return (target, propertyKey, descriptor) => {
74
+ const stepBinding = {
75
+ stepPattern: stepPattern,
76
+ bindingType: step_binding_1.StepBindingFlags.when,
77
+ classPrototype: target,
78
+ classPropertyKey: propertyKey,
79
+ stepFunction: target[propertyKey],
80
+ stepIsStatic: false,
81
+ stepArgsLength: target[propertyKey].length,
82
+ tags: tag,
83
+ timeout: timeout,
84
+ wrapperOption: wrapperOption,
85
+ callsite: callsite,
86
+ cucumberKey: (0, short_uuid_1.default)().new()
87
+ };
88
+ (0, binding_context_1.addStepBindingExp)(stepBinding);
89
+ return descriptor;
90
+ };
91
+ }
92
+ else {
93
+ return function whenDecorator(target, context) {
94
+ const stepBinding = {
95
+ stepPattern: stepPattern,
96
+ bindingType: step_binding_1.StepBindingFlags.when,
97
+ classPrototype: undefined,
98
+ classPropertyKey: context.name,
99
+ stepFunction: target,
100
+ stepIsStatic: context.static,
101
+ stepArgsLength: target.length,
102
+ tags: tag,
103
+ timeout: timeout,
104
+ wrapperOption: wrapperOption,
105
+ callsite: callsite,
106
+ cucumberKey: (0, short_uuid_1.default)().new()
107
+ };
108
+ (0, binding_context_1.addStepBinding)(context, stepBinding);
109
+ return;
64
110
  };
65
- (0, binding_context_1.addStepBinding)(context, stepBinding);
66
- return;
67
- };
111
+ }
68
112
  }
69
113
  /**
70
114
  * A method decorator that marks the associated function as a 'Then' step.
@@ -75,23 +119,45 @@ function when(stepPattern, tag, timeout, wrapperOption) {
75
119
  */
76
120
  function then(stepPattern, tag, timeout, wrapperOption) {
77
121
  const callsite = our_callsite_1.Callsite.capture();
78
- return function thenDecorator(target, context) {
79
- const stepBinding = {
80
- stepPattern: stepPattern,
81
- bindingType: step_binding_1.StepBindingFlags.then,
82
- classPrototype: undefined,
83
- classPropertyKey: context.name,
84
- stepFunction: target,
85
- stepIsStatic: context.static,
86
- stepArgsLength: target.length,
87
- tags: tag,
88
- timeout: timeout,
89
- wrapperOption: wrapperOption,
90
- callsite: callsite,
91
- cucumberKey: (0, short_uuid_1.default)().new()
122
+ if (global.experimentalDecorators) {
123
+ return (target, propertyKey, descriptor) => {
124
+ const stepBinding = {
125
+ stepPattern: stepPattern,
126
+ bindingType: step_binding_1.StepBindingFlags.then,
127
+ classPrototype: target,
128
+ classPropertyKey: propertyKey,
129
+ stepFunction: target[propertyKey],
130
+ stepIsStatic: false,
131
+ stepArgsLength: target[propertyKey].length,
132
+ tags: tag,
133
+ timeout: timeout,
134
+ wrapperOption: wrapperOption,
135
+ callsite: callsite,
136
+ cucumberKey: (0, short_uuid_1.default)().new()
137
+ };
138
+ (0, binding_context_1.addStepBindingExp)(stepBinding);
139
+ return descriptor;
140
+ };
141
+ }
142
+ else {
143
+ return function thenDecorator(target, context) {
144
+ const stepBinding = {
145
+ stepPattern: stepPattern,
146
+ bindingType: step_binding_1.StepBindingFlags.then,
147
+ classPrototype: undefined,
148
+ classPropertyKey: context.name,
149
+ stepFunction: target,
150
+ stepIsStatic: context.static,
151
+ stepArgsLength: target.length,
152
+ tags: tag,
153
+ timeout: timeout,
154
+ wrapperOption: wrapperOption,
155
+ callsite: callsite,
156
+ cucumberKey: (0, short_uuid_1.default)().new()
157
+ };
158
+ (0, binding_context_1.addStepBinding)(context, stepBinding);
159
+ return;
92
160
  };
93
- (0, binding_context_1.addStepBinding)(context, stepBinding);
94
- return;
95
- };
161
+ }
96
162
  }
97
163
  //# sourceMappingURL=step-decorators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"step-decorators.js","sourceRoot":"","sources":["../../src/bindings/step-decorators.ts"],"names":[],"mappings":";;;;;AAYA,sBAsBC;AASD,oBAsBC;AASD,oBAsBC;AAhGD,wDAAiD;AACjD,iDAA+D;AAC/D,4DAAmC;AACnC,uDAAmD;AAEnD;;;;;;GAMG;AACH,SAAgB,KAAK,CAAC,WAA4B,EAAE,GAAY,EAAE,OAAgB,EAAE,aAAmB;IACtG,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CAAC;IAEpC,OAAO,SAAS,cAAc,CAAC,MAAgB,EAAE,OAAoC;QACpF,MAAM,WAAW,GAAgB;YAChC,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,+BAAgB,CAAC,KAAK;YACnC,cAAc,EAAE,SAAS;YACzB,gBAAgB,EAAE,OAAO,CAAC,IAAI;YAC9B,YAAY,EAAE,MAAM;YACpB,YAAY,EAAE,OAAO,CAAC,MAAM;YAC5B,cAAc,EAAE,MAAM,CAAC,MAAM;YAC7B,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,OAAO;YAChB,aAAa,EAAE,aAAa;YAC5B,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,IAAA,oBAAS,GAAE,CAAC,GAAG,EAAE;SAC9B,CAAC;QACF,IAAA,gCAAc,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAErC,OAAO;IACR,CAAC,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,IAAI,CAAC,WAA4B,EAAE,GAAY,EAAE,OAAgB,EAAE,aAAmB;IACrG,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CAAC;IAEpC,OAAO,SAAS,aAAa,CAAC,MAAgB,EAAE,OAAoC;QACnF,MA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utils/our-callsite';\r\nimport { StepBinding, StepBindingFlags } from './step-binding';\r\nimport shortUuid from 'short-uuid';\r\nimport { addStepBinding } from './binding-context';\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'Given' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function given(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\r\n\treturn function givenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\tconst stepBinding: StepBinding = {\r\n\t\t\tstepPattern: stepPattern,\r\n\t\t\tbindingType: StepBindingFlags.given,\r\n\t\t\tclassPrototype: undefined,\r\n\t\t\tclassPropertyKey: context.name,\r\n\t\t\tstepFunction: target,\r\n\t\t\tstepIsStatic: context.static,\r\n\t\t\tstepArgsLength: target.length,\r\n\t\t\ttags: tag,\r\n\t\t\ttimeout: timeout,\r\n\t\t\twrapperOption: wrapperOption,\r\n\t\t\tcallsite: callsite,\r\n\t\t\tcucumberKey: shortUuid().new()\r\n\t\t};\r\n\t\taddStepBinding(context, stepBinding);\r\n\r\n\t\treturn;\r\n\t};\r\n}\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'When' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function when(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\r\n\treturn function whenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\tconst stepBinding: StepBinding = {\r\n\t\t\tstepPattern: stepPattern,\r\n\t\t\tbindingType: StepBindingFlags.when,\r\n\t\t\tclassPrototype: undefined,\r\n\t\t\tclassPropertyKey: context.name,\r\n\t\t\tstepFunction: target,\r\n\t\t\tstepIsStatic: context.static,\r\n\t\t\tstepArgsLength: target.length,\r\n\t\t\ttags: tag,\r\n\t\t\ttimeout: timeout,\r\n\t\t\twrapperOption: wrapperOption,\r\n\t\t\tcallsite: callsite,\r\n\t\t\tcucumberKey: shortUuid().new()\r\n\t\t};\r\n\t\taddStepBinding(context, stepBinding);\r\n\r\n\t\treturn;\r\n\t};\r\n}\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'Then' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function then(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\r\n\treturn function thenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\tconst stepBinding: StepBinding = {\r\n\t\t\tstepPattern: stepPattern,\r\n\t\t\tbindingType: StepBindingFlags.then,\r\n\t\t\tclassPrototype: undefined,\r\n\t\t\tclassPropertyKey: context.name,\r\n\t\t\tstepFunction: target,\r\n\t\t\tstepIsStatic: context.static,\r\n\t\t\tstepArgsLength: target.length,\r\n\t\t\ttags: tag,\r\n\t\t\ttimeout: timeout,\r\n\t\t\twrapperOption: wrapperOption,\r\n\t\t\tcallsite: callsite,\r\n\t\t\tcucumberKey: shortUuid().new()\r\n\t\t};\r\n\t\taddStepBinding(context, stepBinding);\r\n\r\n\t\treturn;\r\n\t};\r\n}\r\n"]}
1
+ {"version":3,"file":"step-decorators.js","sourceRoot":"","sources":["../../src/bindings/step-decorators.ts"],"names":[],"mappings":";;;;;AAYA,sBA2CC;AASD,oBA4CC;AASD,oBA4CC;AAjKD,wDAAiD;AACjD,iDAA+D;AAC/D,4DAAmC;AACnC,uDAAsE;AAEtE;;;;;;GAMG;AACH,SAAgB,KAAK,CAAC,WAA4B,EAAE,GAAY,EAAE,OAAgB,EAAE,aAAmB;IACtG,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CAAC;IACpC,IAAI,MAAM,CAAC,sBAAsB,EAAE,CAA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,CAAC,MAAM;gBAC7B,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE,OAAO;gBAChB,aAAa,EAAE,aAAa;gBAC5B,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,IAAA,oBAAS,GAAE,CAAC,GAAG,EAAE;aAC9B,CAAC;YACF,IAAA,gCAAc,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAErC,OAAO;QACR,CAAC,CAAC;IACH,CAAC;AACF,CAAC","sourcesContent":["import { Callsite } from '../utils/our-callsite';\r\nimport { StepBinding, StepBindingFlags } from './step-binding';\r\nimport shortUuid from 'short-uuid';\r\nimport { addStepBinding, addStepBindingExp } from './binding-context';\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'Given' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function given(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.given,\r\n\t\t\t\tclassPrototype: target,\r\n\t\t\t\tclassPropertyKey: propertyKey,\r\n\t\t\t\tstepFunction: target[propertyKey],\r\n\t\t\t\tstepIsStatic: false,\r\n\t\t\t\tstepArgsLength: target[propertyKey].length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBindingExp(stepBinding);\r\n\r\n\t\t\treturn descriptor;\r\n\t\t};\r\n\t} else {\r\n\t\treturn function givenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.given,\r\n\t\t\t\tclassPrototype: undefined,\r\n\t\t\t\tclassPropertyKey: context.name,\r\n\t\t\t\tstepFunction: target,\r\n\t\t\t\tstepIsStatic: context.static,\r\n\t\t\t\tstepArgsLength: target.length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBinding(context, stepBinding);\r\n\r\n\t\t\treturn;\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'When' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function when(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.when,\r\n\t\t\t\tclassPrototype: target,\r\n\t\t\t\tclassPropertyKey: propertyKey,\r\n\t\t\t\tstepFunction: target[propertyKey],\r\n\t\t\t\tstepIsStatic: false,\r\n\t\t\t\tstepArgsLength: target[propertyKey].length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBindingExp(stepBinding);\r\n\r\n\t\t\treturn descriptor;\r\n\t\t};\r\n\t} else {\r\n\t\treturn function whenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.when,\r\n\t\t\t\tclassPrototype: undefined,\r\n\t\t\t\tclassPropertyKey: context.name,\r\n\t\t\t\tstepFunction: target,\r\n\t\t\t\tstepIsStatic: context.static,\r\n\t\t\t\tstepArgsLength: target.length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBinding(context, stepBinding);\r\n\r\n\t\t\treturn;\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'Then' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function then(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.then,\r\n\t\t\t\tclassPrototype: target,\r\n\t\t\t\tclassPropertyKey: propertyKey,\r\n\t\t\t\tstepFunction: target[propertyKey],\r\n\t\t\t\tstepIsStatic: false,\r\n\t\t\t\tstepArgsLength: target[propertyKey].length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBindingExp(stepBinding);\r\n\r\n\t\t\treturn descriptor;\r\n\t\t};\r\n\t} else {\r\n\t\treturn function thenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.then,\r\n\t\t\t\tclassPrototype: undefined,\r\n\t\t\t\tclassPropertyKey: context.name,\r\n\t\t\t\tstepFunction: target,\r\n\t\t\t\tstepIsStatic: context.static,\r\n\t\t\t\tstepArgsLength: target.length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBinding(context, stepBinding);\r\n\r\n\t\t\treturn;\r\n\t\t};\r\n\t}\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/bindings/types.ts"],"names":[],"mappings":";;;AAcA;;GAEG;AACH,IAAY,gBAiEX;AAjED,WAAY,gBAAgB;IAC3B;;OAEG;IACH,uDAAQ,CAAA;IAER;;OAEG;IACH,yDAAc,CAAA;IAEd;;OAEG;IACH,uDAAa,CAAA;IAEb;;OAEG;IACH,uDAAa,CAAA;IAEb;;OAEG;IACH,2DAAe,CAAA;IAEf;;OAEG;IACH,0DAAc,CAAA;IAEd;;OAEG;IACH,kEAAkB,CAAA;IAElB;;OAEG;IACH,gEAAiB,CAAA;IAEjB;;OAEG;IACH,qEAAmB,CAAA;IAEnB;;OAEG;IACH,mEAAkB,CAAA;IAElB;;OAEG;IACH,6EAAwF,CAAA;IAExF;;OAEG;IACH,2DAK2B,CAAA;AAC5B,CAAC,EAjEW,gBAAgB,gCAAhB,gBAAgB,QAiE3B","sourcesContent":["// tslint:disable:no-bitwise\r\nimport { World } from '@cucumber/cucumber';\r\nimport { Callsite } from '../utils/our-callsite';\r\n\r\n/**\r\n * A string representation of a [[RegExp]] that defines a Cucumber step pattern.\r\n */\r\nexport type StepPattern = string;\r\n\r\n/**\r\n * A Cucumber tag name.\r\n */\r\nexport type TagName = string;\r\n\r\n/**\r\n * The CucumberJS step binding types.\r\n */\r\nexport enum StepBindingFlags {\r\n\t/**\r\n\t * No bindings.\r\n\t */\r\n\tnone = 0,\r\n\r\n\t/**\r\n\t * A 'Given' step definition binding.\r\n\t */\r\n\tgiven = 1 << 0,\r\n\r\n\t/**\r\n\t * A 'When' step definition binding.\r\n\t */\r\n\twhen = 1 << 1,\r\n\r\n\t/**\r\n\t * A 'Then' step definition binding.\r\n\t */\r\n\tthen = 1 << 2,\r\n\r\n\t/**\r\n\t * A 'Before' hook binding.\r\n\t */\r\n\tbefore = 1 << 3,\r\n\r\n\t/**\r\n\t * An 'After' hook binding.\r\n\t */\r\n\tafter = 1 << 4,\r\n\r\n\t/**\r\n\t * An 'BeforeAll' hook binding\r\n\t */\r\n\tbeforeAll = 1 << 5,\r\n\r\n\t/**\r\n\t * An 'AfterAll' hook binding\r\n\t */\r\n\tafterAll = 1 << 6,\r\n\r\n\t/**\r\n\t * An 'BeforeStep' hook binding\r\n\t */\r\n\tbeforeStep = 1 << 7,\r\n\r\n\t/**\r\n\t * An 'AfterStep' hook binding\r\n\t */\r\n\tafterStep = 1 << 8,\r\n\r\n\t/**\r\n\t * All step definition bindings.\r\n\t */\r\n\tStepDefinitions = StepBindingFlags.given | StepBindingFlags.when | StepBindingFlags.then,\r\n\r\n\t/**\r\n\t * All hook bindings.\r\n\t */\r\n\tHooks = StepBindingFlags.before |\r\n\t\tStepBindingFlags.after |\r\n\t\tStepBindingFlags.beforeAll |\r\n\t\tStepBindingFlags.afterAll |\r\n\t\tStepBindingFlags.beforeStep |\r\n\t\tStepBindingFlags.afterStep\r\n}\r\n\r\n/**\r\n * Represents a class that will be injected into a binding class to provide context\r\n * during the execution of a Cucumber scenario.\r\n */\r\nexport interface ContextType {\r\n\t/**\r\n\t * A default constructor.\r\n\t */\r\n\tnew (worldObj: World): any;\r\n}\r\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/bindings/types.ts"],"names":[],"mappings":";;;AAaA;;GAEG;AACH,IAAY,gBAiEX;AAjED,WAAY,gBAAgB;IAC3B;;OAEG;IACH,uDAAQ,CAAA;IAER;;OAEG;IACH,yDAAc,CAAA;IAEd;;OAEG;IACH,uDAAa,CAAA;IAEb;;OAEG;IACH,uDAAa,CAAA;IAEb;;OAEG;IACH,2DAAe,CAAA;IAEf;;OAEG;IACH,0DAAc,CAAA;IAEd;;OAEG;IACH,kEAAkB,CAAA;IAElB;;OAEG;IACH,gEAAiB,CAAA;IAEjB;;OAEG;IACH,qEAAmB,CAAA;IAEnB;;OAEG;IACH,mEAAkB,CAAA;IAElB;;OAEG;IACH,6EAAwF,CAAA;IAExF;;OAEG;IACH,2DAK2B,CAAA;AAC5B,CAAC,EAjEW,gBAAgB,gCAAhB,gBAAgB,QAiE3B","sourcesContent":["// tslint:disable:no-bitwise\r\nimport { World } from '@cucumber/cucumber';\r\n\r\n/**\r\n * A string representation of a [[RegExp]] that defines a Cucumber step pattern.\r\n */\r\nexport type StepPattern = string;\r\n\r\n/**\r\n * A Cucumber tag name.\r\n */\r\nexport type TagName = string;\r\n\r\n/**\r\n * The CucumberJS step binding types.\r\n */\r\nexport enum StepBindingFlags {\r\n\t/**\r\n\t * No bindings.\r\n\t */\r\n\tnone = 0,\r\n\r\n\t/**\r\n\t * A 'Given' step definition binding.\r\n\t */\r\n\tgiven = 1 << 0,\r\n\r\n\t/**\r\n\t * A 'When' step definition binding.\r\n\t */\r\n\twhen = 1 << 1,\r\n\r\n\t/**\r\n\t * A 'Then' step definition binding.\r\n\t */\r\n\tthen = 1 << 2,\r\n\r\n\t/**\r\n\t * A 'Before' hook binding.\r\n\t */\r\n\tbefore = 1 << 3,\r\n\r\n\t/**\r\n\t * An 'After' hook binding.\r\n\t */\r\n\tafter = 1 << 4,\r\n\r\n\t/**\r\n\t * An 'BeforeAll' hook binding\r\n\t */\r\n\tbeforeAll = 1 << 5,\r\n\r\n\t/**\r\n\t * An 'AfterAll' hook binding\r\n\t */\r\n\tafterAll = 1 << 6,\r\n\r\n\t/**\r\n\t * An 'BeforeStep' hook binding\r\n\t */\r\n\tbeforeStep = 1 << 7,\r\n\r\n\t/**\r\n\t * An 'AfterStep' hook binding\r\n\t */\r\n\tafterStep = 1 << 8,\r\n\r\n\t/**\r\n\t * All step definition bindings.\r\n\t */\r\n\tStepDefinitions = StepBindingFlags.given | StepBindingFlags.when | StepBindingFlags.then,\r\n\r\n\t/**\r\n\t * All hook bindings.\r\n\t */\r\n\tHooks = StepBindingFlags.before |\r\n\t\tStepBindingFlags.after |\r\n\t\tStepBindingFlags.beforeAll |\r\n\t\tStepBindingFlags.afterAll |\r\n\t\tStepBindingFlags.beforeStep |\r\n\t\tStepBindingFlags.afterStep\r\n}\r\n\r\n/**\r\n * Represents a class that will be injected into a binding class to provide context\r\n * during the execution of a Cucumber scenario.\r\n */\r\nexport interface ContextType {\r\n\t/**\r\n\t * A default constructor.\r\n\t */\r\n\tnew (worldObj: World): any;\r\n}\r\n"]}
@@ -9,6 +9,7 @@ export interface ITsflowConfiguration extends IConfiguration {
9
9
  debugFile: string;
10
10
  transpiler: string;
11
11
  enableVueStyle: boolean;
12
+ experimentalDecorators: boolean;
12
13
  }
13
14
  export interface IParsedArgv {
14
15
  options: IParsedArgvOptions;
@@ -60,6 +60,7 @@ const ArgvParser = {
60
60
  .option('--debug-file <STRING>', 'path to a file with steps for debugging')
61
61
  .option('--enable-vue-style', 'Enable Vue Style block when compiling Vue SFC. Defaults to false.')
62
62
  .option('--exit, --force-exit', 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit')
63
+ .option('--experimental-decorators', 'Enable TypeScript Experimental Decorators when transpiling. Defaults to false.')
63
64
  .option('--fail-fast', 'abort the run on first failure')
64
65
  .option('-f, --format <TYPE[:PATH]>', 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\n' +
65
66
  Object.entries(index_1.documentation).reduce((previous, [key, description]) => previous + ` ${key}: ${description}\n`, ''), ArgvParser.collect)
@@ -1 +1 @@
1
- {"version":3,"file":"argv-parser.js","sourceRoot":"","sources":["../../src/cli/argv-parser.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,gEAAiC;AACjC,gDAAwB;AACxB,+CAA6C;AAC7C,0EAA+E;AAC/E,wCAAqC;AAuBrC,MAAM,UAAU,GAAG;IAClB,OAAO,CAAI,GAAM,EAAE,OAAY,EAAE;QAChC,IAAI,GAAG,EAAE,CAAC;YACT,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,SAAS,CAAC,MAAc;QACvB,OAAO,UAAU,GAAW,EAAE,OAAe,EAAE;YAC9C,IAAI,GAAW,CAAC;YAChB,IAAI,CAAC;gBACJ,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,MAAM,CAAC,GAAU,KAAc,CAAC;gBAChC,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,yBAAyB,CAAC,CAAC,OAAO,KAAK,GAAG,EAAE,CAAC,CAAC;YACxE,CAAC;YACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnD,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,sCAAsC,GAAG,EAAE,CAAC,CAAC;YACvE,CAAC;YACD,OAAO,IAAA,sBAAK,EAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACzB,CAAC,CAAC;IACH,CAAC;IAED,SAAS,CAAC,KAAa,EAAE,IAAa;QACrC,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,GAA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ACpB;aACA,MAAM,CAAC,UAAU,EAAE,iCAAiC,CAAC;aACrD,MAAM,CAAC,aAAa,EAAE,yCAAyC,CAAC;aAChE,MAAM,CACN,yBAAyB,EACzB,uFAAuF,EACvF,UAAU,CAAC,SAAS,CACpB;aACA,MAAM,CACN,0CAA0C,EAC1C;;kDAE8C,CAC9C;aACA,MAAM,CACN,2BAA2B,EAC3B,8EAA8E,EAC9E,UAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAC1C,CAAC;QAEH,OAAO,CAAC,WAAW,CAClB,UAAU,EACV,6FAA6F,CAC7F,CAAC;QAEF,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpB,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,YAAY,EAAE,GAAoB,OAAO,CAAC,IAAI,EAAE,CAAC;QAC1G,MAAM,aAAa,GAAkC,YAAY,CAAC;QAClE,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;QACpC,CAAC;QAED,OAAO;YACN,OAAO,EAAE;gBACR,MAAM;gBACN,YAAY;gBACZ,aAAa;gBACb,OAAO;aACP;YACD,aAAa;SACb,CAAC;IACH,CAAC;CACD,CAAC;AAEF,kBAAe,UAAU,CAAC","sourcesContent":["import { Command } from 'commander';\r\nimport merge from 'lodash.merge';\r\nimport path from 'path';\r\nimport { dialects } from '@cucumber/gherkin';\r\nimport { documentation } from '@cucumber/cucumber/lib/formatter/builtin/index';\r\nimport { version } from '../version';\r\nimport { IConfiguration } from '@cucumber/cucumber/lib/configuration/types';\r\n\r\nexport interface IParsedArgvOptions {\r\n\tconfig?: string;\r\n\ti18nKeywords?: string;\r\n\ti18nLanguages?: boolean;\r\n\tprofile?: string[];\r\n}\r\n\r\nexport interface ITsflowConfiguration extends IConfiguration {\r\n\tdebugFile: string;\r\n\ttranspiler: string;\r\n\tenableVueStyle: boolean;\r\n}\r\n\r\nexport interface IParsedArgv {\r\n\toptions: IParsedArgvOptions;\r\n\tconfiguration: Partial<ITsflowConfiguration>;\r\n}\r\n\r\ntype IRawArgvOptions = Partial<Omit<ITsflowConfiguration, 'paths'>> & IParsedArgvOptions;\r\n\r\nconst ArgvParser = {\r\n\tcollect<T>(val: T, memo: T[] = []): T[] | undefined {\r\n\t\tif (val) {\r\n\t\t\treturn [...memo, val];\r\n\t\t}\r\n\t\treturn undefined;\r\n\t},\r\n\r\n\tmergeJson(option: string): (str: string, memo?: object) => object {\r\n\t\treturn function (str: string, memo: object = {}) {\r\n\t\t\tlet val: object;\r\n\t\t\ttry {\r\n\t\t\t\tval = JSON.parse(str);\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconst e: Error = error as Error;\r\n\t\t\t\tthrow new Error(`${option} passed invalid JSON: ${e.message}: ${str}`);\r\n\t\t\t}\r\n\t\t\tif (typeof val !== 'object' || Array.isArray(val)) {\r\n\t\t\t\tthrow new Error(`${option} must be passed JSON of an object: ${str}`);\r\n\t\t\t}\r\n\t\t\treturn merge(memo, val);\r\n\t\t};\r\n\t},\r\n\r\n\tmergeTags(value: string, memo?: string): string {\r\n\t\treturn memo ? `${memo} and (${value})` : `(${value})`;\r\n\t},\r\n\r\n\tvalidateCountOption(value: string, optionName: string): number {\r\n\t\tconst numericValue = parseInt(value);\r\n\t\tif (isNaN(numericValue) || numericValue < 0) {\r\n\t\t\tthrow new Error(`${optionName} must be a non negative integer`);\r\n\t\t}\r\n\t\treturn numericValue;\r\n\t},\r\n\r\n\tvalidateLanguage(value: string): string {\r\n\t\tif (!Object.keys(dialects).includes(value)) {\r\n\t\t\tthrow new Error(`Unsupported ISO 639-1: ${value}`);\r\n\t\t}\r\n\t\treturn value;\r\n\t},\r\n\r\n\tparse(argv: string[]): IParsedArgv {\r\n\t\tconst program = new Command(path.basename(argv[1]));\r\n\r\n\t\tprogram\r\n\t\t\t.storeOptionsAsProperties(false)\r\n\t\t\t.usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\r\n\t\t\t.version(version, '-v, --version')\r\n\t\t\t.option('-b, --backtrace', 'show full backtrace for errors')\r\n\t\t\t.option('-c, --config <PATH>', 'specify configuration file')\r\n\t\t\t.option('-d, --dry-run', 'invoke formatters without executing steps')\r\n\t\t\t.option('--debug-file <STRING>', 'path to a file with steps for debugging')\r\n\t\t\t.option('--enable-vue-style', 'Enable Vue Style block when compiling Vue SFC. Defaults to false.')\r\n\t\t\t.option(\r\n\t\t\t\t'--exit, --force-exit',\r\n\t\t\t\t'force shutdown of the event loop when the test run has finished: cucumber will call process.exit'\r\n\t\t\t)\r\n\t\t\t.option('--fail-fast', 'abort the run on first failure')\r\n\t\t\t.option(\r\n\t\t\t\t'-f, --format <TYPE[:PATH]>',\r\n\t\t\t\t'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\r\n\t\t\t\t\tObject.entries(documentation).reduce(\r\n\t\t\t\t\t\t(previous, [key, description]) => previous + ` ${key}: ${description}\\n`,\r\n\t\t\t\t\t\t''\r\n\t\t\t\t\t),\r\n\t\t\t\t(ArgvParser as any).collect\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--format-options <JSON>',\r\n\t\t\t\t'provide options for formatters (repeatable)',\r\n\t\t\t\tArgvParser.mergeJson('--format-options')\r\n\t\t\t)\r\n\t\t\t.option('--i18n-keywords <ISO 639-1>', 'list language keywords', ArgvParser.validateLanguage)\r\n\t\t\t.option('--i18n-languages', 'list languages')\r\n\t\t\t.option(\r\n\t\t\t\t'-i, --import <GLOB|DIR|FILE>',\r\n\t\t\t\t'import files before executing features (repeatable)',\r\n\t\t\t\t(ArgvParser as any).collect\r\n\t\t\t)\r\n\t\t\t.option('--language <ISO 639-1>', 'provide the default language for feature files')\r\n\t\t\t.option(\r\n\t\t\t\t'--name <REGEXP>',\r\n\t\t\t\t'only execute the scenarios with name matching the expression (repeatable)',\r\n\t\t\t\t(ArgvParser as any).collect\r\n\t\t\t)\r\n\t\t\t.option('--order <TYPE[:SEED]>', 'run scenarios in the specified order. Type should be `defined` or `random`')\r\n\t\t\t.option('-p, --profile <NAME>', 'specify the profile to use (repeatable)', (ArgvParser as any).collect, [])\r\n\t\t\t.option('--parallel <NUMBER_OF_WORKERS>', 'run in parallel with the given number of workers', val =>\r\n\t\t\t\tArgvParser.validateCountOption(val, '--parallel')\r\n\t\t\t)\r\n\t\t\t.option('--publish', 'Publish a report to https://reports.cucumber.io')\r\n\t\t\t.option('--publish-quiet', \"Don't print information banner about publishing reports\")\r\n\t\t\t.option(\r\n\t\t\t\t'-r, --require <GLOB|DIR|FILE>',\r\n\t\t\t\t'require files before executing features (repeatable)',\r\n\t\t\t\t(ArgvParser as any).collect\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--require-module <NODE_MODULE>',\r\n\t\t\t\t'require node modules before requiring files (repeatable)',\r\n\t\t\t\t(ArgvParser as any).collect\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--retry <NUMBER_OF_RETRIES>',\r\n\t\t\t\t'specify the number of times to retry failing test cases (default: 0)',\r\n\t\t\t\tval => ArgvParser.validateCountOption(val, '--retry')\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--retry-tag-filter <EXPRESSION>',\r\n\t\t\t\t`only retries the features or scenarios with tags matching the expression (repeatable).\r\n This option requires '--retry' to be specified.`,\r\n\t\t\t\tArgvParser.mergeTags\r\n\t\t\t)\r\n\t\t\t.option('--strict', 'fail if there are pending steps')\r\n\t\t\t.option('--no-strict', 'succeed even if there are pending steps')\r\n\t\t\t.option(\r\n\t\t\t\t'-t, --tags <EXPRESSION>',\r\n\t\t\t\t'only execute the features or scenarios with tags matching the expression (repeatable)',\r\n\t\t\t\tArgvParser.mergeTags\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--transpiler <ESNODE|TSNODE|ESVUE|TSVUE>',\r\n\t\t\t\t`built-in transpiler to use. ESxxx transpilers use esbuild and TSxxx transpilers use typescript.\\n\r\n\t\t\t\tVue versions of the transpilers add a hook for .vue transforms and initialize jsdom globally.\\n\r\n\t\t\t\tDefault: ESNODE (esbuild without Vue support)`\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--world-parameters <JSON>',\r\n\t\t\t\t'provide parameters that will be passed to the world constructor (repeatable)',\r\n\t\t\t\tArgvParser.mergeJson('--world-parameters')\r\n\t\t\t);\r\n\r\n\t\tprogram.addHelpText(\r\n\t\t\t'afterAll',\r\n\t\t\t'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\r\n\t\t);\r\n\r\n\t\tprogram.parse(argv);\r\n\t\tconst { config, i18nKeywords, i18nLanguages, profile, ...regularStuff }: IRawArgvOptions = program.opts();\r\n\t\tconst configuration: Partial<ITsflowConfiguration> = regularStuff;\r\n\t\tif (program.args.length > 0) {\r\n\t\t\tconfiguration.paths = program.args;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\toptions: {\r\n\t\t\t\tconfig,\r\n\t\t\t\ti18nKeywords,\r\n\t\t\t\ti18nLanguages,\r\n\t\t\t\tprofile\r\n\t\t\t},\r\n\t\t\tconfiguration\r\n\t\t};\r\n\t}\r\n};\r\n\r\nexport default ArgvParser;\r\n"]}
1
+ {"version":3,"file":"argv-parser.js","sourceRoot":"","sources":["../../src/cli/argv-parser.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,gEAAiC;AACjC,gDAAwB;AACxB,+CAA6C;AAC7C,0EAA+E;AAC/E,wCAAqC;AAwBrC,MAAM,UAAU,GAAG;IAClB,OAAO,CAAI,GAAM,EAAE,OAAY,EAAE;QAChC,IAAI,GAAG,EAAE,CAAC;YACT,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,SAAS,CAAC,MAAc;QACvB,OAAO,UAA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aAAa,EAAE,OAAO,EAAE,GAAG,YAAY,EAAE,GAAoB,OAAO,CAAC,IAAI,EAAE,CAAC;QAC1G,MAAM,aAAa,GAAkC,YAAY,CAAC;QAClE,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;QACpC,CAAC;QAED,OAAO;YACN,OAAO,EAAE;gBACR,MAAM;gBACN,YAAY;gBACZ,aAAa;gBACb,OAAO;aACP;YACD,aAAa;SACb,CAAC;IACH,CAAC;CACD,CAAC;AAEF,kBAAe,UAAU,CAAC","sourcesContent":["import { Command } from 'commander';\r\nimport merge from 'lodash.merge';\r\nimport path from 'path';\r\nimport { dialects } from '@cucumber/gherkin';\r\nimport { documentation } from '@cucumber/cucumber/lib/formatter/builtin/index';\r\nimport { version } from '../version';\r\nimport { IConfiguration } from '@cucumber/cucumber/lib/configuration/types';\r\n\r\nexport interface IParsedArgvOptions {\r\n\tconfig?: string;\r\n\ti18nKeywords?: string;\r\n\ti18nLanguages?: boolean;\r\n\tprofile?: string[];\r\n}\r\n\r\nexport interface ITsflowConfiguration extends IConfiguration {\r\n\tdebugFile: string;\r\n\ttranspiler: string;\r\n\tenableVueStyle: boolean;\r\n\texperimentalDecorators: boolean;\r\n}\r\n\r\nexport interface IParsedArgv {\r\n\toptions: IParsedArgvOptions;\r\n\tconfiguration: Partial<ITsflowConfiguration>;\r\n}\r\n\r\ntype IRawArgvOptions = Partial<Omit<ITsflowConfiguration, 'paths'>> & IParsedArgvOptions;\r\n\r\nconst ArgvParser = {\r\n\tcollect<T>(val: T, memo: T[] = []): T[] | undefined {\r\n\t\tif (val) {\r\n\t\t\treturn [...memo, val];\r\n\t\t}\r\n\t\treturn undefined;\r\n\t},\r\n\r\n\tmergeJson(option: string): (str: string, memo?: object) => object {\r\n\t\treturn function (str: string, memo: object = {}) {\r\n\t\t\tlet val: object;\r\n\t\t\ttry {\r\n\t\t\t\tval = JSON.parse(str);\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconst e: Error = error as Error;\r\n\t\t\t\tthrow new Error(`${option} passed invalid JSON: ${e.message}: ${str}`);\r\n\t\t\t}\r\n\t\t\tif (typeof val !== 'object' || Array.isArray(val)) {\r\n\t\t\t\tthrow new Error(`${option} must be passed JSON of an object: ${str}`);\r\n\t\t\t}\r\n\t\t\treturn merge(memo, val);\r\n\t\t};\r\n\t},\r\n\r\n\tmergeTags(value: string, memo?: string): string {\r\n\t\treturn memo ? `${memo} and (${value})` : `(${value})`;\r\n\t},\r\n\r\n\tvalidateCountOption(value: string, optionName: string): number {\r\n\t\tconst numericValue = parseInt(value);\r\n\t\tif (isNaN(numericValue) || numericValue < 0) {\r\n\t\t\tthrow new Error(`${optionName} must be a non negative integer`);\r\n\t\t}\r\n\t\treturn numericValue;\r\n\t},\r\n\r\n\tvalidateLanguage(value: string): string {\r\n\t\tif (!Object.keys(dialects).includes(value)) {\r\n\t\t\tthrow new Error(`Unsupported ISO 639-1: ${value}`);\r\n\t\t}\r\n\t\treturn value;\r\n\t},\r\n\r\n\tparse(argv: string[]): IParsedArgv {\r\n\t\tconst program = new Command(path.basename(argv[1]));\r\n\r\n\t\tprogram\r\n\t\t\t.storeOptionsAsProperties(false)\r\n\t\t\t.usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\r\n\t\t\t.version(version, '-v, --version')\r\n\t\t\t.option('-b, --backtrace', 'show full backtrace for errors')\r\n\t\t\t.option('-c, --config <PATH>', 'specify configuration file')\r\n\t\t\t.option('-d, --dry-run', 'invoke formatters without executing steps')\r\n\t\t\t.option('--debug-file <STRING>', 'path to a file with steps for debugging')\r\n\t\t\t.option('--enable-vue-style', 'Enable Vue Style block when compiling Vue SFC. Defaults to false.')\r\n\t\t\t.option(\r\n\t\t\t\t'--exit, --force-exit',\r\n\t\t\t\t'force shutdown of the event loop when the test run has finished: cucumber will call process.exit'\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--experimental-decorators',\r\n\t\t\t\t'Enable TypeScript Experimental Decorators when transpiling. Defaults to false.'\r\n\t\t\t)\r\n\t\t\t.option('--fail-fast', 'abort the run on first failure')\r\n\t\t\t.option(\r\n\t\t\t\t'-f, --format <TYPE[:PATH]>',\r\n\t\t\t\t'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\r\n\t\t\t\t\tObject.entries(documentation).reduce(\r\n\t\t\t\t\t\t(previous, [key, description]) => previous + ` ${key}: ${description}\\n`,\r\n\t\t\t\t\t\t''\r\n\t\t\t\t\t),\r\n\t\t\t\t(ArgvParser as any).collect\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--format-options <JSON>',\r\n\t\t\t\t'provide options for formatters (repeatable)',\r\n\t\t\t\tArgvParser.mergeJson('--format-options')\r\n\t\t\t)\r\n\t\t\t.option('--i18n-keywords <ISO 639-1>', 'list language keywords', ArgvParser.validateLanguage)\r\n\t\t\t.option('--i18n-languages', 'list languages')\r\n\t\t\t.option(\r\n\t\t\t\t'-i, --import <GLOB|DIR|FILE>',\r\n\t\t\t\t'import files before executing features (repeatable)',\r\n\t\t\t\t(ArgvParser as any).collect\r\n\t\t\t)\r\n\t\t\t.option('--language <ISO 639-1>', 'provide the default language for feature files')\r\n\t\t\t.option(\r\n\t\t\t\t'--name <REGEXP>',\r\n\t\t\t\t'only execute the scenarios with name matching the expression (repeatable)',\r\n\t\t\t\t(ArgvParser as any).collect\r\n\t\t\t)\r\n\t\t\t.option('--order <TYPE[:SEED]>', 'run scenarios in the specified order. Type should be `defined` or `random`')\r\n\t\t\t.option('-p, --profile <NAME>', 'specify the profile to use (repeatable)', (ArgvParser as any).collect, [])\r\n\t\t\t.option('--parallel <NUMBER_OF_WORKERS>', 'run in parallel with the given number of workers', val =>\r\n\t\t\t\tArgvParser.validateCountOption(val, '--parallel')\r\n\t\t\t)\r\n\t\t\t.option('--publish', 'Publish a report to https://reports.cucumber.io')\r\n\t\t\t.option('--publish-quiet', \"Don't print information banner about publishing reports\")\r\n\t\t\t.option(\r\n\t\t\t\t'-r, --require <GLOB|DIR|FILE>',\r\n\t\t\t\t'require files before executing features (repeatable)',\r\n\t\t\t\t(ArgvParser as any).collect\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--require-module <NODE_MODULE>',\r\n\t\t\t\t'require node modules before requiring files (repeatable)',\r\n\t\t\t\t(ArgvParser as any).collect\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--retry <NUMBER_OF_RETRIES>',\r\n\t\t\t\t'specify the number of times to retry failing test cases (default: 0)',\r\n\t\t\t\tval => ArgvParser.validateCountOption(val, '--retry')\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--retry-tag-filter <EXPRESSION>',\r\n\t\t\t\t`only retries the features or scenarios with tags matching the expression (repeatable).\r\n This option requires '--retry' to be specified.`,\r\n\t\t\t\tArgvParser.mergeTags\r\n\t\t\t)\r\n\t\t\t.option('--strict', 'fail if there are pending steps')\r\n\t\t\t.option('--no-strict', 'succeed even if there are pending steps')\r\n\t\t\t.option(\r\n\t\t\t\t'-t, --tags <EXPRESSION>',\r\n\t\t\t\t'only execute the features or scenarios with tags matching the expression (repeatable)',\r\n\t\t\t\tArgvParser.mergeTags\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--transpiler <ESNODE|TSNODE|ESVUE|TSVUE>',\r\n\t\t\t\t`built-in transpiler to use. ESxxx transpilers use esbuild and TSxxx transpilers use typescript.\\n\r\n\t\t\t\tVue versions of the transpilers add a hook for .vue transforms and initialize jsdom globally.\\n\r\n\t\t\t\tDefault: ESNODE (esbuild without Vue support)`\r\n\t\t\t)\r\n\t\t\t.option(\r\n\t\t\t\t'--world-parameters <JSON>',\r\n\t\t\t\t'provide parameters that will be passed to the world constructor (repeatable)',\r\n\t\t\t\tArgvParser.mergeJson('--world-parameters')\r\n\t\t\t);\r\n\r\n\t\tprogram.addHelpText(\r\n\t\t\t'afterAll',\r\n\t\t\t'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\r\n\t\t);\r\n\r\n\t\tprogram.parse(argv);\r\n\t\tconst { config, i18nKeywords, i18nLanguages, profile, ...regularStuff }: IRawArgvOptions = program.opts();\r\n\t\tconst configuration: Partial<ITsflowConfiguration> = regularStuff;\r\n\t\tif (program.args.length > 0) {\r\n\t\t\tconfiguration.paths = program.args;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\toptions: {\r\n\t\t\t\tconfig,\r\n\t\t\t\ti18nKeywords,\r\n\t\t\t\ti18nLanguages,\r\n\t\t\t\tprofile\r\n\t\t\t},\r\n\t\t\tconfiguration\r\n\t\t};\r\n\t}\r\n};\r\n\r\nexport default ArgvParser;\r\n"]}
package/lib/cli/index.js CHANGED
@@ -9,7 +9,6 @@ const i18n_1 = require("@cucumber/cucumber/lib/cli/i18n");
9
9
  const install_validator_1 = require("@cucumber/cucumber/lib/cli/install_validator");
10
10
  const argv_parser_1 = __importDefault(require("./argv-parser"));
11
11
  const debug_1 = __importDefault(require("debug"));
12
- const console_1 = require("console");
13
12
  class Cli {
14
13
  argv;
15
14
  cwd;
@@ -50,14 +49,12 @@ class Cli {
50
49
  env: this.env,
51
50
  debug: debugEnabled
52
51
  };
53
- const consoleLogger = new console_1.Console(environment.stdout, environment.stderr);
54
- consoleLogger.info('Loading configuration...');
52
+ // load the configuration
55
53
  const { useConfiguration: configuration, runConfiguration } = await (0, load_configuration_1.loadConfiguration)({
56
54
  file: options.config,
57
55
  profiles: options.profile,
58
56
  provided: argvConfiguration
59
57
  }, environment);
60
- consoleLogger.info('Loading Steps and Running Cucumber...\n');
61
58
  // now we can run cucumber
62
59
  const { success } = await (0, run_cucumber_1.runCucumber)(runConfiguration, environment);
63
60
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAEA,sDAAkD;AAClD,kEA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,MAAM,WAAW,GAAG;YACnB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,YAAY;SACnB,CAAC;QACF,MAAM,aAAa,GAAG,IAAI,iBAAO,CAAC,WAAW,CAAC,MAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QACjF,aAAa,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QAE/C,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,sCAAiB,EACpF;YACC,IAAI,EAAE,OAAO,CAAC,MAAM;YACpB,QAAQ,EAAE,OAAO,CAAC,OAAO;YACzB,QAAQ,EAAE,iBAAiB;SAC3B,EACD,WAAW,CACX,CAAC;QACF,aAAa,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QAE9D,0BAA0B;QAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,0BAAW,EAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;QACrE,OAAO;YACN,qBAAqB,EAAE,aAAa,CAAC,SAAS;YAC9C,OAAO;SACP,CAAC;IACH,CAAC;CACD;AA5ED,sBA4EC","sourcesContent":["/* eslint-disable no-undef */\r\nimport { IFormatterStream } from '@cucumber/cucumber/lib/formatter/index';\r\nimport { runCucumber } from '../api/run-cucumber';\r\nimport { loadConfiguration } from '../api/load-configuration';\r\nimport { getKeywords, getLanguages } from '@cucumber/cucumber/lib/cli/i18n';\r\nimport { validateInstall } from '@cucumber/cucumber/lib/cli/install_validator';\r\nimport ArgvParser from './argv-parser';\r\nimport debug from 'debug';\r\nimport { Console } from 'console';\r\n\r\nexport interface ICliRunResult {\r\n\tshouldExitImmediately: boolean;\r\n\tsuccess: boolean;\r\n}\r\n\r\nexport default class Cli {\r\n\tprivate readonly argv: string[];\r\n\tprivate readonly cwd: string;\r\n\tprivate readonly stdout: IFormatterStream;\r\n\tprivate readonly stderr: IFormatterStream;\r\n\tprivate readonly env: NodeJS.ProcessEnv;\r\n\r\n\tconstructor({\r\n\t\targv,\r\n\t\tcwd,\r\n\t\tstdout,\r\n\t\tstderr = process.stderr,\r\n\t\tenv\r\n\t}: {\r\n\t\targv: string[];\r\n\t\tcwd: string;\r\n\t\tstdout: IFormatterStream;\r\n\t\tstderr: IFormatterStream;\r\n\t\tenv: NodeJS.ProcessEnv;\r\n\t}) {\r\n\t\tthis.argv = argv;\r\n\t\tthis.cwd = cwd;\r\n\t\tthis.stdout = stdout;\r\n\t\tthis.stderr = stderr;\r\n\t\tthis.env = env;\r\n\t}\r\n\r\n\tasync run(): Promise<ICliRunResult> {\r\n\t\tconst debugEnabled = debug.enabled('cucumber');\r\n\t\tif (debugEnabled) {\r\n\t\t\tawait validateInstall();\r\n\t\t}\r\n\r\n\t\tconst { options, configuration: argvConfiguration } = ArgvParser.parse(this.argv);\r\n\t\tif (options.i18nLanguages) {\r\n\t\t\t(this.stdout as any).write(getLanguages());\r\n\t\t\treturn {\r\n\t\t\t\tshouldExitImmediately: true,\r\n\t\t\t\tsuccess: true\r\n\t\t\t};\r\n\t\t}\r\n\t\tif (options.i18nKeywords) {\r\n\t\t\t(this.stdout as any).write(getKeywords(options.i18nKeywords));\r\n\t\t\treturn {\r\n\t\t\t\tshouldExitImmediately: true,\r\n\t\t\t\tsuccess: true\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tconst environment = {\r\n\t\t\tcwd: this.cwd,\r\n\t\t\tstdout: this.stdout,\r\n\t\t\tstderr: this.stderr,\r\n\t\t\tenv: this.env,\r\n\t\t\tdebug: debugEnabled\r\n\t\t};\r\n\t\tconst consoleLogger = new Console(environment.stdout as any, environment.stderr);\r\n\t\tconsoleLogger.info('Loading configuration...');\r\n\r\n\t\tconst { useConfiguration: configuration, runConfiguration } = await loadConfiguration(\r\n\t\t\t{\r\n\t\t\t\tfile: options.config,\r\n\t\t\t\tprofiles: options.profile,\r\n\t\t\t\tprovided: argvConfiguration\r\n\t\t\t},\r\n\t\t\tenvironment\r\n\t\t);\r\n\t\tconsoleLogger.info('Loading Steps and Running Cucumber...\\n');\r\n\r\n\t\t// now we can run cucumber\r\n\t\tconst { success } = await runCucumber(runConfiguration, environment);\r\n\t\treturn {\r\n\t\t\tshouldExitImmediately: configuration.forceExit,\r\n\t\t\tsuccess\r\n\t\t};\r\n\t}\r\n}\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAEA,sDAAkD;AAClD,kEAA8D;AAC9D,0DAA4E;AAC5E,oFAA+E;AAC/E,gEAAuC;AACvC,kDAA0B;AAO1B,MAAqB,GAAG;IACN,IAAI,CAAW;IACf,GAAG,CAAS;IACZ,MAAM,CAAmB;IACzB,MAAM,CAAmB;IACzB,GAAG,CAAoB;IAExC,YAAY,EACX,IAAI,EACJ,GAAG,EACH,MAAM,EACN,MAAM,GAAG,OAAO,CAAC,MAAM,EACvB,GAAG,EAOH;QACA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,GAAG;QACR,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,YAAY,EAAE,CAAC;YAClB,MAAM,IAAA,mCAAe,GAAE,CAAC;QACzB,CAAC;QAED,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClF,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAc,CAAC,KAAK,CAAC,IAAA,mBAAY,GAAE,CAAC,CAAC;YAC3C,OAAO;gBACN,qBAAqB,EAAE,IAAI;gBAC3B,OAAO,EAAE,IAAI;aACb,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,IAAI,CAAC,MAAc,CAAC,KAAK,CAAC,IAAA,kBAAW,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;YAC9D,OAAO;gBACN,qBAAqB,EAAE,IAAI;gBAC3B,OAAO,EAAE,IAAI;aACb,CAAC;QACH,CAAC;QAED,MAAM,WAAW,GAAG;YACnB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,YAAY;SACnB,CAAC;QAEF,yBAAyB;QACzB,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,sCAAiB,EACpF;YACC,IAAI,EAAE,OAAO,CAAC,MAAM;YACpB,QAAQ,EAAE,OAAO,CAAC,OAAO;YACzB,QAAQ,EAAE,iBAAiB;SAC3B,EACD,WAAW,CACX,CAAC;QAEF,0BAA0B;QAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,0BAAW,EAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;QACrE,OAAO;YACN,qBAAqB,EAAE,aAAa,CAAC,SAAS;YAC9C,OAAO;SACP,CAAC;IACH,CAAC;CACD;AA1ED,sBA0EC","sourcesContent":["/* eslint-disable no-undef */\r\nimport { IFormatterStream } from '@cucumber/cucumber/lib/formatter/index';\r\nimport { runCucumber } from '../api/run-cucumber';\r\nimport { loadConfiguration } from '../api/load-configuration';\r\nimport { getKeywords, getLanguages } from '@cucumber/cucumber/lib/cli/i18n';\r\nimport { validateInstall } from '@cucumber/cucumber/lib/cli/install_validator';\r\nimport ArgvParser from './argv-parser';\r\nimport debug from 'debug';\r\n\r\nexport interface ICliRunResult {\r\n\tshouldExitImmediately: boolean;\r\n\tsuccess: boolean;\r\n}\r\n\r\nexport default class Cli {\r\n\tprivate readonly argv: string[];\r\n\tprivate readonly cwd: string;\r\n\tprivate readonly stdout: IFormatterStream;\r\n\tprivate readonly stderr: IFormatterStream;\r\n\tprivate readonly env: NodeJS.ProcessEnv;\r\n\r\n\tconstructor({\r\n\t\targv,\r\n\t\tcwd,\r\n\t\tstdout,\r\n\t\tstderr = process.stderr,\r\n\t\tenv\r\n\t}: {\r\n\t\targv: string[];\r\n\t\tcwd: string;\r\n\t\tstdout: IFormatterStream;\r\n\t\tstderr: IFormatterStream;\r\n\t\tenv: NodeJS.ProcessEnv;\r\n\t}) {\r\n\t\tthis.argv = argv;\r\n\t\tthis.cwd = cwd;\r\n\t\tthis.stdout = stdout;\r\n\t\tthis.stderr = stderr;\r\n\t\tthis.env = env;\r\n\t}\r\n\r\n\tasync run(): Promise<ICliRunResult> {\r\n\t\tconst debugEnabled = debug.enabled('cucumber');\r\n\t\tif (debugEnabled) {\r\n\t\t\tawait validateInstall();\r\n\t\t}\r\n\r\n\t\tconst { options, configuration: argvConfiguration } = ArgvParser.parse(this.argv);\r\n\t\tif (options.i18nLanguages) {\r\n\t\t\t(this.stdout as any).write(getLanguages());\r\n\t\t\treturn {\r\n\t\t\t\tshouldExitImmediately: true,\r\n\t\t\t\tsuccess: true\r\n\t\t\t};\r\n\t\t}\r\n\t\tif (options.i18nKeywords) {\r\n\t\t\t(this.stdout as any).write(getKeywords(options.i18nKeywords));\r\n\t\t\treturn {\r\n\t\t\t\tshouldExitImmediately: true,\r\n\t\t\t\tsuccess: true\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tconst environment = {\r\n\t\t\tcwd: this.cwd,\r\n\t\t\tstdout: this.stdout,\r\n\t\t\tstderr: this.stderr,\r\n\t\t\tenv: this.env,\r\n\t\t\tdebug: debugEnabled\r\n\t\t};\r\n\r\n\t\t// load the configuration\r\n\t\tconst { useConfiguration: configuration, runConfiguration } = await loadConfiguration(\r\n\t\t\t{\r\n\t\t\t\tfile: options.config,\r\n\t\t\t\tprofiles: options.profile,\r\n\t\t\t\tprovided: argvConfiguration\r\n\t\t\t},\r\n\t\t\tenvironment\r\n\t\t);\r\n\r\n\t\t// now we can run cucumber\r\n\t\tconst { success } = await runCucumber(runConfiguration, environment);\r\n\t\treturn {\r\n\t\t\tshouldExitImmediately: configuration.forceExit,\r\n\t\t\tsuccess\r\n\t\t};\r\n\t}\r\n}\r\n"]}
@@ -1,11 +1,12 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import { IdGenerator } from '@cucumber/messages';
3
- import { IRunOptionsRuntime, ISourcesCoordinates } from '@cucumber/cucumber/lib/api/index';
3
+ import { ISourcesCoordinates } from '@cucumber/cucumber/lib/api/index';
4
4
  import { ILogger } from '@cucumber/cucumber/lib/environment/index';
5
5
  import { SourcedPickle } from '@cucumber/cucumber/lib/assemble/index';
6
6
  import { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';
7
7
  import { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';
8
8
  import { Runtime } from '@cucumber/cucumber/lib/runtime/types';
9
+ import { ITsFlowRunOptionsRuntime } from './types';
9
10
  /**
10
11
  * Extending this function from cucumber.js to use our own implementation
11
12
  * of the Coordinator.
@@ -17,6 +18,6 @@ export declare function makeRuntime({ environment, logger, eventBroadcaster, sou
17
18
  newId: IdGenerator.NewId;
18
19
  sourcedPickles: ReadonlyArray<SourcedPickle>;
19
20
  supportCodeLibrary: SupportCodeLibrary;
20
- options: IRunOptionsRuntime;
21
+ options: ITsFlowRunOptionsRuntime;
21
22
  coordinates: ISourcesCoordinates;
22
23
  }): Promise<Runtime>;
@@ -1 +1 @@
1
- {"version":3,"file":"make-runtime.js","sourceRoot":"","sources":["../../src/runtime/make-runtime.ts"],"names":[],"mappings":";;AAgBA,kCAwBC;AAhCD,gDAAyD;AACzD,8CAAoD;AACpD,+CAA4C;AAE5C;;;GAGG;AACI,KAAK,UAAU,WAAW,CAAC,EACjC,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,kBAAkB,EAClB,OAAO,EACP,WAAW,EAUX;IACA,MAAM,OAAO,GACZ,OAAO,CAAC,QAAQ,GAAG,CAAC;QACnB,CAAC,CAAC,IAAI,6BAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,CAAC;QAC1G,CAAC,CAAC,IAAI,0BAAgB,CAAC,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC/E,OAAO,IAAI,yBAAW,CAAC,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["import { EventEmitter } from 'node:events';\r\nimport { IdGenerator } from '@cucumber/messages';\r\nimport { IRunOptionsRuntime, ISourcesCoordinates } from '@cucumber/cucumber/lib/api/index';\r\nimport { ILogger } from '@cucumber/cucumber/lib/environment/index';\r\nimport { SourcedPickle } from '@cucumber/cucumber/lib/assemble/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { Runtime, RuntimeAdapter } from '@cucumber/cucumber/lib/runtime/types';\r\nimport { ChildProcessAdapter } from './parallel/adapter';\r\nimport { InProcessAdapter } from './serial/adapter';\r\nimport { Coordinator } from './coordinator';\r\n\r\n/**\r\n * Extending this function from cucumber.js to use our own implementation\r\n * of the Coordinator.\r\n */\r\nexport async function makeRuntime({\r\n\tenvironment,\r\n\tlogger,\r\n\teventBroadcaster,\r\n\tsourcedPickles,\r\n\tnewId,\r\n\tsupportCodeLibrary,\r\n\toptions,\r\n\tcoordinates\r\n}: {\r\n\tenvironment: IRunEnvironment;\r\n\tlogger: ILogger;\r\n\teventBroadcaster: EventEmitter;\r\n\tnewId: IdGenerator.NewId;\r\n\tsourcedPickles: ReadonlyArray<SourcedPickle>;\r\n\tsupportCodeLibrary: SupportCodeLibrary;\r\n\toptions: IRunOptionsRuntime;\r\n\tcoordinates: ISourcesCoordinates;\r\n}): Promise<Runtime> {\r\n\tconst adapter: RuntimeAdapter =\r\n\t\toptions.parallel > 0\r\n\t\t\t? new ChildProcessAdapter(environment, logger, eventBroadcaster, options, supportCodeLibrary, coordinates)\r\n\t\t\t: new InProcessAdapter(eventBroadcaster, newId, options, supportCodeLibrary);\r\n\treturn new Coordinator(eventBroadcaster, newId, sourcedPickles, supportCodeLibrary, adapter);\r\n}\r\n"]}
1
+ {"version":3,"file":"make-runtime.js","sourceRoot":"","sources":["../../src/runtime/make-runtime.ts"],"names":[],"mappings":";;AAiBA,kCAwBC;AAjCD,gDAAyD;AACzD,8CAAoD;AACpD,+CAA4C;AAG5C;;;GAGG;AACI,KAAK,UAAU,WAAW,CAAC,EACjC,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,kBAAkB,EAClB,OAAO,EACP,WAAW,EAUX;IACA,MAAM,OAAO,GACZ,OAAO,CAAC,QAAQ,GAAG,CAAC;QACnB,CAAC,CAAC,IAAI,6BAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,CAAC;QAC1G,CAAC,CAAC,IAAI,0BAAgB,CAAC,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC/E,OAAO,IAAI,yBAAW,CAAC,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["import { EventEmitter } from 'node:events';\r\nimport { IdGenerator } from '@cucumber/messages';\r\nimport { ISourcesCoordinates } from '@cucumber/cucumber/lib/api/index';\r\nimport { ILogger } from '@cucumber/cucumber/lib/environment/index';\r\nimport { SourcedPickle } from '@cucumber/cucumber/lib/assemble/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { Runtime, RuntimeAdapter } from '@cucumber/cucumber/lib/runtime/types';\r\nimport { ChildProcessAdapter } from './parallel/adapter';\r\nimport { InProcessAdapter } from './serial/adapter';\r\nimport { Coordinator } from './coordinator';\r\nimport { ITsFlowRunOptionsRuntime } from './types';\r\n\r\n/**\r\n * Extending this function from cucumber.js to use our own implementation\r\n * of the Coordinator.\r\n */\r\nexport async function makeRuntime({\r\n\tenvironment,\r\n\tlogger,\r\n\teventBroadcaster,\r\n\tsourcedPickles,\r\n\tnewId,\r\n\tsupportCodeLibrary,\r\n\toptions,\r\n\tcoordinates\r\n}: {\r\n\tenvironment: IRunEnvironment;\r\n\tlogger: ILogger;\r\n\teventBroadcaster: EventEmitter;\r\n\tnewId: IdGenerator.NewId;\r\n\tsourcedPickles: ReadonlyArray<SourcedPickle>;\r\n\tsupportCodeLibrary: SupportCodeLibrary;\r\n\toptions: ITsFlowRunOptionsRuntime;\r\n\tcoordinates: ISourcesCoordinates;\r\n}): Promise<Runtime> {\r\n\tconst adapter: RuntimeAdapter =\r\n\t\toptions.parallel > 0\r\n\t\t\t? new ChildProcessAdapter(environment, logger, eventBroadcaster, options, supportCodeLibrary, coordinates)\r\n\t\t\t: new InProcessAdapter(eventBroadcaster, newId, options, supportCodeLibrary);\r\n\treturn new Coordinator(eventBroadcaster, newId, sourcedPickles, supportCodeLibrary, adapter);\r\n}\r\n"]}
@@ -3,7 +3,7 @@ import { StepBinding } from '../bindings/step-binding';
3
3
  import { ManagedScenarioContext } from './managed-scenario-context';
4
4
  import EventEmitter from 'events';
5
5
  import { EndTestCaseInfo } from './test-case-info';
6
- import { IMessageData } from './parallel/types';
6
+ import { IMessageData } from './types';
7
7
  export interface ITestCaseAttempt {
8
8
  attempt: number;
9
9
  willBeRetried: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"message-collector.js","sourceRoot":"","sources":["../../src/runtime/message-collector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA+C;AAC/C,wEAAuF;AAEvF,yEAAoE;AACpE,mCAA2D;AAC3D,8CAAkD;AAClD,iDAA0D;AA6B1D;;;;;;;;;GASG;AACH,MAAqB,gBAAgB;IAC5B,kBAAkB,GAA6C,EAAE,CAAC;IAClE,SAAS,GAAoC,EAAE,CAAC;IAChD,WAAW,GAAsC,EAAE,CAAC;IACpD,sBAAsB,GAAyC,EAAE,CAAC;IAClE,uBAAuB,GAAsC,EAAE,CAAC;IAChE,kBAAkB,GAA6C,EAAE,CAAC;IAE1E,YAAY,gBAA8B;QACzC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAyB;QAC9B,IAAI,CAAC,kBAAkB,GAAG,WAAW,CAAC,kBAAkB,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;QAC3C,IAAI,CAAC,sBAAsB,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,cAAc;QACb,MAAM,IAAI,GAAG,EAAkB,CAAC;QAChC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC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;QACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;QACxE,IAAI,QAAQ,EAAE,CAAC;YACd,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAC9D,IAAI,QAAQ,IAAI,QAAQ,CAAC,eAAe,EAAE,CAAC;gBAC1C,MAAM,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;gBACpD,QAAQ,CAAC,eAAe,GAAG,SAAS,CAAC;YACtC,CAAC;QACF,CAAC;IACF,CAAC;IAED;;;;OAIG;IACK,kBAAkB,CAAC,UAAkB;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAI,QAAQ,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAc,CAAC;QACvD,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACK,WAAW,CAAC,IAAY;QAC/B,OAAO,IAAA,wBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;CACD;AArPD,mCAqPC","sourcesContent":["import * as messages from '@cucumber/messages';\r\nimport { doesHaveValue, doesNotHaveValue } from '@cucumber/cucumber/lib/value_checker';\r\nimport { StepBinding } from '../bindings/step-binding';\r\nimport { ManagedScenarioContext } from './managed-scenario-context';\r\nimport { hasMatchingStep, hasMatchingTags } from './utils';\r\nimport { hasStringValue } from '../utils/helpers';\r\nimport { TestStepResultStatus } from '@cucumber/messages';\r\nimport EventEmitter from 'events';\r\nimport { EndTestCaseInfo } from './test-case-info';\r\nimport { IMessageData } from './parallel/types';\r\n\r\ninterface ITestCaseAttemptData {\r\n\tattempt: number;\r\n\twillBeRetried: boolean;\r\n\ttestCaseId: string;\r\n\tstepAttachments: Record<string, messages.Attachment[]>;\r\n\tstepResults: Record<string, messages.TestStepResult>;\r\n\tworstTestStepResult: messages.TestStepResult;\r\n}\r\n\r\nexport interface ITestCaseAttempt {\r\n\tattempt: number;\r\n\twillBeRetried: boolean;\r\n\tgherkinDocument: messages.GherkinDocument;\r\n\tpickle: messages.Pickle;\r\n\tstepAttachments: Record<string, messages.Attachment[]>;\r\n\tstepResults: Record<string, messages.TestStepResult>;\r\n\ttestCase: messages.TestCase;\r\n\tworstTestStepResult: messages.TestStepResult;\r\n}\r\n\r\ninterface IScenario extends messages.Pickle {\r\n\tscenarioContext: ManagedScenarioContext | undefined;\r\n}\r\n\r\n/**\r\n * Custom implementation of the EventDataCollector from cucumber.js\r\n *\r\n * This implements all of the functions from the original EventDataCollector along\r\n * with new functions to support binding to tsFlow tests.\r\n *\r\n * By extending the original version we're also reducing the amount of data stored\r\n * during test runs because the original MessageCollector was capturing the same\r\n * pickle and testCase data that the EventDataCollector does.\r\n */\r\nexport default class MessageCollector {\r\n\tprivate gherkinDocumentMap: Record<string, messages.GherkinDocument> = {};\r\n\tprivate pickleMap: Record<string, messages.Pickle> = {};\r\n\tprivate testCaseMap: Record<string, messages.TestCase> = {};\r\n\tprivate testCaseAttemptDataMap: Record<string, ITestCaseAttemptData> = {};\r\n\tprivate undefinedParameterTypes: messages.UndefinedParameterType[] = [];\r\n\tprivate testCaseRunningMap: Record<string, messages.TestCaseStarted> = {};\r\n\r\n\tconstructor(eventBroadcaster: EventEmitter) {\r\n\t\teventBroadcaster.on('envelope', this.parseEnvelope.bind(this));\r\n\t}\r\n\r\n\t/**\r\n\t * Reset this message collector for a new parallel test run.\r\n\t * @param messageData Gerkin information from initial load\r\n\t */\r\n\treset(messageData: IMessageData): void {\r\n\t\tthis.gherkinDocumentMap = messageData.gherkinDocumentMap;\r\n\t\tthis.pickleMap = messageData.pickleMap;\r\n\t\tthis.testCaseMap = messageData.testCaseMap;\r\n\t\tthis.testCaseAttemptDataMap = {};\r\n\t\tthis.undefinedParameterTypes = [];\r\n\t\tthis.testCaseRunningMap = {};\r\n\t}\r\n\r\n\t/**\r\n\t * Get Gerkin message data for parallel runs\r\n\t * @returns Gerkin informaion loaded during startup\r\n\t */\r\n\tgetMessageData(): IMessageData {\r\n\t\tconst data = {} as IMessageData;\r\n\t\tdata.gherkinDocumentMap = this.gherkinDocumentMap;\r\n\t\tdata.pickleMap = this.pickleMap;\r\n\t\tdata.testCaseMap = this.testCaseMap;\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\t/**\r\n\t * Check for failures in a test run\r\n\t * @returns true if there are failures in the last test case attempt\r\n\t */\r\n\thasFailures(): boolean {\r\n\t\tfor (const caseKey in this.testCaseAttemptDataMap) {\r\n\t\t\tconst stepResults = this.testCaseAttemptDataMap[caseKey].stepResults;\r\n\t\t\tfor (const key in stepResults) {\r\n\t\t\t\tif (stepResults[key].status === TestStepResultStatus.FAILED) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tgetGherkinDocument(uri: string): messages.GherkinDocument {\r\n\t\treturn this.gherkinDocumentMap[uri];\r\n\t}\r\n\r\n\tgetPickle(pickleId: string): messages.Pickle {\r\n\t\treturn this.pickleMap[pickleId];\r\n\t}\r\n\r\n\tgetTestCaseAttempts(): ITestCaseAttempt[] {\r\n\t\treturn Object.keys(this.testCaseAttemptDataMap).map(testCaseStartedId => {\r\n\t\t\treturn this.getTestCaseAttempt(testCaseStartedId);\r\n\t\t});\r\n\t}\r\n\r\n\tgetTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\r\n\t\tconst testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId];\r\n\t\tconst testCase = this.testCaseMap[testCaseAttemptData.testCaseId];\r\n\t\tconst pickle = this.pickleMap[testCase.pickleId];\r\n\t\treturn {\r\n\t\t\tgherkinDocument: this.gherkinDocumentMap[pickle.uri],\r\n\t\t\tpickle,\r\n\t\t\ttestCase,\r\n\t\t\tattempt: testCaseAttemptData.attempt,\r\n\t\t\twillBeRetried: testCaseAttemptData.willBeRetried,\r\n\t\t\tstepAttachments: testCaseAttemptData.stepAttachments,\r\n\t\t\tstepResults: testCaseAttemptData.stepResults,\r\n\t\t\tworstTestStepResult: testCaseAttemptData.worstTestStepResult\r\n\t\t};\r\n\t}\r\n\r\n\tparseEnvelope(envelope: messages.Envelope): void {\r\n\t\tif (doesHaveValue(envelope.gherkinDocument)) {\r\n\t\t\tthis.gherkinDocumentMap[envelope.gherkinDocument.uri] = envelope.gherkinDocument;\r\n\t\t} else if (doesHaveValue(envelope.pickle)) {\r\n\t\t\tthis.pickleMap[envelope.pickle.id] = envelope.pickle;\r\n\t\t} else if (doesHaveValue(envelope.undefinedParameterType)) {\r\n\t\t\tthis.undefinedParameterTypes.push(envelope.undefinedParameterType);\r\n\t\t} else if (doesHaveValue(envelope.testCase)) {\r\n\t\t\tthis.testCaseMap[envelope.testCase.id] = envelope.testCase;\r\n\t\t} else if (doesHaveValue(envelope.testCaseStarted)) {\r\n\t\t\tthis.initTestCaseAttempt(envelope.testCaseStarted);\r\n\t\t\tthis.startTestCase(envelope.testCaseStarted);\r\n\t\t} else if (doesHaveValue(envelope.attachment)) {\r\n\t\t\tthis.storeAttachment(envelope.attachment);\r\n\t\t} else if (doesHaveValue(envelope.testStepFinished)) {\r\n\t\t\tthis.storeTestStepResult(envelope.testStepFinished);\r\n\t\t} else if (doesHaveValue(envelope.testCaseFinished)) {\r\n\t\t\tthis.storeTestCaseResult(envelope.testCaseFinished);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate initTestCaseAttempt(testCaseStarted: messages.TestCaseStarted): void {\r\n\t\tthis.testCaseAttemptDataMap[testCaseStarted.id] = {\r\n\t\t\tattempt: testCaseStarted.attempt,\r\n\t\t\twillBeRetried: false,\r\n\t\t\ttestCaseId: testCaseStarted.testCaseId,\r\n\t\t\tstepAttachments: {},\r\n\t\t\tstepResults: {},\r\n\t\t\tworstTestStepResult: {\r\n\t\t\t\tduration: { seconds: 0, nanos: 0 },\r\n\t\t\t\tstatus: messages.TestStepResultStatus.UNKNOWN\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n\r\n\tstoreAttachment(attachment: messages.Attachment): void {\r\n\t\tconst { testCaseStartedId, testStepId } = attachment;\r\n\t\tif (testCaseStartedId && testStepId) {\r\n\t\t\tconst { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId];\r\n\t\t\tif (doesNotHaveValue(stepAttachments[testStepId])) {\r\n\t\t\t\tstepAttachments[testStepId] = [];\r\n\t\t\t}\r\n\t\t\tstepAttachments[testStepId].push(attachment);\r\n\t\t}\r\n\t}\r\n\r\n\tstoreTestStepResult({ testCaseStartedId, testStepId, testStepResult }: messages.TestStepFinished): void {\r\n\t\tthis.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] = testStepResult;\r\n\t}\r\n\r\n\tstoreTestCaseResult({ testCaseStartedId, willBeRetried }: messages.TestCaseFinished): void {\r\n\t\tconst stepResults = Object.values(this.testCaseAttemptDataMap[testCaseStartedId].stepResults);\r\n\t\tthis.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult = messages.getWorstTestStepResult(stepResults);\r\n\t\tthis.testCaseAttemptDataMap[testCaseStartedId].willBeRetried = willBeRetried;\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the Pickle from hook parameters passed in from Cucumber\r\n\t * to find a matching Pickle (scenario) and return the scenario Context\r\n\t * @param hookParam\r\n\t * @returns\r\n\t */\r\n\tgetHookScenarioContext(hookParam: any): ManagedScenarioContext | undefined {\r\n\t\tlet scenarioContext: ManagedScenarioContext | undefined;\r\n\r\n\t\tif (hookParam) {\r\n\t\t\tconst pickle = hookParam.pickle;\r\n\t\t\tconst scenario = this.pickleMap[pickle.id] as IScenario;\r\n\t\t\tif (scenario && scenario.scenarioContext) {\r\n\t\t\t\tscenarioContext = scenario.scenarioContext;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn scenarioContext;\r\n\t}\r\n\r\n\t/**\r\n\t * Uses StepPattern information to find a matching scenario\r\n\t * and return the ScenarioContext\r\n\t * @param stepBinding\r\n\t * @returns\r\n\t */\r\n\tgetStepScenarioContext(stepBinding: StepBinding): ManagedScenarioContext | undefined {\r\n\t\tlet scenarioContext: ManagedScenarioContext | undefined;\r\n\t\tfor (const [, pickle] of Object.entries(this.pickleMap)) {\r\n\t\t\tconst scenario = pickle as IScenario;\r\n\t\t\tfor (const step of scenario.steps) {\r\n\t\t\t\tif (hasMatchingStep(stepBinding.stepPattern.toString(), step.text)) {\r\n\t\t\t\t\t// if we have tags on the step binding check to see if it matches one in the\r\n\t\t\t\t\t// current scenario, which also includes tags associated with the feature\r\n\t\t\t\t\tif (stepBinding.tags && this.stepHasTags(stepBinding.tags)) {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tscenario.tags.length > 0 &&\r\n\t\t\t\t\t\t\thasMatchingTags(\r\n\t\t\t\t\t\t\t\tstepBinding.tags,\r\n\t\t\t\t\t\t\t\tscenario.tags.map(x => x.name)\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tscenarioContext = scenario.scenarioContext;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tscenarioContext = scenario.scenarioContext;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (scenarioContext) break;\r\n\t\t\t}\r\n\t\t\tif (scenarioContext) break;\r\n\t\t}\r\n\t\treturn scenarioContext;\r\n\t}\r\n\t/**\r\n\t * Called when a test case (scenario) starts. Intercepting\r\n\t * this message to initialize a new ScenarioContext\r\n\t * @param testCaseStarted\r\n\t */\r\n\tprivate startTestCase(testCaseStarted: messages.TestCaseStarted): void {\r\n\t\tthis.testCaseRunningMap[testCaseStarted.id] = testCaseStarted;\r\n\t\tconst scenario = this.getScenarioForTest(testCaseStarted.testCaseId);\r\n\t\tif (scenario) {\r\n\t\t\tconst tags = scenario.tags.map(t => t.name);\r\n\t\t\tscenario.scenarioContext = new ManagedScenarioContext(scenario.name, tags);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Called when a test case (scenario) ends. Intercepting\r\n\t * this message to dispose and clear the ScenarioContext\r\n\t * @param testCaseFinished\r\n\t */\r\n\tpublic async endTestCase(endTestCase: EndTestCaseInfo): Promise<void> {\r\n\t\tconst testCase = this.testCaseRunningMap[endTestCase.testCaseStartedId];\r\n\t\tif (testCase) {\r\n\t\t\tconst scenario = this.getScenarioForTest(testCase.testCaseId);\r\n\t\t\tif (scenario && scenario.scenarioContext) {\r\n\t\t\t\tawait scenario.scenarioContext.dispose(endTestCase);\r\n\t\t\t\tscenario.scenarioContext = undefined;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Uses the testCaleId passed in to find the associated Pickle (scenario)\r\n\t * @param testCaseId\r\n\t * @returns\r\n\t */\r\n\tprivate getScenarioForTest(testCaseId: string): IScenario | undefined {\r\n\t\tconst testCase = this.testCaseMap[testCaseId];\r\n\t\tif (testCase) {\r\n\t\t\treturn this.pickleMap[testCase.pickleId] as IScenario;\r\n\t\t}\r\n\t\treturn undefined;\r\n\t}\r\n\r\n\t/**\r\n\t * StepBinding tags are initialized with an astrick when empty.\r\n\t * Need to make sure tags has a value and not an astrick\r\n\t * @param tags\r\n\t * @returns\r\n\t */\r\n\tprivate stepHasTags(tags: string): boolean {\r\n\t\treturn hasStringValue(tags) && !tags?.includes('*');\r\n\t}\r\n}\r\n"]}
1
+ {"version":3,"file":"message-collector.js","sourceRoot":"","sources":["../../src/runtime/message-collector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA+C;AAC/C,wEAAuF;AAEvF,yEAAoE;AACpE,mCAA2D;AAC3D,8CAAkD;AAClD,iDAA0D;AA6B1D;;;;;;;;;GASG;A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C,eAAe,GAAG,SAAS,CAAC;YACtC,CAAC;QACF,CAAC;IACF,CAAC;IAED;;;;OAIG;IACK,kBAAkB,CAAC,UAAkB;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAI,QAAQ,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAc,CAAC;QACvD,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACK,WAAW,CAAC,IAAY;QAC/B,OAAO,IAAA,wBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;CACD;AArPD,mCAqPC","sourcesContent":["import * as messages from '@cucumber/messages';\r\nimport { doesHaveValue, doesNotHaveValue } from '@cucumber/cucumber/lib/value_checker';\r\nimport { StepBinding } from '../bindings/step-binding';\r\nimport { ManagedScenarioContext } from './managed-scenario-context';\r\nimport { hasMatchingStep, hasMatchingTags } from './utils';\r\nimport { hasStringValue } from '../utils/helpers';\r\nimport { TestStepResultStatus } from '@cucumber/messages';\r\nimport EventEmitter from 'events';\r\nimport { EndTestCaseInfo } from './test-case-info';\r\nimport { IMessageData } from './types';\r\n\r\ninterface ITestCaseAttemptData {\r\n\tattempt: number;\r\n\twillBeRetried: boolean;\r\n\ttestCaseId: string;\r\n\tstepAttachments: Record<string, messages.Attachment[]>;\r\n\tstepResults: Record<string, messages.TestStepResult>;\r\n\tworstTestStepResult: messages.TestStepResult;\r\n}\r\n\r\nexport interface ITestCaseAttempt {\r\n\tattempt: number;\r\n\twillBeRetried: boolean;\r\n\tgherkinDocument: messages.GherkinDocument;\r\n\tpickle: messages.Pickle;\r\n\tstepAttachments: Record<string, messages.Attachment[]>;\r\n\tstepResults: Record<string, messages.TestStepResult>;\r\n\ttestCase: messages.TestCase;\r\n\tworstTestStepResult: messages.TestStepResult;\r\n}\r\n\r\ninterface IScenario extends messages.Pickle {\r\n\tscenarioContext: ManagedScenarioContext | undefined;\r\n}\r\n\r\n/**\r\n * Custom implementation of the EventDataCollector from cucumber.js\r\n *\r\n * This implements all of the functions from the original EventDataCollector along\r\n * with new functions to support binding to tsFlow tests.\r\n *\r\n * By extending the original version we're also reducing the amount of data stored\r\n * during test runs because the original MessageCollector was capturing the same\r\n * pickle and testCase data that the EventDataCollector does.\r\n */\r\nexport default class MessageCollector {\r\n\tprivate gherkinDocumentMap: Record<string, messages.GherkinDocument> = {};\r\n\tprivate pickleMap: Record<string, messages.Pickle> = {};\r\n\tprivate testCaseMap: Record<string, messages.TestCase> = {};\r\n\tprivate testCaseAttemptDataMap: Record<string, ITestCaseAttemptData> = {};\r\n\tprivate undefinedParameterTypes: messages.UndefinedParameterType[] = [];\r\n\tprivate testCaseRunningMap: Record<string, messages.TestCaseStarted> = {};\r\n\r\n\tconstructor(eventBroadcaster: EventEmitter) {\r\n\t\teventBroadcaster.on('envelope', this.parseEnvelope.bind(this));\r\n\t}\r\n\r\n\t/**\r\n\t * Reset this message collector for a new parallel test run.\r\n\t * @param messageData Gerkin information from initial load\r\n\t */\r\n\treset(messageData: IMessageData): void {\r\n\t\tthis.gherkinDocumentMap = messageData.gherkinDocumentMap;\r\n\t\tthis.pickleMap = messageData.pickleMap;\r\n\t\tthis.testCaseMap = messageData.testCaseMap;\r\n\t\tthis.testCaseAttemptDataMap = {};\r\n\t\tthis.undefinedParameterTypes = [];\r\n\t\tthis.testCaseRunningMap = {};\r\n\t}\r\n\r\n\t/**\r\n\t * Get Gerkin message data for parallel runs\r\n\t * @returns Gerkin informaion loaded during startup\r\n\t */\r\n\tgetMessageData(): IMessageData {\r\n\t\tconst data = {} as IMessageData;\r\n\t\tdata.gherkinDocumentMap = this.gherkinDocumentMap;\r\n\t\tdata.pickleMap = this.pickleMap;\r\n\t\tdata.testCaseMap = this.testCaseMap;\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\t/**\r\n\t * Check for failures in a test run\r\n\t * @returns true if there are failures in the last test case attempt\r\n\t */\r\n\thasFailures(): boolean {\r\n\t\tfor (const caseKey in this.testCaseAttemptDataMap) {\r\n\t\t\tconst stepResults = this.testCaseAttemptDataMap[caseKey].stepResults;\r\n\t\t\tfor (const key in stepResults) {\r\n\t\t\t\tif (stepResults[key].status === TestStepResultStatus.FAILED) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tgetGherkinDocument(uri: string): messages.GherkinDocument {\r\n\t\treturn this.gherkinDocumentMap[uri];\r\n\t}\r\n\r\n\tgetPickle(pickleId: string): messages.Pickle {\r\n\t\treturn this.pickleMap[pickleId];\r\n\t}\r\n\r\n\tgetTestCaseAttempts(): ITestCaseAttempt[] {\r\n\t\treturn Object.keys(this.testCaseAttemptDataMap).map(testCaseStartedId => {\r\n\t\t\treturn this.getTestCaseAttempt(testCaseStartedId);\r\n\t\t});\r\n\t}\r\n\r\n\tgetTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\r\n\t\tconst testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId];\r\n\t\tconst testCase = this.testCaseMap[testCaseAttemptData.testCaseId];\r\n\t\tconst pickle = this.pickleMap[testCase.pickleId];\r\n\t\treturn {\r\n\t\t\tgherkinDocument: this.gherkinDocumentMap[pickle.uri],\r\n\t\t\tpickle,\r\n\t\t\ttestCase,\r\n\t\t\tattempt: testCaseAttemptData.attempt,\r\n\t\t\twillBeRetried: testCaseAttemptData.willBeRetried,\r\n\t\t\tstepAttachments: testCaseAttemptData.stepAttachments,\r\n\t\t\tstepResults: testCaseAttemptData.stepResults,\r\n\t\t\tworstTestStepResult: testCaseAttemptData.worstTestStepResult\r\n\t\t};\r\n\t}\r\n\r\n\tparseEnvelope(envelope: messages.Envelope): void {\r\n\t\tif (doesHaveValue(envelope.gherkinDocument)) {\r\n\t\t\tthis.gherkinDocumentMap[envelope.gherkinDocument.uri] = envelope.gherkinDocument;\r\n\t\t} else if (doesHaveValue(envelope.pickle)) {\r\n\t\t\tthis.pickleMap[envelope.pickle.id] = envelope.pickle;\r\n\t\t} else if (doesHaveValue(envelope.undefinedParameterType)) {\r\n\t\t\tthis.undefinedParameterTypes.push(envelope.undefinedParameterType);\r\n\t\t} else if (doesHaveValue(envelope.testCase)) {\r\n\t\t\tthis.testCaseMap[envelope.testCase.id] = envelope.testCase;\r\n\t\t} else if (doesHaveValue(envelope.testCaseStarted)) {\r\n\t\t\tthis.initTestCaseAttempt(envelope.testCaseStarted);\r\n\t\t\tthis.startTestCase(envelope.testCaseStarted);\r\n\t\t} else if (doesHaveValue(envelope.attachment)) {\r\n\t\t\tthis.storeAttachment(envelope.attachment);\r\n\t\t} else if (doesHaveValue(envelope.testStepFinished)) {\r\n\t\t\tthis.storeTestStepResult(envelope.testStepFinished);\r\n\t\t} else if (doesHaveValue(envelope.testCaseFinished)) {\r\n\t\t\tthis.storeTestCaseResult(envelope.testCaseFinished);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate initTestCaseAttempt(testCaseStarted: messages.TestCaseStarted): void {\r\n\t\tthis.testCaseAttemptDataMap[testCaseStarted.id] = {\r\n\t\t\tattempt: testCaseStarted.attempt,\r\n\t\t\twillBeRetried: false,\r\n\t\t\ttestCaseId: testCaseStarted.testCaseId,\r\n\t\t\tstepAttachments: {},\r\n\t\t\tstepResults: {},\r\n\t\t\tworstTestStepResult: {\r\n\t\t\t\tduration: { seconds: 0, nanos: 0 },\r\n\t\t\t\tstatus: messages.TestStepResultStatus.UNKNOWN\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n\r\n\tstoreAttachment(attachment: messages.Attachment): void {\r\n\t\tconst { testCaseStartedId, testStepId } = attachment;\r\n\t\tif (testCaseStartedId && testStepId) {\r\n\t\t\tconst { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId];\r\n\t\t\tif (doesNotHaveValue(stepAttachments[testStepId])) {\r\n\t\t\t\tstepAttachments[testStepId] = [];\r\n\t\t\t}\r\n\t\t\tstepAttachments[testStepId].push(attachment);\r\n\t\t}\r\n\t}\r\n\r\n\tstoreTestStepResult({ testCaseStartedId, testStepId, testStepResult }: messages.TestStepFinished): void {\r\n\t\tthis.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] = testStepResult;\r\n\t}\r\n\r\n\tstoreTestCaseResult({ testCaseStartedId, willBeRetried }: messages.TestCaseFinished): void {\r\n\t\tconst stepResults = Object.values(this.testCaseAttemptDataMap[testCaseStartedId].stepResults);\r\n\t\tthis.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult = messages.getWorstTestStepResult(stepResults);\r\n\t\tthis.testCaseAttemptDataMap[testCaseStartedId].willBeRetried = willBeRetried;\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the Pickle from hook parameters passed in from Cucumber\r\n\t * to find a matching Pickle (scenario) and return the scenario Context\r\n\t * @param hookParam\r\n\t * @returns\r\n\t */\r\n\tgetHookScenarioContext(hookParam: any): ManagedScenarioContext | undefined {\r\n\t\tlet scenarioContext: ManagedScenarioContext | undefined;\r\n\r\n\t\tif (hookParam) {\r\n\t\t\tconst pickle = hookParam.pickle;\r\n\t\t\tconst scenario = this.pickleMap[pickle.id] as IScenario;\r\n\t\t\tif (scenario && scenario.scenarioContext) {\r\n\t\t\t\tscenarioContext = scenario.scenarioContext;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn scenarioContext;\r\n\t}\r\n\r\n\t/**\r\n\t * Uses StepPattern information to find a matching scenario\r\n\t * and return the ScenarioContext\r\n\t * @param stepBinding\r\n\t * @returns\r\n\t */\r\n\tgetStepScenarioContext(stepBinding: StepBinding): ManagedScenarioContext | undefined {\r\n\t\tlet scenarioContext: ManagedScenarioContext | undefined;\r\n\t\tfor (const [, pickle] of Object.entries(this.pickleMap)) {\r\n\t\t\tconst scenario = pickle as IScenario;\r\n\t\t\tfor (const step of scenario.steps) {\r\n\t\t\t\tif (hasMatchingStep(stepBinding.stepPattern.toString(), step.text)) {\r\n\t\t\t\t\t// if we have tags on the step binding check to see if it matches one in the\r\n\t\t\t\t\t// current scenario, which also includes tags associated with the feature\r\n\t\t\t\t\tif (stepBinding.tags && this.stepHasTags(stepBinding.tags)) {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tscenario.tags.length > 0 &&\r\n\t\t\t\t\t\t\thasMatchingTags(\r\n\t\t\t\t\t\t\t\tstepBinding.tags,\r\n\t\t\t\t\t\t\t\tscenario.tags.map(x => x.name)\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tscenarioContext = scenario.scenarioContext;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tscenarioContext = scenario.scenarioContext;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (scenarioContext) break;\r\n\t\t\t}\r\n\t\t\tif (scenarioContext) break;\r\n\t\t}\r\n\t\treturn scenarioContext;\r\n\t}\r\n\t/**\r\n\t * Called when a test case (scenario) starts. Intercepting\r\n\t * this message to initialize a new ScenarioContext\r\n\t * @param testCaseStarted\r\n\t */\r\n\tprivate startTestCase(testCaseStarted: messages.TestCaseStarted): void {\r\n\t\tthis.testCaseRunningMap[testCaseStarted.id] = testCaseStarted;\r\n\t\tconst scenario = this.getScenarioForTest(testCaseStarted.testCaseId);\r\n\t\tif (scenario) {\r\n\t\t\tconst tags = scenario.tags.map(t => t.name);\r\n\t\t\tscenario.scenarioContext = new ManagedScenarioContext(scenario.name, tags);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Called when a test case (scenario) ends. Intercepting\r\n\t * this message to dispose and clear the ScenarioContext\r\n\t * @param testCaseFinished\r\n\t */\r\n\tpublic async endTestCase(endTestCase: EndTestCaseInfo): Promise<void> {\r\n\t\tconst testCase = this.testCaseRunningMap[endTestCase.testCaseStartedId];\r\n\t\tif (testCase) {\r\n\t\t\tconst scenario = this.getScenarioForTest(testCase.testCaseId);\r\n\t\t\tif (scenario && scenario.scenarioContext) {\r\n\t\t\t\tawait scenario.scenarioContext.dispose(endTestCase);\r\n\t\t\t\tscenario.scenarioContext = undefined;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Uses the testCaleId passed in to find the associated Pickle (scenario)\r\n\t * @param testCaseId\r\n\t * @returns\r\n\t */\r\n\tprivate getScenarioForTest(testCaseId: string): IScenario | undefined {\r\n\t\tconst testCase = this.testCaseMap[testCaseId];\r\n\t\tif (testCase) {\r\n\t\t\treturn this.pickleMap[testCase.pickleId] as IScenario;\r\n\t\t}\r\n\t\treturn undefined;\r\n\t}\r\n\r\n\t/**\r\n\t * StepBinding tags are initialized with an astrick when empty.\r\n\t * Need to make sure tags has a value and not an astrick\r\n\t * @param tags\r\n\t * @returns\r\n\t */\r\n\tprivate stepHasTags(tags: string): boolean {\r\n\t\treturn hasStringValue(tags) && !tags?.includes('*');\r\n\t}\r\n}\r\n"]}
@@ -4,8 +4,9 @@ import { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_
4
4
  import { AssembledTestCase } from '@cucumber/cucumber/lib/assemble/index';
5
5
  import { ILogger, IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';
6
6
  import { RuntimeAdapter } from '@cucumber/cucumber/lib/runtime/types';
7
- import { IRunOptionsRuntime, ISourcesCoordinates } from '@cucumber/cucumber/lib/api/index';
7
+ import { ISourcesCoordinates } from '@cucumber/cucumber/lib/api/index';
8
8
  import { WorkerToCoordinatorEvent } from '@cucumber/cucumber/lib/runtime/parallel/types';
9
+ import { ITsFlowRunOptionsRuntime } from '../types';
9
10
  declare const enum WorkerState {
10
11
  'idle' = 0,
11
12
  'closed' = 1,
@@ -34,7 +35,7 @@ export declare class ChildProcessAdapter implements RuntimeAdapter {
34
35
  private todo;
35
36
  private readonly inProgress;
36
37
  private readonly workers;
37
- constructor(environment: IRunEnvironment, logger: ILogger, eventBroadcaster: EventEmitter, options: IRunOptionsRuntime, supportCodeLibrary: SupportCodeLibrary, coordinates: ISourcesCoordinates);
38
+ constructor(environment: IRunEnvironment, logger: ILogger, eventBroadcaster: EventEmitter, options: ITsFlowRunOptionsRuntime, supportCodeLibrary: SupportCodeLibrary, coordinates: ISourcesCoordinates);
38
39
  parseWorkerMessage(worker: ManagedWorker, message: WorkerToCoordinatorEvent): void;
39
40
  awakenWorkers(triggeringWorker: ManagedWorker): void;
40
41
  startWorker(id: string, total: number): void;
@@ -70,7 +70,8 @@ class ChildProcessAdapter {
70
70
  ...this.environment.env,
71
71
  CUCUMBER_PARALLEL: 'true',
72
72
  CUCUMBER_TOTAL_WORKERS: total.toString(),
73
- CUCUMBER_WORKER_ID: id
73
+ CUCUMBER_WORKER_ID: id,
74
+ EXPERIMENTAL_DECORATORS: this.options.experimentalDecorators.toString()
74
75
  },
75
76
  stdio: ['inherit', 'inherit', 'inherit', 'ipc']
76
77
  });