@lynxwall/cucumber-tsflow 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +284 -0
- package/dist/behave-json-formatter.d.ts +19 -0
- package/dist/behave-json-formatter.d.ts.map +1 -0
- package/dist/behave-json-formatter.js +62 -0
- package/dist/behave-json-formatter.js.map +1 -0
- package/dist/binding-decorator.d.ts +11 -0
- package/dist/binding-decorator.d.ts.map +1 -0
- package/dist/binding-decorator.js +189 -0
- package/dist/binding-decorator.js.map +1 -0
- package/dist/binding-registry.d.ts +75 -0
- package/dist/binding-registry.d.ts.map +1 -0
- package/dist/binding-registry.js +177 -0
- package/dist/binding-registry.js.map +1 -0
- package/dist/hook-decorators.d.ts +29 -0
- package/dist/hook-decorators.d.ts.map +1 -0
- package/dist/hook-decorators.js +82 -0
- package/dist/hook-decorators.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +17 -0
- package/dist/logger.js.map +1 -0
- package/dist/managed-scenario-context.d.ts +22 -0
- package/dist/managed-scenario-context.d.ts.map +1 -0
- package/dist/managed-scenario-context.js +98 -0
- package/dist/managed-scenario-context.js.map +1 -0
- package/dist/our-callsite.d.ts +26 -0
- package/dist/our-callsite.d.ts.map +1 -0
- package/dist/our-callsite.js +49 -0
- package/dist/our-callsite.js.map +1 -0
- package/dist/scenario-context.d.ts +17 -0
- package/dist/scenario-context.d.ts.map +1 -0
- package/dist/scenario-context.js +24 -0
- package/dist/scenario-context.js.map +1 -0
- package/dist/scenario-info.d.ts +17 -0
- package/dist/scenario-info.d.ts.map +1 -0
- package/dist/scenario-info.js +31 -0
- package/dist/scenario-info.js.map +1 -0
- package/dist/step-binding-flags.d.ts +46 -0
- package/dist/step-binding-flags.d.ts.map +1 -0
- package/dist/step-binding-flags.js +61 -0
- package/dist/step-binding-flags.js.map +1 -0
- package/dist/step-binding.d.ts +45 -0
- package/dist/step-binding.d.ts.map +1 -0
- package/dist/step-binding.js +24 -0
- package/dist/step-binding.js.map +1 -0
- package/dist/step-definition-decorators.d.ts +25 -0
- package/dist/step-definition-decorators.d.ts.map +1 -0
- package/dist/step-definition-decorators.js +95 -0
- package/dist/step-definition-decorators.js.map +1 -0
- package/dist/tsflow-snippet-syntax.d.ts +10 -0
- package/dist/tsflow-snippet-syntax.d.ts.map +1 -0
- package/dist/tsflow-snippet-syntax.js +73 -0
- package/dist/tsflow-snippet-syntax.js.map +1 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "underscore"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BindingRegistry = exports.DEFAULT_TAG = exports.DEFAULT_STEP_PATTERN = void 0;
|
|
13
|
+
const _ = require("underscore");
|
|
14
|
+
/**
|
|
15
|
+
* Represents the default step pattern.
|
|
16
|
+
*/
|
|
17
|
+
exports.DEFAULT_STEP_PATTERN = '/.*/';
|
|
18
|
+
/**
|
|
19
|
+
* Represents the default tag.
|
|
20
|
+
*/
|
|
21
|
+
exports.DEFAULT_TAG = '*';
|
|
22
|
+
/**
|
|
23
|
+
* A metadata registry that captures information about bindings and their bound step bindings.
|
|
24
|
+
*/
|
|
25
|
+
class BindingRegistry {
|
|
26
|
+
constructor() {
|
|
27
|
+
this._bindings = new Map();
|
|
28
|
+
this._targetBindings = new Map();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the binding registry singleton.
|
|
32
|
+
*
|
|
33
|
+
* @returns A [[BindingRegistry]].
|
|
34
|
+
*/
|
|
35
|
+
static get instance() {
|
|
36
|
+
const BINDING_REGISTRY_SLOTNAME = '__CUCUMBER_TSFLOW_BINDINGREGISTRY';
|
|
37
|
+
const registry = global[BINDING_REGISTRY_SLOTNAME];
|
|
38
|
+
if (!registry) {
|
|
39
|
+
global[BINDING_REGISTRY_SLOTNAME] = new BindingRegistry();
|
|
40
|
+
}
|
|
41
|
+
return registry || global[BINDING_REGISTRY_SLOTNAME];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Updates the binding registry with information about the context types required by a
|
|
45
|
+
* binding class.
|
|
46
|
+
*
|
|
47
|
+
* @param targetPrototype The class representing the binding (constructor function).
|
|
48
|
+
* @param contextTypes An array of [[ContextType]] that define the types of objects that
|
|
49
|
+
* should be injected into the binding class during a scenario execution.
|
|
50
|
+
*/
|
|
51
|
+
registerContextTypesForTarget(targetPrototype, contextTypes) {
|
|
52
|
+
if (!contextTypes) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
let targetDecorations = this._targetBindings.get(targetPrototype);
|
|
56
|
+
if (!targetDecorations) {
|
|
57
|
+
targetDecorations = {
|
|
58
|
+
stepBindings: [],
|
|
59
|
+
contextTypes: []
|
|
60
|
+
};
|
|
61
|
+
this._targetBindings.set(targetPrototype, targetDecorations);
|
|
62
|
+
}
|
|
63
|
+
targetDecorations.contextTypes = contextTypes;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Retrieves the context types that have been registered for a given binding class.
|
|
67
|
+
*
|
|
68
|
+
* @param targetPrototype The class representing the binding (constructor function).
|
|
69
|
+
*
|
|
70
|
+
* @returns An array of [[ContextType]] that have been registered for the specified
|
|
71
|
+
* binding class.
|
|
72
|
+
*/
|
|
73
|
+
getContextTypesForTarget(targetPrototype) {
|
|
74
|
+
const targetBinding = this._targetBindings.get(targetPrototype);
|
|
75
|
+
if (!targetBinding) {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
return targetBinding.contextTypes;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Updates the binding registry indexes with a step binding.
|
|
82
|
+
*
|
|
83
|
+
* @param stepBinding The step binding that is to be registered with the binding registry.
|
|
84
|
+
*/
|
|
85
|
+
registerStepBinding(stepBinding) {
|
|
86
|
+
if (!stepBinding.tag) {
|
|
87
|
+
stepBinding.tag = exports.DEFAULT_TAG;
|
|
88
|
+
}
|
|
89
|
+
if (stepBinding.tag !== exports.DEFAULT_TAG && !stepBinding.tag.startsWith('@')) {
|
|
90
|
+
// tslint:disable-next-line:no-console
|
|
91
|
+
console.log('tag should start with @; tsflow has stopped to automatically prepend @ for you.');
|
|
92
|
+
}
|
|
93
|
+
const stepPattern = stepBinding.stepPattern
|
|
94
|
+
? stepBinding.stepPattern.toString()
|
|
95
|
+
: exports.DEFAULT_STEP_PATTERN;
|
|
96
|
+
let tagMap = this._bindings.get(stepPattern);
|
|
97
|
+
if (!tagMap) {
|
|
98
|
+
tagMap = new Map();
|
|
99
|
+
this._bindings.set(stepPattern, tagMap);
|
|
100
|
+
}
|
|
101
|
+
let stepBindings = tagMap.get(stepBinding.tag);
|
|
102
|
+
if (!stepBindings) {
|
|
103
|
+
stepBindings = [];
|
|
104
|
+
tagMap.set(stepBinding.tag, stepBindings);
|
|
105
|
+
}
|
|
106
|
+
if (!stepBindings.some(b => isSameStepBinding(stepBinding, b))) {
|
|
107
|
+
stepBindings.push(stepBinding);
|
|
108
|
+
}
|
|
109
|
+
// Index the step binding for the target
|
|
110
|
+
let targetBinding = this._targetBindings.get(stepBinding.targetPrototype);
|
|
111
|
+
if (!targetBinding) {
|
|
112
|
+
targetBinding = {
|
|
113
|
+
stepBindings: [],
|
|
114
|
+
contextTypes: []
|
|
115
|
+
};
|
|
116
|
+
this._targetBindings.set(stepBinding.targetPrototype, targetBinding);
|
|
117
|
+
}
|
|
118
|
+
if (!targetBinding.stepBindings.some(b => isSameStepBinding(stepBinding, b))) {
|
|
119
|
+
targetBinding.stepBindings.push(stepBinding);
|
|
120
|
+
}
|
|
121
|
+
function isSameStepBinding(a, b) {
|
|
122
|
+
return (a.callsite.filename === b.callsite.filename &&
|
|
123
|
+
a.callsite.lineNumber === b.callsite.lineNumber &&
|
|
124
|
+
String(a.tag) === String(b.tag) &&
|
|
125
|
+
String(a.stepPattern) === String(b.stepPattern));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Retrieves the step bindings that have been registered for a given binding class.
|
|
130
|
+
*
|
|
131
|
+
* @param targetPrototype The class representing the binding (constructor function).
|
|
132
|
+
*
|
|
133
|
+
* @returns An array of [[StepBinding]] objects that have been registered for the specified
|
|
134
|
+
* binding class.
|
|
135
|
+
*/
|
|
136
|
+
getStepBindingsForTarget(targetPrototype) {
|
|
137
|
+
const targetBinding = this._targetBindings.get(targetPrototype);
|
|
138
|
+
if (!targetBinding) {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
return targetBinding.stepBindings;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Retrieves the step bindings for a given step pattern and collection of tag names.
|
|
145
|
+
*
|
|
146
|
+
* @param stepPattern The step pattern to search.
|
|
147
|
+
* @param tags An array of [[TagName]] to search.
|
|
148
|
+
*
|
|
149
|
+
* @returns An array of [[StepBinding]] that map to the given step pattern and set of tag names.
|
|
150
|
+
*/
|
|
151
|
+
getStepBindings(stepPattern, tags) {
|
|
152
|
+
const tagMap = this._bindings.get(stepPattern);
|
|
153
|
+
if (!tagMap) {
|
|
154
|
+
return [];
|
|
155
|
+
}
|
|
156
|
+
const matchingStepBindings = this.mapTagNamesToStepBindings(tags, tagMap);
|
|
157
|
+
if (matchingStepBindings.length > 0) {
|
|
158
|
+
return matchingStepBindings;
|
|
159
|
+
}
|
|
160
|
+
return this.mapTagNamesToStepBindings(['*'], tagMap);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Maps an array of tag names to an array of associated step bindings.
|
|
164
|
+
*
|
|
165
|
+
* @param tags An array of [[TagName]].
|
|
166
|
+
* @param tagMap The map of [[TagName]] -> [[StepBinding]] to use when mapping.
|
|
167
|
+
*
|
|
168
|
+
* @returns An array of [[StepBinding]].
|
|
169
|
+
*/
|
|
170
|
+
mapTagNamesToStepBindings(tags, tagMap) {
|
|
171
|
+
const matchingStepBindings = _.flatten(_.map(tags, tag => tagMap.get(tag)));
|
|
172
|
+
return _.reject(matchingStepBindings, stepBinding => stepBinding === undefined);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.BindingRegistry = BindingRegistry;
|
|
176
|
+
});
|
|
177
|
+
//# sourceMappingURL=binding-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding-registry.js","sourceRoot":"","sources":["../src/binding-registry.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,gCAAgC;IAoBhC;;OAEG;IACU,QAAA,oBAAoB,GAAG,MAAM,CAAC;IAE3C;;OAEG;IACU,QAAA,WAAW,GAAG,GAAG,CAAC;IAE/B;;OAEG;IACH,MAAa,eAAe;QAA5B;YACS,cAAS,GAAG,IAAI,GAAG,EAA4C,CAAC;YAChE,oBAAe,GAAG,IAAI,GAAG,EAAsB,CAAC;QAyLzD,CAAC;QAvLA;;;;WAIG;QACI,MAAM,KAAK,QAAQ;YACzB,MAAM,yBAAyB,GAAG,mCAAmC,CAAC;YAEtE,MAAM,QAAQ,GAAI,MAAc,CAAC,yBAAyB,CAAC,CAAC;YAE5D,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAc,CAAC,yBAAyB,CAAC,GAAG,IAAI,eAAe,EAAE,CAAC;aACnE;YAED,OAAO,QAAQ,IAAK,MAAc,CAAC,yB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KAAK,SAAS,CAAkB,CAAC;QAClG,CAAC;KACD;IA3LD,0CA2LC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A method decorator that marks the associated function as a 'Before Scenario' step. The function is
|
|
3
|
+
* executed before each scenario.
|
|
4
|
+
*
|
|
5
|
+
* @param tag An optional tag.
|
|
6
|
+
*/
|
|
7
|
+
export declare function before(tag?: string, timeout?: number): MethodDecorator;
|
|
8
|
+
/**
|
|
9
|
+
* A method decorator that marks the associated function as a 'Before All Scenario' step. The function is
|
|
10
|
+
* executed before all scenarios are executed.
|
|
11
|
+
*
|
|
12
|
+
* @param tag An optional tag.
|
|
13
|
+
*/
|
|
14
|
+
export declare function beforeAll(tag?: string, timeout?: number): MethodDecorator;
|
|
15
|
+
/**
|
|
16
|
+
* A method decorator that marks the associated function as an 'After Scenario' step. The function is
|
|
17
|
+
* executed after each scenario.
|
|
18
|
+
*
|
|
19
|
+
* @param tag An optional tag.
|
|
20
|
+
*/
|
|
21
|
+
export declare function after(tag?: string, timeout?: number): MethodDecorator;
|
|
22
|
+
/**
|
|
23
|
+
* A method decorator that marks the associated function as an 'After All Scenario' step. The function is
|
|
24
|
+
* executed after all scenarios are executed.
|
|
25
|
+
*
|
|
26
|
+
* @param tag An optional tag.
|
|
27
|
+
*/
|
|
28
|
+
export declare function afterAll(tag?: string, timeout?: number): MethodDecorator;
|
|
29
|
+
//# sourceMappingURL=hook-decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-decorators.d.ts","sourceRoot":"","sources":["../src/hook-decorators.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CAGtE;AACD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CAGzE;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CAGrE;AACD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CAGxE"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "./binding-registry", "./our-callsite", "./step-binding"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.afterAll = exports.after = exports.beforeAll = exports.before = void 0;
|
|
13
|
+
const binding_registry_1 = require("./binding-registry");
|
|
14
|
+
const our_callsite_1 = require("./our-callsite");
|
|
15
|
+
const step_binding_1 = require("./step-binding");
|
|
16
|
+
/**
|
|
17
|
+
* A method decorator that marks the associated function as a 'Before Scenario' step. The function is
|
|
18
|
+
* executed before each scenario.
|
|
19
|
+
*
|
|
20
|
+
* @param tag An optional tag.
|
|
21
|
+
*/
|
|
22
|
+
function before(tag, timeout) {
|
|
23
|
+
const callSite = our_callsite_1.Callsite.capture();
|
|
24
|
+
return createDecoratorFactory(step_binding_1.StepBindingFlags.before, callSite, tag, timeout);
|
|
25
|
+
}
|
|
26
|
+
exports.before = before;
|
|
27
|
+
/**
|
|
28
|
+
* A method decorator that marks the associated function as a 'Before All Scenario' step. The function is
|
|
29
|
+
* executed before all scenarios are executed.
|
|
30
|
+
*
|
|
31
|
+
* @param tag An optional tag.
|
|
32
|
+
*/
|
|
33
|
+
function beforeAll(tag, timeout) {
|
|
34
|
+
const callSite = our_callsite_1.Callsite.capture();
|
|
35
|
+
return createDecoratorFactory(step_binding_1.StepBindingFlags.beforeAll, callSite, tag, timeout);
|
|
36
|
+
}
|
|
37
|
+
exports.beforeAll = beforeAll;
|
|
38
|
+
/**
|
|
39
|
+
* A method decorator that marks the associated function as an 'After Scenario' step. The function is
|
|
40
|
+
* executed after each scenario.
|
|
41
|
+
*
|
|
42
|
+
* @param tag An optional tag.
|
|
43
|
+
*/
|
|
44
|
+
function after(tag, timeout) {
|
|
45
|
+
const callSite = our_callsite_1.Callsite.capture();
|
|
46
|
+
return createDecoratorFactory(step_binding_1.StepBindingFlags.after, callSite, tag, timeout);
|
|
47
|
+
}
|
|
48
|
+
exports.after = after;
|
|
49
|
+
/**
|
|
50
|
+
* A method decorator that marks the associated function as an 'After All Scenario' step. The function is
|
|
51
|
+
* executed after all scenarios are executed.
|
|
52
|
+
*
|
|
53
|
+
* @param tag An optional tag.
|
|
54
|
+
*/
|
|
55
|
+
function afterAll(tag, timeout) {
|
|
56
|
+
const callSite = our_callsite_1.Callsite.capture();
|
|
57
|
+
return createDecoratorFactory(step_binding_1.StepBindingFlags.afterAll, callSite, tag, timeout);
|
|
58
|
+
}
|
|
59
|
+
exports.afterAll = afterAll;
|
|
60
|
+
function checkTag(tag) {
|
|
61
|
+
return tag;
|
|
62
|
+
}
|
|
63
|
+
function createDecoratorFactory(flag, callSite, tag, timeout) {
|
|
64
|
+
return (target, propertyKey, descriptor) => {
|
|
65
|
+
const stepBinding = {
|
|
66
|
+
stepPattern: '',
|
|
67
|
+
bindingType: flag,
|
|
68
|
+
targetPrototype: target,
|
|
69
|
+
targetPropertyKey: propertyKey,
|
|
70
|
+
argsLength: target[propertyKey].length,
|
|
71
|
+
timeout: timeout,
|
|
72
|
+
callsite: callSite
|
|
73
|
+
};
|
|
74
|
+
if (tag) {
|
|
75
|
+
stepBinding.tag = checkTag(tag);
|
|
76
|
+
}
|
|
77
|
+
binding_registry_1.BindingRegistry.instance.registerStepBinding(stepBinding);
|
|
78
|
+
return descriptor;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=hook-decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-decorators.js","sourceRoot":"","sources":["../src/hook-decorators.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,yDAAqD;IACrD,iDAA0C;IAC1C,iDAA+D;IAE/D;;;;;OAKG;IACH,SAAgB,MAAM,CAAC,GAAY,EAAE,OAAgB;QACpD,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,sBAAsB,CAAC,+BAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;IAHD,wBAGC;IACD;;;;;OAKG;IACH,SAAgB,SAAS,CAAC,GAAY,EAAE,OAAgB;QACvD,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,sBAAsB,CAAC,+BAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACnF,CAAC;IAHD,8BAGC;IAED;;;;;OAKG;IACH,SAAgB,KAAK,CAAC,GAAY,EAAE,OAAgB;QACnD,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,sBAAsB,CAAC,+BAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAHD,sBAGC;IACD;;;;;OAKG;IACH,SAAgB,QAAQ,CAAC,GAAY,EAAE,OAAgB;QACtD,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,sBAAsB,CAAC,+BAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;IAHD,4BAGC;IAED,SAAS,QAAQ,CAAC,GAAW;QAC5B,OAAO,GAAG,CAAC;IACZ,CAAC;IAED,SAAS,sBAAsB,CAAC,IAAsB,EAAE,QAAkB,EAAE,GAAY,EAAE,OAAgB;QACzG,OAAO,CAAI,MAAW,EAAE,WAA4B,EAAE,UAAsC,EAAE,EAAE;YAC/F,MAAM,WAAW,GAAgB;gBAChC,WAAW,EAAE,EAAE;gBACf,WAAW,EAAE,IAAI;gBACjB,eAAe,EAAE,MAAM;gBACvB,iBAAiB,EAAE,WAAW;gBAC9B,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM;gBACtC,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,QAAQ;aAClB,CAAC;YAEF,IAAI,GAAG,EAAE;gBACR,WAAW,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;aAChC;YAED,kCAAe,CAAC,QAAQ,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;YAE1D,OAAO,UAAU,CAAC;QACnB,CAAC,CAAC;IACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './binding-decorator';
|
|
2
|
+
export * from './hook-decorators';
|
|
3
|
+
export * from './step-definition-decorators';
|
|
4
|
+
export * from './behave-json-formatter';
|
|
5
|
+
export { ScenarioContext, ScenarioInfo } from './scenario-context';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
+
if (k2 === undefined) k2 = k;
|
|
3
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
4
|
+
}) : (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
o[k2] = m[k];
|
|
7
|
+
}));
|
|
8
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
9
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
10
|
+
};
|
|
11
|
+
(function (factory) {
|
|
12
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
13
|
+
var v = factory(require, exports);
|
|
14
|
+
if (v !== undefined) module.exports = v;
|
|
15
|
+
}
|
|
16
|
+
else if (typeof define === "function" && define.amd) {
|
|
17
|
+
define(["require", "exports", "./binding-decorator", "./hook-decorators", "./step-definition-decorators", "./behave-json-formatter", "./scenario-context"], factory);
|
|
18
|
+
}
|
|
19
|
+
})(function (require, exports) {
|
|
20
|
+
"use strict";
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.ScenarioInfo = void 0;
|
|
23
|
+
__exportStar(require("./binding-decorator"), exports);
|
|
24
|
+
__exportStar(require("./hook-decorators"), exports);
|
|
25
|
+
__exportStar(require("./step-definition-decorators"), exports);
|
|
26
|
+
__exportStar(require("./behave-json-formatter"), exports);
|
|
27
|
+
var scenario_context_1 = require("./scenario-context");
|
|
28
|
+
Object.defineProperty(exports, "ScenarioInfo", { enumerable: true, get: function () { return scenario_context_1.ScenarioInfo; } });
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAAA,sDAAoC;IACpC,oDAAkC;IAClC,+DAA6C;IAC7C,0DAAwC;IACxC,uDAAmE;IAAzC,gHAAA,YAAY,OAAA"}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,QAAA,MAAM,MAAM,eAAyC,CAAC;AAItD,eAAe,MAAM,CAAC"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "log4js"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const log4js = require("log4js");
|
|
13
|
+
const logger = log4js.getLogger('cucumber-js.tsflow');
|
|
14
|
+
logger.level = 'debug'; // default level is OFF - which means no logs at all.
|
|
15
|
+
exports.default = logger;
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,iCAAiC;IACjC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;IAEtD,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,qDAAqD;IAE7E,kBAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ScenarioContext, ScenarioInfo } from './scenario-context';
|
|
2
|
+
import { ContextType } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a [[ScenarioContext]] implementation that manages a collection of context objects that
|
|
5
|
+
* are created and used by binding classes during a running Cucumber scenario.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ManagedScenarioContext implements ScenarioContext {
|
|
8
|
+
private _scenarioInfo;
|
|
9
|
+
private _activeObjects;
|
|
10
|
+
constructor(scenarioTitle: string, tags: string[]);
|
|
11
|
+
/**
|
|
12
|
+
* Gets information about the scenario.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
get scenarioInfo(): ScenarioInfo;
|
|
16
|
+
getOrActivateBindingClass(targetPrototype: any, contextTypes: ContextType[]): any;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
private activateBindingClass;
|
|
19
|
+
private getOrActivateObject;
|
|
20
|
+
}
|
|
21
|
+
export * from './scenario-context';
|
|
22
|
+
//# sourceMappingURL=managed-scenario-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-scenario-context.d.ts","sourceRoot":"","sources":["../src/managed-scenario-context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAC7D,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,cAAc,CAAuB;gBAEjC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAIjD;;;OAGG;IACH,IAAW,YAAY,IAAI,YAAY,CAEtC;IAEM,yBAAyB,CAAC,eAAe,EAAE,GAAG,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,GAAG;IAMjF,OAAO,IAAI,IAAI;IAQtB,OAAO,CAAC,oBAAoB;IA2E5B,OAAO,CAAC,mBAAmB;CAa3B;AAED,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
+
if (k2 === undefined) k2 = k;
|
|
3
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
4
|
+
}) : (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
o[k2] = m[k];
|
|
7
|
+
}));
|
|
8
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
9
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
10
|
+
};
|
|
11
|
+
(function (factory) {
|
|
12
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
13
|
+
var v = factory(require, exports);
|
|
14
|
+
if (v !== undefined) module.exports = v;
|
|
15
|
+
}
|
|
16
|
+
else if (typeof define === "function" && define.amd) {
|
|
17
|
+
define(["require", "exports", "underscore", "./scenario-context", "./scenario-context"], factory);
|
|
18
|
+
}
|
|
19
|
+
})(function (require, exports) {
|
|
20
|
+
"use strict";
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.ManagedScenarioContext = void 0;
|
|
23
|
+
const _ = require("underscore");
|
|
24
|
+
const scenario_context_1 = require("./scenario-context");
|
|
25
|
+
/**
|
|
26
|
+
* Represents a [[ScenarioContext]] implementation that manages a collection of context objects that
|
|
27
|
+
* are created and used by binding classes during a running Cucumber scenario.
|
|
28
|
+
*/
|
|
29
|
+
class ManagedScenarioContext {
|
|
30
|
+
constructor(scenarioTitle, tags) {
|
|
31
|
+
this._activeObjects = new Map();
|
|
32
|
+
this._scenarioInfo = new scenario_context_1.ScenarioInfo(scenarioTitle, tags);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Gets information about the scenario.
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
get scenarioInfo() {
|
|
39
|
+
return this._scenarioInfo;
|
|
40
|
+
}
|
|
41
|
+
getOrActivateBindingClass(targetPrototype, contextTypes) {
|
|
42
|
+
return this.getOrActivateObject(targetPrototype, () => {
|
|
43
|
+
return this.activateBindingClass(targetPrototype, contextTypes);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
dispose() {
|
|
47
|
+
this._activeObjects.forEach((value) => {
|
|
48
|
+
if (typeof value.dispose === 'function') {
|
|
49
|
+
value.dispose();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
activateBindingClass(targetPrototype, contextTypes) {
|
|
54
|
+
const invokeBindingConstructor = (args) => {
|
|
55
|
+
switch (contextTypes.length) {
|
|
56
|
+
case 0:
|
|
57
|
+
return new targetPrototype.constructor();
|
|
58
|
+
case 1:
|
|
59
|
+
return new targetPrototype.constructor(args[0]);
|
|
60
|
+
case 2:
|
|
61
|
+
return new targetPrototype.constructor(args[0], args[1]);
|
|
62
|
+
case 3:
|
|
63
|
+
return new targetPrototype.constructor(args[0], args[1], args[2]);
|
|
64
|
+
case 4:
|
|
65
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3]);
|
|
66
|
+
case 5:
|
|
67
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4]);
|
|
68
|
+
case 6:
|
|
69
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5]);
|
|
70
|
+
case 7:
|
|
71
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
|
72
|
+
case 8:
|
|
73
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
|
74
|
+
case 9:
|
|
75
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
|
|
76
|
+
case 10:
|
|
77
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const contextObjects = _.map(contextTypes, contextType => this.getOrActivateObject(contextType.prototype, () => {
|
|
81
|
+
return new contextType();
|
|
82
|
+
}));
|
|
83
|
+
return invokeBindingConstructor(contextObjects);
|
|
84
|
+
}
|
|
85
|
+
getOrActivateObject(targetPrototype, activatorFunc) {
|
|
86
|
+
let activeObject = this._activeObjects.get(targetPrototype);
|
|
87
|
+
if (activeObject) {
|
|
88
|
+
return activeObject;
|
|
89
|
+
}
|
|
90
|
+
activeObject = activatorFunc();
|
|
91
|
+
this._activeObjects.set(targetPrototype, activeObject);
|
|
92
|
+
return activeObject;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.ManagedScenarioContext = ManagedScenarioContext;
|
|
96
|
+
__exportStar(require("./scenario-context"), exports);
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=managed-scenario-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-scenario-context.js","sourceRoot":"","sources":["../src/managed-scenario-context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAAA,gCAAgC;IAEhC,yDAAmE;IAGnE;;;OAGG;IACH,MAAa,sBAAsB;QAIlC,YAAY,aAAqB,EAAE,IAAc;YAFzC,mBAAc,GAAG,IAAI,GAAG,EAAY,CAAC;YAG5C,IAAI,CAAC,aAAa,GAAG,IAAI,+BAAY,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAC5D,CAAC;QAED;;;WAGG;QACH,IAAW,YAAY;YACtB,OAAO,IAAI,CAAC,aAAa,CAAC;QAC3B,CAAC;QAEM,yBAAyB,CAAC,eAAoB,EAAE,YAA2B;YACjF,OAAO,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE,GAAG,EAAE;gBACrD,OAAO,IAAI,CAAC,oBAAoB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;QACJ,CAAC;QAEM,OAAO;YACb,IAAI,CAAC,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CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,EACP,IAAI,CAAC,CAAC,CAAC,CACP,CAAC;iBACH;YACF,CAAC,CAAC;YAEF,MAAM,cAAc,GAAG,CAAC,CAAC,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,EAAE,CACxD,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE;gBACpD,OAAO,IAAI,WAAW,EAAE,CAAC;YAC1B,CAAC,CAAC,CACF,CAAC;YAEF,OAAO,wBAAwB,CAAC,cAAc,CAAC,CAAC;QACjD,CAAC;QAEO,mBAAmB,CAAC,eAAoB,EAAE,aAAsC;YACvF,IAAI,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;YAE5D,IAAI,YAAY,EAAE;gBACjB,OAAO,YAAY,CAAC;aACpB;YAED,YAAY,GAAG,aAAa,EAAE,CAAC;YAE/B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;YAEvD,OAAO,YAAY,CAAC;QACrB,CAAC;KACD;IAtHD,wDAsHC;IAED,qDAAmC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a callsite of where a step binding is being applied.
|
|
3
|
+
*/
|
|
4
|
+
export declare class Callsite {
|
|
5
|
+
filename: string;
|
|
6
|
+
lineNumber: number;
|
|
7
|
+
/**
|
|
8
|
+
* Initializes a new [[Callsite]].
|
|
9
|
+
*
|
|
10
|
+
* @param filename The filename of the callsite.
|
|
11
|
+
* @param lineNumber The line number of the callsite.
|
|
12
|
+
*/
|
|
13
|
+
constructor(filename: string, lineNumber: number);
|
|
14
|
+
/**
|
|
15
|
+
* Returns a string representation of the callsite.
|
|
16
|
+
*
|
|
17
|
+
* @returns A string representing the callsite formatted with the filename and line
|
|
18
|
+
* number.
|
|
19
|
+
*/
|
|
20
|
+
toString(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Captures the current [[Callsite]] object.
|
|
23
|
+
*/
|
|
24
|
+
static capture(): Callsite;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=our-callsite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"our-callsite.d.ts","sourceRoot":"","sources":["../src/our-callsite.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,QAAQ;IAOD,QAAQ,EAAE,MAAM;IAAS,UAAU,EAAE,MAAM;IAN9D;;;;;OAKG;gBACgB,QAAQ,EAAE,MAAM,EAAS,UAAU,EAAE,MAAM;IAE9D;;;;;OAKG;IACI,QAAQ,IAAI,MAAM;IAIzB;;OAEG;WACW,OAAO,IAAI,QAAQ;CAKjC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "callsites", "source-map-support"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Callsite = void 0;
|
|
13
|
+
const callsites = require("callsites");
|
|
14
|
+
const sourceMapSupport = require("source-map-support");
|
|
15
|
+
/**
|
|
16
|
+
* Represents a callsite of where a step binding is being applied.
|
|
17
|
+
*/
|
|
18
|
+
class Callsite {
|
|
19
|
+
/**
|
|
20
|
+
* Initializes a new [[Callsite]].
|
|
21
|
+
*
|
|
22
|
+
* @param filename The filename of the callsite.
|
|
23
|
+
* @param lineNumber The line number of the callsite.
|
|
24
|
+
*/
|
|
25
|
+
constructor(filename, lineNumber) {
|
|
26
|
+
this.filename = filename;
|
|
27
|
+
this.lineNumber = lineNumber;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Returns a string representation of the callsite.
|
|
31
|
+
*
|
|
32
|
+
* @returns A string representing the callsite formatted with the filename and line
|
|
33
|
+
* number.
|
|
34
|
+
*/
|
|
35
|
+
toString() {
|
|
36
|
+
return `${this.filename}:${this.lineNumber}`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Captures the current [[Callsite]] object.
|
|
40
|
+
*/
|
|
41
|
+
static capture() {
|
|
42
|
+
const stack = callsites()[2];
|
|
43
|
+
const tsStack = sourceMapSupport.wrapCallSite(stack);
|
|
44
|
+
return new Callsite(tsStack.getFileName() || '', tsStack.getLineNumber() || -1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.Callsite = Callsite;
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=our-callsite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"our-callsite.js","sourceRoot":"","sources":["../src/our-callsite.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,uCAAuC;IACvC,uDAAuD;IAEvD;;OAEG;IACH,MAAa,QAAQ;QACpB;;;;;WAKG;QACH,YAAmB,QAAgB,EAAS,UAAkB;YAA3C,aAAQ,GAAR,QAAQ,CAAQ;YAAS,eAAU,GAAV,UAAU,CAAQ;QAAG,CAAC;QAElE;;;;;WAKG;QACI,QAAQ;YACd,OAAO,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QAC9C,CAAC;QAED;;WAEG;QACI,MAAM,CAAC,OAAO;YACpB,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7B,MAAM,OAAO,GAAG,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACrD,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACjF,CAAC;KACD;IA3BD,4BA2BC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ScenarioInfo } from './scenario-info';
|
|
2
|
+
/**
|
|
3
|
+
* Provides context for the currently running Cucumber scenario.
|
|
4
|
+
*/
|
|
5
|
+
export interface ScenarioContext {
|
|
6
|
+
/**
|
|
7
|
+
* Gets information about the scenario.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
scenarioInfo: ScenarioInfo;
|
|
11
|
+
/**
|
|
12
|
+
* Gets or sets an arbitary object within the running scenario.
|
|
13
|
+
*/
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export * from './scenario-info';
|
|
17
|
+
//# sourceMappingURL=scenario-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-context.d.ts","sourceRoot":"","sources":["../src/scenario-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;;OAGG;IACH,YAAY,EAAE,YAAY,CAAC;IAE3B;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACnB;AAED,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
+
if (k2 === undefined) k2 = k;
|
|
3
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
4
|
+
}) : (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
o[k2] = m[k];
|
|
7
|
+
}));
|
|
8
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
9
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
10
|
+
};
|
|
11
|
+
(function (factory) {
|
|
12
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
13
|
+
var v = factory(require, exports);
|
|
14
|
+
if (v !== undefined) module.exports = v;
|
|
15
|
+
}
|
|
16
|
+
else if (typeof define === "function" && define.amd) {
|
|
17
|
+
define(["require", "exports", "./scenario-info"], factory);
|
|
18
|
+
}
|
|
19
|
+
})(function (require, exports) {
|
|
20
|
+
"use strict";
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
__exportStar(require("./scenario-info"), exports);
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=scenario-context.js.map
|