@lynxwall/cucumber-tsflow 6.1.0 → 6.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.
- package/README.md +62 -21
- package/lib/behave.d.ts +1 -1
- package/lib/behave.js +27 -27
- package/lib/cli/argv-parser.d.ts +24 -24
- package/lib/cli/argv-parser.js +103 -103
- package/lib/cli/index.d.ts +21 -22
- package/lib/cli/index.js +95 -101
- package/lib/cli/load-configuration.d.ts +20 -20
- package/lib/cli/load-configuration.js +101 -93
- package/lib/cli/run.d.ts +1 -1
- package/lib/cli/run.js +49 -47
- package/lib/cucumber/binding-decorator.d.ts +10 -10
- package/lib/cucumber/binding-decorator.js +180 -180
- package/lib/cucumber/binding-registry.d.ts +82 -82
- package/lib/cucumber/binding-registry.js +215 -215
- package/lib/cucumber/hook-decorators.d.ts +46 -46
- package/lib/cucumber/hook-decorators.js +102 -102
- package/lib/cucumber/managed-scenario-context.d.ts +21 -21
- package/lib/cucumber/managed-scenario-context.js +95 -95
- package/lib/cucumber/message-collector.d.ts +81 -81
- package/lib/cucumber/message-collector.js +250 -250
- package/lib/cucumber/parallel/coordinator.d.ts +79 -79
- package/lib/cucumber/parallel/coordinator.js +246 -246
- package/lib/cucumber/parallel/run-worker.d.ts +1 -1
- package/lib/cucumber/parallel/run-worker.js +31 -31
- package/lib/cucumber/parallel/worker.d.ts +30 -30
- package/lib/cucumber/parallel/worker.js +103 -103
- package/lib/cucumber/run-cucumber.d.ts +14 -14
- package/lib/cucumber/run-cucumber.js +118 -118
- package/lib/cucumber/runtime.d.ts +25 -25
- package/lib/cucumber/runtime.js +39 -39
- package/lib/cucumber/step-definition-decorators.d.ts +24 -24
- package/lib/cucumber/step-definition-decorators.js +91 -91
- package/lib/cucumber/utils.d.ts +16 -16
- package/lib/cucumber/utils.js +77 -77
- package/lib/esnode.js +18 -18
- package/lib/esvue.d.ts +1 -1
- package/lib/esvue.js +40 -40
- package/lib/formatters/behave-json-formatter.d.ts +49 -49
- package/lib/formatters/behave-json-formatter.js +74 -74
- package/lib/formatters/tsflow-snippet-syntax.d.ts +9 -9
- package/lib/formatters/tsflow-snippet-syntax.js +89 -89
- package/lib/gherkin/configuration.d.ts +30 -30
- package/lib/gherkin/configuration.js +26 -26
- package/lib/gherkin/gherkin-feature.d.ts +28 -28
- package/lib/gherkin/gherkin-feature.js +353 -333
- package/lib/gherkin/gherkin-manager.d.ts +29 -29
- package/lib/gherkin/gherkin-manager.js +143 -139
- package/lib/gherkin/models.d.ts +46 -45
- package/lib/gherkin/models.js +2 -2
- package/lib/index.d.ts +4 -4
- package/lib/index.js +22 -22
- package/lib/snippet.d.ts +1 -1
- package/lib/snippet.js +27 -27
- package/lib/transpilers/esbuild-transpiler.d.ts +4 -4
- package/lib/transpilers/esbuild-transpiler.js +18 -18
- package/lib/transpilers/esbuild.d.ts +12 -12
- package/lib/transpilers/esbuild.js +54 -54
- package/lib/transpilers/vue-sfc/compiler.d.ts +7 -7
- package/lib/transpilers/vue-sfc/compiler.js +21 -21
- package/lib/transpilers/vue-sfc/index.d.ts +23 -23
- package/lib/transpilers/vue-sfc/index.js +46 -46
- package/lib/transpilers/vue-sfc/main.d.ts +8 -8
- package/lib/transpilers/vue-sfc/main.js +247 -247
- package/lib/transpilers/vue-sfc/script.d.ts +5 -5
- package/lib/transpilers/vue-sfc/script.js +41 -41
- package/lib/transpilers/vue-sfc/template.d.ts +8 -8
- package/lib/transpilers/vue-sfc/template.js +101 -101
- package/lib/transpilers/vue-sfc/types.d.ts +55 -55
- package/lib/transpilers/vue-sfc/types.js +2 -2
- package/lib/transpilers/vue-sfc/utils/descriptorCache.d.ts +13 -13
- package/lib/transpilers/vue-sfc/utils/descriptorCache.js +67 -67
- package/lib/transpilers/vue-sfc/utils/error.d.ts +3 -3
- package/lib/transpilers/vue-sfc/utils/error.js +22 -22
- package/lib/transpilers/vue-sfc/utils/query.d.ts +13 -13
- package/lib/transpilers/vue-sfc/utils/query.js +35 -35
- package/lib/tsnode.js +17 -17
- package/lib/tsvue.d.ts +1 -1
- package/lib/tsvue.js +39 -39
- package/lib/types/scenario-context.d.ts +16 -16
- package/lib/types/scenario-context.js +17 -17
- package/lib/types/scenario-info.d.ts +16 -16
- package/lib/types/scenario-info.js +22 -22
- package/lib/types/step-binding-flags.d.ts +53 -53
- package/lib/types/step-binding-flags.js +59 -59
- package/lib/types/step-binding.d.ts +50 -50
- package/lib/types/step-binding.js +17 -17
- package/lib/types/types.d.ts +21 -21
- package/lib/types/types.js +2 -2
- package/lib/utils/helpers.d.ts +6 -6
- package/lib/utils/helpers.js +17 -17
- package/lib/utils/logger.d.ts +3 -3
- package/lib/utils/logger.js +29 -29
- package/lib/utils/our-callsite.d.ts +27 -27
- package/lib/utils/our-callsite.js +72 -72
- package/lib/version.d.ts +1 -1
- package/lib/version.js +5 -5
- package/package.json +16 -16
|
@@ -1,181 +1,181 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.binding = void 0;
|
|
7
|
-
/* eslint-disable prefer-rest-params */
|
|
8
|
-
const cucumber_1 = require("@cucumber/cucumber");
|
|
9
|
-
const binding_registry_1 = require("./binding-registry");
|
|
10
|
-
const step_binding_1 = require("../types/step-binding");
|
|
11
|
-
const cucumber_2 = require("@cucumber/cucumber");
|
|
12
|
-
const underscore_1 = __importDefault(require("underscore"));
|
|
13
|
-
/**
|
|
14
|
-
* A set of step patterns that have been registered with Cucumber.
|
|
15
|
-
*
|
|
16
|
-
* In order to support scoped (or tagged) step definitions, we must ensure that any step binding is
|
|
17
|
-
* only registered with Cucumber once. The binding function for that step pattern then becomes
|
|
18
|
-
* responsible for looking up and execuing the step binding based on the context that is in scope at
|
|
19
|
-
* the point of invocation.
|
|
20
|
-
*/
|
|
21
|
-
const stepPatternRegistrations = new Map();
|
|
22
|
-
/**
|
|
23
|
-
* A class decorator that marks the associated class as a CucumberJS binding.
|
|
24
|
-
*
|
|
25
|
-
* @param requiredContextTypes An optional array of Types that will be created and passed into the created
|
|
26
|
-
* object for each scenario.
|
|
27
|
-
*
|
|
28
|
-
* An instance of the decorated class will be created for each scenario.
|
|
29
|
-
*/
|
|
30
|
-
function binding(requiredContextTypes) {
|
|
31
|
-
return (target) => {
|
|
32
|
-
defineParameters();
|
|
33
|
-
const bindingRegistry = binding_registry_1.BindingRegistry.instance;
|
|
34
|
-
bindingRegistry.registerContextTypesForTarget(target.prototype, requiredContextTypes);
|
|
35
|
-
const allBindings = [];
|
|
36
|
-
allBindings.push(...bindingRegistry.getStepBindingsForTarget(target));
|
|
37
|
-
allBindings.push(...bindingRegistry.getStepBindingsForTarget(target.prototype));
|
|
38
|
-
allBindings.forEach(stepBinding => {
|
|
39
|
-
if (stepBinding.bindingType & step_binding_1.StepBindingFlags.StepDefinitions) {
|
|
40
|
-
let stepBindingFlags = stepPatternRegistrations.get(stepBinding.stepPattern.toString());
|
|
41
|
-
if (stepBindingFlags === undefined) {
|
|
42
|
-
stepBindingFlags = step_binding_1.StepBindingFlags.none;
|
|
43
|
-
}
|
|
44
|
-
if (stepBindingFlags & stepBinding.bindingType) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
bindStepDefinition(stepBinding);
|
|
48
|
-
stepPatternRegistrations.set(stepBinding.stepPattern.toString(), stepBindingFlags | stepBinding.bindingType);
|
|
49
|
-
}
|
|
50
|
-
else if (stepBinding.bindingType & step_binding_1.StepBindingFlags.Hooks) {
|
|
51
|
-
bindHook(stepBinding);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
exports.binding = binding;
|
|
57
|
-
/**
|
|
58
|
-
* Called only once to register new parameters. This has to be
|
|
59
|
-
* executed here during binding initialization for cucumber to
|
|
60
|
-
* to use it when matching expressions. Attempting to add it
|
|
61
|
-
* before the test run doesn't work
|
|
62
|
-
*/
|
|
63
|
-
const defineParameters = underscore_1.default.once(() => {
|
|
64
|
-
(0, cucumber_2.defineParameterType)({
|
|
65
|
-
name: 'boolean',
|
|
66
|
-
regexp: /true|false/,
|
|
67
|
-
transformer: s => (s === 'true' ? true : false)
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
/**
|
|
71
|
-
* Binds a step definition to Cucumber.
|
|
72
|
-
*
|
|
73
|
-
* @param stepBinding The [[StepBinding]] that represents a 'given', 'when', or 'then' step definition.
|
|
74
|
-
*/
|
|
75
|
-
function bindStepDefinition(stepBinding) {
|
|
76
|
-
const bindingFunc = function () {
|
|
77
|
-
const bindingRegistry = binding_registry_1.BindingRegistry.instance;
|
|
78
|
-
const scenarioContext = global.messageCollector.getStepScenarioContext(stepBinding);
|
|
79
|
-
if (scenarioContext) {
|
|
80
|
-
const matchingStepBindings = bindingRegistry.getStepBindings(stepBinding.stepPattern.toString(), scenarioContext.scenarioInfo.tags);
|
|
81
|
-
if (matchingStepBindings.length > 1) {
|
|
82
|
-
let message = `Ambiguous step definitions for '${matchingStepBindings[0].stepPattern}':\n`;
|
|
83
|
-
matchingStepBindings.forEach(matchingStepBinding => {
|
|
84
|
-
message =
|
|
85
|
-
message +
|
|
86
|
-
`\t\t${String(matchingStepBinding.targetPropertyKey)} (${matchingStepBinding.callsite.toString()})\n`;
|
|
87
|
-
});
|
|
88
|
-
throw new Error(message);
|
|
89
|
-
}
|
|
90
|
-
else if (matchingStepBindings.length === 0) {
|
|
91
|
-
throw new Error(`Cannot find matched step definition for ${stepBinding.stepPattern.toString()} with tag ${scenarioContext.scenarioInfo.tags} in binding registry`);
|
|
92
|
-
}
|
|
93
|
-
const contextTypes = bindingRegistry.getContextTypesForTarget(matchingStepBindings[0].targetPrototype);
|
|
94
|
-
const bindingObject = scenarioContext.getOrActivateBindingClass(matchingStepBindings[0].targetPrototype, contextTypes);
|
|
95
|
-
bindingObject._worldObj = this;
|
|
96
|
-
return bindingObject[matchingStepBindings[0].targetPropertyKey].apply(bindingObject, arguments);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
throw new Error('Unable to find the Scenario Context for a Step!');
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
Object.defineProperty(bindingFunc, 'length', {
|
|
103
|
-
value: stepBinding.argsLength
|
|
104
|
-
});
|
|
105
|
-
// initialize options used on all step bindings
|
|
106
|
-
const options = {
|
|
107
|
-
cucumberKey: stepBinding.cucumberKey,
|
|
108
|
-
timeout: stepBinding.timeout,
|
|
109
|
-
wrapperOptions: stepBinding.wrapperOption
|
|
110
|
-
};
|
|
111
|
-
// call appropriate step
|
|
112
|
-
if (stepBinding.bindingType & step_binding_1.StepBindingFlags.given) {
|
|
113
|
-
(0, cucumber_1.Given)(stepBinding.stepPattern, options, bindingFunc);
|
|
114
|
-
}
|
|
115
|
-
else if (stepBinding.bindingType & step_binding_1.StepBindingFlags.when) {
|
|
116
|
-
(0, cucumber_1.When)(stepBinding.stepPattern, options, bindingFunc);
|
|
117
|
-
}
|
|
118
|
-
else if (stepBinding.bindingType & step_binding_1.StepBindingFlags.then) {
|
|
119
|
-
(0, cucumber_1.Then)(stepBinding.stepPattern, options, bindingFunc);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Binds a hook to Cucumber.
|
|
124
|
-
*
|
|
125
|
-
* @param stepBinding The [[StepBinding]] that represents a 'before', or 'after', step definition.
|
|
126
|
-
*/
|
|
127
|
-
function bindHook(stepBinding) {
|
|
128
|
-
const bindingFunc = stepBinding.bindingType == step_binding_1.StepBindingFlags.beforeAll || stepBinding.bindingType == step_binding_1.StepBindingFlags.afterAll
|
|
129
|
-
? function () {
|
|
130
|
-
return stepBinding.targetPrototype[stepBinding.targetPropertyKey].apply();
|
|
131
|
-
}
|
|
132
|
-
: function (arg) {
|
|
133
|
-
const scenarioContext = global.messageCollector.getHookScenarioContext(arg);
|
|
134
|
-
if (scenarioContext) {
|
|
135
|
-
const contextTypes = binding_registry_1.BindingRegistry.instance.getContextTypesForTarget(stepBinding.targetPrototype);
|
|
136
|
-
const bindingObject = scenarioContext.getOrActivateBindingClass(stepBinding.targetPrototype, contextTypes);
|
|
137
|
-
bindingObject._worldObj = this;
|
|
138
|
-
return bindingObject[stepBinding.targetPropertyKey].apply(bindingObject, arguments);
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
throw new Error('Unable to find the Scenario Context for Hook!');
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
Object.defineProperty(bindingFunc, 'length', {
|
|
145
|
-
value: stepBinding.argsLength
|
|
146
|
-
});
|
|
147
|
-
const tags = stepBinding.tags === binding_registry_1.DEFAULT_TAG ? undefined : stepBinding.tags;
|
|
148
|
-
switch (stepBinding.bindingType) {
|
|
149
|
-
case step_binding_1.StepBindingFlags.beforeAll: {
|
|
150
|
-
const options = { cucumberKey: stepBinding.cucumberKey, timeout: stepBinding.timeout };
|
|
151
|
-
(0, cucumber_1.BeforeAll)(options, bindingFunc);
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
case step_binding_1.StepBindingFlags.before: {
|
|
155
|
-
const options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };
|
|
156
|
-
(0, cucumber_1.Before)(options, bindingFunc);
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
case step_binding_1.StepBindingFlags.beforeStep: {
|
|
160
|
-
const options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };
|
|
161
|
-
(0, cucumber_1.BeforeStep)(options, bindingFunc);
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
case step_binding_1.StepBindingFlags.afterAll: {
|
|
165
|
-
const options = { cucumberKey: stepBinding.cucumberKey, timeout: stepBinding.timeout };
|
|
166
|
-
(0, cucumber_1.AfterAll)(options, bindingFunc);
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
case step_binding_1.StepBindingFlags.after: {
|
|
170
|
-
const options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };
|
|
171
|
-
(0, cucumber_1.After)(options, bindingFunc);
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
case step_binding_1.StepBindingFlags.afterStep: {
|
|
175
|
-
const options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };
|
|
176
|
-
(0, cucumber_1.AfterStep)(options, bindingFunc);
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.binding = void 0;
|
|
7
|
+
/* eslint-disable prefer-rest-params */
|
|
8
|
+
const cucumber_1 = require("@cucumber/cucumber");
|
|
9
|
+
const binding_registry_1 = require("./binding-registry");
|
|
10
|
+
const step_binding_1 = require("../types/step-binding");
|
|
11
|
+
const cucumber_2 = require("@cucumber/cucumber");
|
|
12
|
+
const underscore_1 = __importDefault(require("underscore"));
|
|
13
|
+
/**
|
|
14
|
+
* A set of step patterns that have been registered with Cucumber.
|
|
15
|
+
*
|
|
16
|
+
* In order to support scoped (or tagged) step definitions, we must ensure that any step binding is
|
|
17
|
+
* only registered with Cucumber once. The binding function for that step pattern then becomes
|
|
18
|
+
* responsible for looking up and execuing the step binding based on the context that is in scope at
|
|
19
|
+
* the point of invocation.
|
|
20
|
+
*/
|
|
21
|
+
const stepPatternRegistrations = new Map();
|
|
22
|
+
/**
|
|
23
|
+
* A class decorator that marks the associated class as a CucumberJS binding.
|
|
24
|
+
*
|
|
25
|
+
* @param requiredContextTypes An optional array of Types that will be created and passed into the created
|
|
26
|
+
* object for each scenario.
|
|
27
|
+
*
|
|
28
|
+
* An instance of the decorated class will be created for each scenario.
|
|
29
|
+
*/
|
|
30
|
+
function binding(requiredContextTypes) {
|
|
31
|
+
return (target) => {
|
|
32
|
+
defineParameters();
|
|
33
|
+
const bindingRegistry = binding_registry_1.BindingRegistry.instance;
|
|
34
|
+
bindingRegistry.registerContextTypesForTarget(target.prototype, requiredContextTypes);
|
|
35
|
+
const allBindings = [];
|
|
36
|
+
allBindings.push(...bindingRegistry.getStepBindingsForTarget(target));
|
|
37
|
+
allBindings.push(...bindingRegistry.getStepBindingsForTarget(target.prototype));
|
|
38
|
+
allBindings.forEach(stepBinding => {
|
|
39
|
+
if (stepBinding.bindingType & step_binding_1.StepBindingFlags.StepDefinitions) {
|
|
40
|
+
let stepBindingFlags = stepPatternRegistrations.get(stepBinding.stepPattern.toString());
|
|
41
|
+
if (stepBindingFlags === undefined) {
|
|
42
|
+
stepBindingFlags = step_binding_1.StepBindingFlags.none;
|
|
43
|
+
}
|
|
44
|
+
if (stepBindingFlags & stepBinding.bindingType) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
bindStepDefinition(stepBinding);
|
|
48
|
+
stepPatternRegistrations.set(stepBinding.stepPattern.toString(), stepBindingFlags | stepBinding.bindingType);
|
|
49
|
+
}
|
|
50
|
+
else if (stepBinding.bindingType & step_binding_1.StepBindingFlags.Hooks) {
|
|
51
|
+
bindHook(stepBinding);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
exports.binding = binding;
|
|
57
|
+
/**
|
|
58
|
+
* Called only once to register new parameters. This has to be
|
|
59
|
+
* executed here during binding initialization for cucumber to
|
|
60
|
+
* to use it when matching expressions. Attempting to add it
|
|
61
|
+
* before the test run doesn't work
|
|
62
|
+
*/
|
|
63
|
+
const defineParameters = underscore_1.default.once(() => {
|
|
64
|
+
(0, cucumber_2.defineParameterType)({
|
|
65
|
+
name: 'boolean',
|
|
66
|
+
regexp: /true|false/,
|
|
67
|
+
transformer: s => (s === 'true' ? true : false)
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Binds a step definition to Cucumber.
|
|
72
|
+
*
|
|
73
|
+
* @param stepBinding The [[StepBinding]] that represents a 'given', 'when', or 'then' step definition.
|
|
74
|
+
*/
|
|
75
|
+
function bindStepDefinition(stepBinding) {
|
|
76
|
+
const bindingFunc = function () {
|
|
77
|
+
const bindingRegistry = binding_registry_1.BindingRegistry.instance;
|
|
78
|
+
const scenarioContext = global.messageCollector.getStepScenarioContext(stepBinding);
|
|
79
|
+
if (scenarioContext) {
|
|
80
|
+
const matchingStepBindings = bindingRegistry.getStepBindings(stepBinding.stepPattern.toString(), scenarioContext.scenarioInfo.tags);
|
|
81
|
+
if (matchingStepBindings.length > 1) {
|
|
82
|
+
let message = `Ambiguous step definitions for '${matchingStepBindings[0].stepPattern}':\n`;
|
|
83
|
+
matchingStepBindings.forEach(matchingStepBinding => {
|
|
84
|
+
message =
|
|
85
|
+
message +
|
|
86
|
+
`\t\t${String(matchingStepBinding.targetPropertyKey)} (${matchingStepBinding.callsite.toString()})\n`;
|
|
87
|
+
});
|
|
88
|
+
throw new Error(message);
|
|
89
|
+
}
|
|
90
|
+
else if (matchingStepBindings.length === 0) {
|
|
91
|
+
throw new Error(`Cannot find matched step definition for ${stepBinding.stepPattern.toString()} with tag ${scenarioContext.scenarioInfo.tags} in binding registry`);
|
|
92
|
+
}
|
|
93
|
+
const contextTypes = bindingRegistry.getContextTypesForTarget(matchingStepBindings[0].targetPrototype);
|
|
94
|
+
const bindingObject = scenarioContext.getOrActivateBindingClass(matchingStepBindings[0].targetPrototype, contextTypes);
|
|
95
|
+
bindingObject._worldObj = this;
|
|
96
|
+
return bindingObject[matchingStepBindings[0].targetPropertyKey].apply(bindingObject, arguments);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
throw new Error('Unable to find the Scenario Context for a Step!');
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
Object.defineProperty(bindingFunc, 'length', {
|
|
103
|
+
value: stepBinding.argsLength
|
|
104
|
+
});
|
|
105
|
+
// initialize options used on all step bindings
|
|
106
|
+
const options = {
|
|
107
|
+
cucumberKey: stepBinding.cucumberKey,
|
|
108
|
+
timeout: stepBinding.timeout,
|
|
109
|
+
wrapperOptions: stepBinding.wrapperOption
|
|
110
|
+
};
|
|
111
|
+
// call appropriate step
|
|
112
|
+
if (stepBinding.bindingType & step_binding_1.StepBindingFlags.given) {
|
|
113
|
+
(0, cucumber_1.Given)(stepBinding.stepPattern, options, bindingFunc);
|
|
114
|
+
}
|
|
115
|
+
else if (stepBinding.bindingType & step_binding_1.StepBindingFlags.when) {
|
|
116
|
+
(0, cucumber_1.When)(stepBinding.stepPattern, options, bindingFunc);
|
|
117
|
+
}
|
|
118
|
+
else if (stepBinding.bindingType & step_binding_1.StepBindingFlags.then) {
|
|
119
|
+
(0, cucumber_1.Then)(stepBinding.stepPattern, options, bindingFunc);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Binds a hook to Cucumber.
|
|
124
|
+
*
|
|
125
|
+
* @param stepBinding The [[StepBinding]] that represents a 'before', or 'after', step definition.
|
|
126
|
+
*/
|
|
127
|
+
function bindHook(stepBinding) {
|
|
128
|
+
const bindingFunc = stepBinding.bindingType == step_binding_1.StepBindingFlags.beforeAll || stepBinding.bindingType == step_binding_1.StepBindingFlags.afterAll
|
|
129
|
+
? function () {
|
|
130
|
+
return stepBinding.targetPrototype[stepBinding.targetPropertyKey].apply();
|
|
131
|
+
}
|
|
132
|
+
: function (arg) {
|
|
133
|
+
const scenarioContext = global.messageCollector.getHookScenarioContext(arg);
|
|
134
|
+
if (scenarioContext) {
|
|
135
|
+
const contextTypes = binding_registry_1.BindingRegistry.instance.getContextTypesForTarget(stepBinding.targetPrototype);
|
|
136
|
+
const bindingObject = scenarioContext.getOrActivateBindingClass(stepBinding.targetPrototype, contextTypes);
|
|
137
|
+
bindingObject._worldObj = this;
|
|
138
|
+
return bindingObject[stepBinding.targetPropertyKey].apply(bindingObject, arguments);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
throw new Error('Unable to find the Scenario Context for Hook!');
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
Object.defineProperty(bindingFunc, 'length', {
|
|
145
|
+
value: stepBinding.argsLength
|
|
146
|
+
});
|
|
147
|
+
const tags = stepBinding.tags === binding_registry_1.DEFAULT_TAG ? undefined : stepBinding.tags;
|
|
148
|
+
switch (stepBinding.bindingType) {
|
|
149
|
+
case step_binding_1.StepBindingFlags.beforeAll: {
|
|
150
|
+
const options = { cucumberKey: stepBinding.cucumberKey, timeout: stepBinding.timeout };
|
|
151
|
+
(0, cucumber_1.BeforeAll)(options, bindingFunc);
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
case step_binding_1.StepBindingFlags.before: {
|
|
155
|
+
const options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };
|
|
156
|
+
(0, cucumber_1.Before)(options, bindingFunc);
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
case step_binding_1.StepBindingFlags.beforeStep: {
|
|
160
|
+
const options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };
|
|
161
|
+
(0, cucumber_1.BeforeStep)(options, bindingFunc);
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
case step_binding_1.StepBindingFlags.afterAll: {
|
|
165
|
+
const options = { cucumberKey: stepBinding.cucumberKey, timeout: stepBinding.timeout };
|
|
166
|
+
(0, cucumber_1.AfterAll)(options, bindingFunc);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case step_binding_1.StepBindingFlags.after: {
|
|
170
|
+
const options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };
|
|
171
|
+
(0, cucumber_1.After)(options, bindingFunc);
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
case step_binding_1.StepBindingFlags.afterStep: {
|
|
175
|
+
const options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };
|
|
176
|
+
(0, cucumber_1.AfterStep)(options, bindingFunc);
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
181
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmluZGluZy1kZWNvcmF0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY3VjdW1iZXIvYmluZGluZy1kZWNvcmF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsdUNBQXVDO0FBQ3ZDLGlEQVc0QjtBQUU1Qix5REFBa0U7QUFDbEUsd0RBQXNFO0FBRXRFLGlEQUF5RDtBQUN6RCw0REFBMkI7QUFLM0I7Ozs7Ozs7R0FPRztBQUNILE1BQU0sd0JBQXdCLEdBQUcsSUFBSSxHQUFHLEVBQWlDLENBQUM7QUFFMUU7Ozs7Ozs7R0FPRztBQUNILFNBQWdCLE9BQU8sQ0FBQyxvQkFBb0M7SUFDM0QsT0FBTyxDQUFJLE1BQW1DLEVBQUUsRUFBRTtRQUNqRCxnQkFBZ0IsRUFBRSxDQUFDO1FBQ25CLE1BQU0sZUFBZSxHQUFHLGtDQUFlLENBQUMsUUFBUSxDQUFDO1FBQ2pELGVBQWUsQ0FBQyw2QkFBNkIsQ0FBQyxNQUFNLENBQUMsU0FBUyxFQUFFLG9CQUFvQixDQUFDLENBQUM7UUFDdEYsTUFBTSxXQUFXLEdBQWtCLEVBQUUsQ0FBQztRQUN0QyxXQUFXLENBQUMsSUFBSSxDQUFDLEdBQUcsZUFBZSxDQUFDLHdCQUF3QixDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7UUFDdEUsV0FBVyxDQUFDLElBQUksQ0FBQy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QUFFLFdBQVcsQ0FBQyxDQUFDO1lBQzVCLE1BQU07U0FDTjtRQUNELEtBQUssK0JBQWdCLENBQUMsU0FBUyxDQUFDLENBQUM7WUFDaEMsTUFBTSxPQUFPLEdBQUcsRUFBRSxXQUFXLEVBQUUsV0FBVyxDQUFDLFdBQVcsRUFBRSxJQUFJLEVBQUUsSUFBSSxFQUFFLE9BQU8sRUFBRSxXQUFXLENBQUMsT0FBTyxFQUFFLENBQUM7WUFDbkcsSUFBQSxvQkFBUyxFQUFDLE9BQU8sRUFBRSxXQUFXLENBQUMsQ0FBQztZQUNoQyxNQUFNO1NBQ047S0FDRDtBQUNGLENBQUMifQ==
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { ISupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';
|
|
2
|
-
import { StepBinding } from '../types/step-binding';
|
|
3
|
-
import { ContextType, StepPattern, TagName } from '../types/types';
|
|
4
|
-
/**
|
|
5
|
-
* Represents the default step pattern.
|
|
6
|
-
*/
|
|
7
|
-
export declare const DEFAULT_STEP_PATTERN = "/.*/";
|
|
8
|
-
/**
|
|
9
|
-
* Represents the default tag.
|
|
10
|
-
*/
|
|
11
|
-
export declare const DEFAULT_TAG = "*";
|
|
12
|
-
/**
|
|
13
|
-
* A metadata registry that captures information about bindings and their bound step bindings.
|
|
14
|
-
*/
|
|
15
|
-
export declare class BindingRegistry {
|
|
16
|
-
private _bindings;
|
|
17
|
-
private _targetBindings;
|
|
18
|
-
/**
|
|
19
|
-
* Gets the binding registry singleton.
|
|
20
|
-
*
|
|
21
|
-
* @returns A [[BindingRegistry]].
|
|
22
|
-
*/
|
|
23
|
-
static get instance(): BindingRegistry;
|
|
24
|
-
/**
|
|
25
|
-
* Updates the binding registry with information about the context types required by a
|
|
26
|
-
* binding class.
|
|
27
|
-
*
|
|
28
|
-
* @param targetPrototype The class representing the binding (constructor function).
|
|
29
|
-
* @param contextTypes An array of [[ContextType]] that define the types of objects that
|
|
30
|
-
* should be injected into the binding class during a scenario execution.
|
|
31
|
-
*/
|
|
32
|
-
registerContextTypesForTarget(targetPrototype: any, contextTypes?: ContextType[]): void;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves the context types that have been registered for a given binding class.
|
|
35
|
-
*
|
|
36
|
-
* @param targetPrototype The class representing the binding (constructor function).
|
|
37
|
-
*
|
|
38
|
-
* @returns An array of [[ContextType]] that have been registered for the specified
|
|
39
|
-
* binding class.
|
|
40
|
-
*/
|
|
41
|
-
getContextTypesForTarget(targetPrototype: any): ContextType[];
|
|
42
|
-
/**
|
|
43
|
-
* Updates the binding registry indexes with a step binding.
|
|
44
|
-
*
|
|
45
|
-
* @param stepBinding The step binding that is to be registered with the binding registry.
|
|
46
|
-
*/
|
|
47
|
-
registerStepBinding(stepBinding: StepBinding): void;
|
|
48
|
-
/**
|
|
49
|
-
* Retrieves the step bindings that have been registered for a given binding class.
|
|
50
|
-
*
|
|
51
|
-
* @param targetPrototype The class representing the binding (constructor function).
|
|
52
|
-
*
|
|
53
|
-
* @returns An array of [[StepBinding]] objects that have been registered for the specified
|
|
54
|
-
* binding class.
|
|
55
|
-
*/
|
|
56
|
-
getStepBindingsForTarget(targetPrototype: any): StepBinding[];
|
|
57
|
-
/**
|
|
58
|
-
* Retrieves the step bindings for a given step pattern and collection of tag names.
|
|
59
|
-
*
|
|
60
|
-
* @param stepPattern The step pattern to search.
|
|
61
|
-
* @param tags An array of [[TagName]] to search.
|
|
62
|
-
*
|
|
63
|
-
* @returns An array of [[StepBinding]] that map to the given step pattern and set of tag names.
|
|
64
|
-
*/
|
|
65
|
-
getStepBindings(stepPattern: StepPattern, tags: TagName[]): StepBinding[];
|
|
66
|
-
/**
|
|
67
|
-
* Updates the SupportCodeLibrary from Cucumber with
|
|
68
|
-
* callsite information from tsflow bindings
|
|
69
|
-
* @param library
|
|
70
|
-
* @returns
|
|
71
|
-
*/
|
|
72
|
-
updateSupportCodeLibrary: (library: ISupportCodeLibrary) => ISupportCodeLibrary;
|
|
73
|
-
/**
|
|
74
|
-
* Maps an array of tag names to an array of associated step bindings.
|
|
75
|
-
*
|
|
76
|
-
* @param tags An array of [[TagName]].
|
|
77
|
-
* @param tagMap The map of [[TagName]] -> [[StepBinding]] to use when mapping.
|
|
78
|
-
*
|
|
79
|
-
* @returns An array of [[StepBinding]].
|
|
80
|
-
*/
|
|
81
|
-
private mapTagNamesToStepBindings;
|
|
82
|
-
}
|
|
1
|
+
import { ISupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';
|
|
2
|
+
import { StepBinding } from '../types/step-binding';
|
|
3
|
+
import { ContextType, StepPattern, TagName } from '../types/types';
|
|
4
|
+
/**
|
|
5
|
+
* Represents the default step pattern.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_STEP_PATTERN = "/.*/";
|
|
8
|
+
/**
|
|
9
|
+
* Represents the default tag.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEFAULT_TAG = "*";
|
|
12
|
+
/**
|
|
13
|
+
* A metadata registry that captures information about bindings and their bound step bindings.
|
|
14
|
+
*/
|
|
15
|
+
export declare class BindingRegistry {
|
|
16
|
+
private _bindings;
|
|
17
|
+
private _targetBindings;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the binding registry singleton.
|
|
20
|
+
*
|
|
21
|
+
* @returns A [[BindingRegistry]].
|
|
22
|
+
*/
|
|
23
|
+
static get instance(): BindingRegistry;
|
|
24
|
+
/**
|
|
25
|
+
* Updates the binding registry with information about the context types required by a
|
|
26
|
+
* binding class.
|
|
27
|
+
*
|
|
28
|
+
* @param targetPrototype The class representing the binding (constructor function).
|
|
29
|
+
* @param contextTypes An array of [[ContextType]] that define the types of objects that
|
|
30
|
+
* should be injected into the binding class during a scenario execution.
|
|
31
|
+
*/
|
|
32
|
+
registerContextTypesForTarget(targetPrototype: any, contextTypes?: ContextType[]): void;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves the context types that have been registered for a given binding class.
|
|
35
|
+
*
|
|
36
|
+
* @param targetPrototype The class representing the binding (constructor function).
|
|
37
|
+
*
|
|
38
|
+
* @returns An array of [[ContextType]] that have been registered for the specified
|
|
39
|
+
* binding class.
|
|
40
|
+
*/
|
|
41
|
+
getContextTypesForTarget(targetPrototype: any): ContextType[];
|
|
42
|
+
/**
|
|
43
|
+
* Updates the binding registry indexes with a step binding.
|
|
44
|
+
*
|
|
45
|
+
* @param stepBinding The step binding that is to be registered with the binding registry.
|
|
46
|
+
*/
|
|
47
|
+
registerStepBinding(stepBinding: StepBinding): void;
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves the step bindings that have been registered for a given binding class.
|
|
50
|
+
*
|
|
51
|
+
* @param targetPrototype The class representing the binding (constructor function).
|
|
52
|
+
*
|
|
53
|
+
* @returns An array of [[StepBinding]] objects that have been registered for the specified
|
|
54
|
+
* binding class.
|
|
55
|
+
*/
|
|
56
|
+
getStepBindingsForTarget(targetPrototype: any): StepBinding[];
|
|
57
|
+
/**
|
|
58
|
+
* Retrieves the step bindings for a given step pattern and collection of tag names.
|
|
59
|
+
*
|
|
60
|
+
* @param stepPattern The step pattern to search.
|
|
61
|
+
* @param tags An array of [[TagName]] to search.
|
|
62
|
+
*
|
|
63
|
+
* @returns An array of [[StepBinding]] that map to the given step pattern and set of tag names.
|
|
64
|
+
*/
|
|
65
|
+
getStepBindings(stepPattern: StepPattern, tags: TagName[]): StepBinding[];
|
|
66
|
+
/**
|
|
67
|
+
* Updates the SupportCodeLibrary from Cucumber with
|
|
68
|
+
* callsite information from tsflow bindings
|
|
69
|
+
* @param library
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
updateSupportCodeLibrary: (library: ISupportCodeLibrary) => ISupportCodeLibrary;
|
|
73
|
+
/**
|
|
74
|
+
* Maps an array of tag names to an array of associated step bindings.
|
|
75
|
+
*
|
|
76
|
+
* @param tags An array of [[TagName]].
|
|
77
|
+
* @param tagMap The map of [[TagName]] -> [[StepBinding]] to use when mapping.
|
|
78
|
+
*
|
|
79
|
+
* @returns An array of [[StepBinding]].
|
|
80
|
+
*/
|
|
81
|
+
private mapTagNamesToStepBindings;
|
|
82
|
+
}
|