@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 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-context.js","sourceRoot":"","sources":["../src/scenario-context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;IAkBA,kDAAgC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TagName } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Provides information about a running Cucumber scenario.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ScenarioInfo {
|
|
6
|
+
scenarioTitle: string;
|
|
7
|
+
tags: TagName[];
|
|
8
|
+
/**
|
|
9
|
+
* Initializes the [[ScenarioInfo]] object.
|
|
10
|
+
*
|
|
11
|
+
* @param scenarioTitle The string title of the currently running Cucumber scenario.
|
|
12
|
+
* @param tags An array of [[TagName]] representing the tags that are in scope for the currently
|
|
13
|
+
* running Cucumber scenario.
|
|
14
|
+
*/
|
|
15
|
+
constructor(scenarioTitle: string, tags: TagName[]);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=scenario-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-info.d.ts","sourceRoot":"","sources":["../src/scenario-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;GAEG;AACH,qBAAa,YAAY;IAQL,aAAa,EAAE,MAAM;IAAS,IAAI,EAAE,OAAO,EAAE;IAPhE;;;;;;OAMG;gBACgB,aAAa,EAAE,MAAM,EAAS,IAAI,EAAE,OAAO,EAAE;CAChE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ScenarioInfo = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Provides information about a running Cucumber scenario.
|
|
15
|
+
*/
|
|
16
|
+
class ScenarioInfo {
|
|
17
|
+
/**
|
|
18
|
+
* Initializes the [[ScenarioInfo]] object.
|
|
19
|
+
*
|
|
20
|
+
* @param scenarioTitle The string title of the currently running Cucumber scenario.
|
|
21
|
+
* @param tags An array of [[TagName]] representing the tags that are in scope for the currently
|
|
22
|
+
* running Cucumber scenario.
|
|
23
|
+
*/
|
|
24
|
+
constructor(scenarioTitle, tags) {
|
|
25
|
+
this.scenarioTitle = scenarioTitle;
|
|
26
|
+
this.tags = tags;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ScenarioInfo = ScenarioInfo;
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=scenario-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-info.js","sourceRoot":"","sources":["../src/scenario-info.ts"],"names":[],"mappings":";;;;;;;;;;;;IAEA;;OAEG;IACH,MAAa,YAAY;QACxB;;;;;;WAMG;QACH,YAAmB,aAAqB,EAAS,IAAe;YAA7C,kBAAa,GAAb,aAAa,CAAQ;YAAS,SAAI,GAAJ,IAAI,CAAW;QAAG,CAAC;KACpE;IATD,oCASC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CucumberJS step binding types.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum StepBindingFlags {
|
|
5
|
+
/**
|
|
6
|
+
* No bindings.
|
|
7
|
+
*/
|
|
8
|
+
none = 0,
|
|
9
|
+
/**
|
|
10
|
+
* A 'Given' step definition binding.
|
|
11
|
+
*/
|
|
12
|
+
given = 1,
|
|
13
|
+
/**
|
|
14
|
+
* A 'When' step definition binding.
|
|
15
|
+
*/
|
|
16
|
+
when = 2,
|
|
17
|
+
/**
|
|
18
|
+
* A 'Then' step definition binding.
|
|
19
|
+
*/
|
|
20
|
+
then = 4,
|
|
21
|
+
/**
|
|
22
|
+
* A 'Before' hook binding.
|
|
23
|
+
*/
|
|
24
|
+
before = 8,
|
|
25
|
+
/**
|
|
26
|
+
* An 'After' hook binding.
|
|
27
|
+
*/
|
|
28
|
+
after = 16,
|
|
29
|
+
/**
|
|
30
|
+
* An 'BeforeAll' hook binding
|
|
31
|
+
*/
|
|
32
|
+
beforeAll = 32,
|
|
33
|
+
/**
|
|
34
|
+
* An 'AfterAll' hook binding
|
|
35
|
+
*/
|
|
36
|
+
afterAll = 64,
|
|
37
|
+
/**
|
|
38
|
+
* All step definition bindings.
|
|
39
|
+
*/
|
|
40
|
+
StepDefinitions = 7,
|
|
41
|
+
/**
|
|
42
|
+
* All hook bindings.
|
|
43
|
+
*/
|
|
44
|
+
Hooks = 120
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=step-binding-flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-binding-flags.d.ts","sourceRoot":"","sources":["../src/step-binding-flags.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,oBAAY,gBAAgB;IAC3B;;OAEG;IACH,IAAI,IAAI;IAER;;OAEG;IACH,KAAK,IAAS;IAEd;;OAEG;IACH,IAAI,IAAS;IAEb;;OAEG;IACH,IAAI,IAAS;IAEb;;OAEG;IACH,MAAM,IAAS;IAEf;;OAEG;IACH,KAAK,KAAS;IAEd;;OAEG;IACH,SAAS,KAAS;IAElB;;OAEG;IACH,QAAQ,KAAS;IAEjB;;OAEG;IACH,eAAe,IAAyE;IAExF;;OAEG;IACH,KAAK,MAA4G;CACjH"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StepBindingFlags = void 0;
|
|
13
|
+
// tslint:disable:no-bitwise
|
|
14
|
+
/**
|
|
15
|
+
* The CucumberJS step binding types.
|
|
16
|
+
*/
|
|
17
|
+
var StepBindingFlags;
|
|
18
|
+
(function (StepBindingFlags) {
|
|
19
|
+
/**
|
|
20
|
+
* No bindings.
|
|
21
|
+
*/
|
|
22
|
+
StepBindingFlags[StepBindingFlags["none"] = 0] = "none";
|
|
23
|
+
/**
|
|
24
|
+
* A 'Given' step definition binding.
|
|
25
|
+
*/
|
|
26
|
+
StepBindingFlags[StepBindingFlags["given"] = 1] = "given";
|
|
27
|
+
/**
|
|
28
|
+
* A 'When' step definition binding.
|
|
29
|
+
*/
|
|
30
|
+
StepBindingFlags[StepBindingFlags["when"] = 2] = "when";
|
|
31
|
+
/**
|
|
32
|
+
* A 'Then' step definition binding.
|
|
33
|
+
*/
|
|
34
|
+
StepBindingFlags[StepBindingFlags["then"] = 4] = "then";
|
|
35
|
+
/**
|
|
36
|
+
* A 'Before' hook binding.
|
|
37
|
+
*/
|
|
38
|
+
StepBindingFlags[StepBindingFlags["before"] = 8] = "before";
|
|
39
|
+
/**
|
|
40
|
+
* An 'After' hook binding.
|
|
41
|
+
*/
|
|
42
|
+
StepBindingFlags[StepBindingFlags["after"] = 16] = "after";
|
|
43
|
+
/**
|
|
44
|
+
* An 'BeforeAll' hook binding
|
|
45
|
+
*/
|
|
46
|
+
StepBindingFlags[StepBindingFlags["beforeAll"] = 32] = "beforeAll";
|
|
47
|
+
/**
|
|
48
|
+
* An 'AfterAll' hook binding
|
|
49
|
+
*/
|
|
50
|
+
StepBindingFlags[StepBindingFlags["afterAll"] = 64] = "afterAll";
|
|
51
|
+
/**
|
|
52
|
+
* All step definition bindings.
|
|
53
|
+
*/
|
|
54
|
+
StepBindingFlags[StepBindingFlags["StepDefinitions"] = 7] = "StepDefinitions";
|
|
55
|
+
/**
|
|
56
|
+
* All hook bindings.
|
|
57
|
+
*/
|
|
58
|
+
StepBindingFlags[StepBindingFlags["Hooks"] = 120] = "Hooks";
|
|
59
|
+
})(StepBindingFlags = exports.StepBindingFlags || (exports.StepBindingFlags = {}));
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=step-binding-flags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-binding-flags.js","sourceRoot":"","sources":["../src/step-binding-flags.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,4BAA4B;IAC5B;;OAEG;IACH,IAAY,gBAkDX;IAlDD,WAAY,gBAAgB;QAC3B;;WAEG;QACH,uDAAQ,CAAA;QAER;;WAEG;QACH,yDAAc,CAAA;QAEd;;WAEG;QACH,uDAAa,CAAA;QAEb;;WAEG;QACH,uDAAa,CAAA;QAEb;;WAEG;QACH,2DAAe,CAAA;QAEf;;WAEG;QACH,0DAAc,CAAA;QAEd;;WAEG;QACH,kEAAkB,CAAA;QAElB;;WAEG;QACH,gEAAiB,CAAA;QAEjB;;WAEG;QACH,6EAAwF,CAAA;QAExF;;WAEG;QACH,2DAAiH,CAAA;IAClH,CAAC,EAlDW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAkD3B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Callsite } from './our-callsite';
|
|
2
|
+
import { StepBindingFlags } from './step-binding-flags';
|
|
3
|
+
/**
|
|
4
|
+
* Encapsulates data about a step binding.
|
|
5
|
+
*/
|
|
6
|
+
export interface StepBinding {
|
|
7
|
+
/**
|
|
8
|
+
* The step pattern.
|
|
9
|
+
*/
|
|
10
|
+
stepPattern: RegExp | string;
|
|
11
|
+
/**
|
|
12
|
+
* The step binding type.
|
|
13
|
+
*/
|
|
14
|
+
bindingType: StepBindingFlags;
|
|
15
|
+
/**
|
|
16
|
+
* The type that is associated with the current step binding.
|
|
17
|
+
*/
|
|
18
|
+
targetPrototype: any;
|
|
19
|
+
/**
|
|
20
|
+
* The function name that is associated with the current step binding.
|
|
21
|
+
*/
|
|
22
|
+
targetPropertyKey: string | symbol;
|
|
23
|
+
/**
|
|
24
|
+
* The count of arguments that have been specified on the [[StepBindingDescriptor.targetPropertyKey]].
|
|
25
|
+
*/
|
|
26
|
+
argsLength: number;
|
|
27
|
+
/**
|
|
28
|
+
* The optional tag that is associated with the current step binding.
|
|
29
|
+
*/
|
|
30
|
+
tag?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The optiomal timeout that is associated with the current step binding.
|
|
33
|
+
*/
|
|
34
|
+
timeout?: number;
|
|
35
|
+
/**
|
|
36
|
+
* The wrapper Option passing to cucumber
|
|
37
|
+
*/
|
|
38
|
+
wrapperOption?: any;
|
|
39
|
+
/**
|
|
40
|
+
* The callsite of the step binding.
|
|
41
|
+
*/
|
|
42
|
+
callsite: Callsite;
|
|
43
|
+
}
|
|
44
|
+
export * from './step-binding-flags';
|
|
45
|
+
//# sourceMappingURL=step-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-binding.d.ts","sourceRoot":"","sources":["../src/step-binding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAE7B;;OAEG;IACH,WAAW,EAAE,gBAAgB,CAAC;IAE9B;;OAEG;IACH,eAAe,EAAE,GAAG,CAAC;IAErB;;OAEG;IACH,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAAC;IAEnC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,aAAa,CAAC,EAAE,GAAG,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;CACnB;AAED,cAAc,sBAAsB,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", "./step-binding-flags"], factory);
|
|
18
|
+
}
|
|
19
|
+
})(function (require, exports) {
|
|
20
|
+
"use strict";
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
__exportStar(require("./step-binding-flags"), exports);
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=step-binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-binding.js","sourceRoot":"","sources":["../src/step-binding.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;IAqDA,uDAAqC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A method decorator that marks the associated function as a 'Given' step.
|
|
3
|
+
*
|
|
4
|
+
* @param stepPattern The regular expression that will be used to match steps.
|
|
5
|
+
* @param tag An optional tag.
|
|
6
|
+
* @param timeout An optional timeout.
|
|
7
|
+
*/
|
|
8
|
+
export declare function given(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): MethodDecorator;
|
|
9
|
+
/**
|
|
10
|
+
* A method decorator that marks the associated function as a 'When' step.
|
|
11
|
+
*
|
|
12
|
+
* @param stepPattern The regular expression that will be used to match steps.
|
|
13
|
+
* @param tag An optional tag.
|
|
14
|
+
* @param timeout An optional timeout.
|
|
15
|
+
*/
|
|
16
|
+
export declare function when(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): MethodDecorator;
|
|
17
|
+
/**
|
|
18
|
+
* A method decorator that marks the associated function as a 'Then' step.
|
|
19
|
+
*
|
|
20
|
+
* @param stepPattern The regular expression that will be used to match steps.
|
|
21
|
+
* @param tag An optional tag.
|
|
22
|
+
* @param timeout An optional timeout.
|
|
23
|
+
*/
|
|
24
|
+
export declare function then(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): MethodDecorator;
|
|
25
|
+
//# sourceMappingURL=step-definition-decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-definition-decorators.d.ts","sourceRoot":"","sources":["../src/step-definition-decorators.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,KAAK,CACpB,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,GAAG,GACjB,eAAe,CAoBjB;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CACnB,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,GAAG,GACjB,eAAe,CAoBjB;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CACnB,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,GAAG,GACjB,eAAe,CAoBjB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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.then = exports.when = exports.given = 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 'Given' step.
|
|
18
|
+
*
|
|
19
|
+
* @param stepPattern The regular expression that will be used to match steps.
|
|
20
|
+
* @param tag An optional tag.
|
|
21
|
+
* @param timeout An optional timeout.
|
|
22
|
+
*/
|
|
23
|
+
function given(stepPattern, tag, timeout, wrapperOption) {
|
|
24
|
+
const callsite = our_callsite_1.Callsite.capture();
|
|
25
|
+
return (target, propertyKey, descriptor) => {
|
|
26
|
+
const stepBinding = {
|
|
27
|
+
stepPattern: stepPattern,
|
|
28
|
+
bindingType: step_binding_1.StepBindingFlags.given,
|
|
29
|
+
targetPrototype: target,
|
|
30
|
+
targetPropertyKey: propertyKey,
|
|
31
|
+
argsLength: target[propertyKey].length,
|
|
32
|
+
tag: tag,
|
|
33
|
+
timeout: timeout,
|
|
34
|
+
wrapperOption: wrapperOption,
|
|
35
|
+
callsite: callsite
|
|
36
|
+
};
|
|
37
|
+
binding_registry_1.BindingRegistry.instance.registerStepBinding(stepBinding);
|
|
38
|
+
return descriptor;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.given = given;
|
|
42
|
+
/**
|
|
43
|
+
* A method decorator that marks the associated function as a 'When' step.
|
|
44
|
+
*
|
|
45
|
+
* @param stepPattern The regular expression that will be used to match steps.
|
|
46
|
+
* @param tag An optional tag.
|
|
47
|
+
* @param timeout An optional timeout.
|
|
48
|
+
*/
|
|
49
|
+
function when(stepPattern, tag, timeout, wrapperOption) {
|
|
50
|
+
const callsite = our_callsite_1.Callsite.capture();
|
|
51
|
+
return (target, propertyKey, descriptor) => {
|
|
52
|
+
const stepBinding = {
|
|
53
|
+
stepPattern: stepPattern,
|
|
54
|
+
bindingType: step_binding_1.StepBindingFlags.when,
|
|
55
|
+
targetPrototype: target,
|
|
56
|
+
targetPropertyKey: propertyKey,
|
|
57
|
+
argsLength: target[propertyKey].length,
|
|
58
|
+
tag: tag,
|
|
59
|
+
timeout: timeout,
|
|
60
|
+
wrapperOption: wrapperOption,
|
|
61
|
+
callsite: callsite
|
|
62
|
+
};
|
|
63
|
+
binding_registry_1.BindingRegistry.instance.registerStepBinding(stepBinding);
|
|
64
|
+
return descriptor;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
exports.when = when;
|
|
68
|
+
/**
|
|
69
|
+
* A method decorator that marks the associated function as a 'Then' step.
|
|
70
|
+
*
|
|
71
|
+
* @param stepPattern The regular expression that will be used to match steps.
|
|
72
|
+
* @param tag An optional tag.
|
|
73
|
+
* @param timeout An optional timeout.
|
|
74
|
+
*/
|
|
75
|
+
function then(stepPattern, tag, timeout, wrapperOption) {
|
|
76
|
+
const callsite = our_callsite_1.Callsite.capture();
|
|
77
|
+
return (target, propertyKey, descriptor) => {
|
|
78
|
+
const stepBinding = {
|
|
79
|
+
stepPattern: stepPattern,
|
|
80
|
+
bindingType: step_binding_1.StepBindingFlags.then,
|
|
81
|
+
targetPrototype: target,
|
|
82
|
+
targetPropertyKey: propertyKey,
|
|
83
|
+
argsLength: target[propertyKey].length,
|
|
84
|
+
tag: tag,
|
|
85
|
+
timeout: timeout,
|
|
86
|
+
wrapperOption: wrapperOption,
|
|
87
|
+
callsite: callsite
|
|
88
|
+
};
|
|
89
|
+
binding_registry_1.BindingRegistry.instance.registerStepBinding(stepBinding);
|
|
90
|
+
return descriptor;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
exports.then = then;
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=step-definition-decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-definition-decorators.js","sourceRoot":"","sources":["../src/step-definition-decorators.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,yDAAqD;IACrD,iDAA0C;IAC1C,iDAA+D;IAE/D;;;;;;OAMG;IACH,SAAgB,KAAK,CACpB,WAA4B,EAC5B,GAAY,EACZ,OAAgB,EAChB,aAAmB;QAEnB,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CA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5B,GAAY,EACZ,OAAgB,EAChB,aAAmB;QAEnB,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CAAC;QAEpC,OAAO,CAAI,MAAW,EAAE,WAA4B,EAAE,UAAsC,EAAE,EAAE;YAC/F,MAAM,WAAW,GAAgB;gBAChC,WAAW,EAAE,WAAW;gBACxB,WAAW,EAAE,+BAAgB,CAAC,IAAI;gBAClC,eAAe,EAAE,MAAM;gBACvB,iBAAiB,EAAE,WAAW;gBAC9B,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM;gBACtC,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,OAAO;gBAChB,aAAa,EAAE,aAAa;gBAC5B,QAAQ,EAAE,QAAQ;aAClB,CAAC;YAEF,kCAAe,CAAC,QAAQ,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;YAE1D,OAAO,UAAU,CAAC;QACnB,CAAC,CAAC;IACH,CAAC;IAzBD,oBAyBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ISnippetSnytax, SnippetInterface } from '@cucumber/cucumber/lib/formatter/step_definition_snippet_builder/snippet_syntax';
|
|
2
|
+
/**
|
|
3
|
+
* Generate snippets for tsflow.
|
|
4
|
+
* NOTE: Needs to be an exported function for cucumber to
|
|
5
|
+
* load this correctly from common.js configuration
|
|
6
|
+
* @param snippetInterface
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function TsflowSnippetSyntax(snippetInterface: SnippetInterface): ISnippetSnytax;
|
|
10
|
+
//# sourceMappingURL=tsflow-snippet-syntax.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsflow-snippet-syntax.d.ts","sourceRoot":"","sources":["../src/tsflow-snippet-syntax.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EAEd,gBAAgB,EAChB,MAAM,iFAAiF,CAAC;AAezF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,cAAc,CAqCtF"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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", "@cucumber/cucumber/lib/formatter/step_definition_snippet_builder/snippet_syntax"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TsflowSnippetSyntax = void 0;
|
|
13
|
+
const snippet_syntax_1 = require("@cucumber/cucumber/lib/formatter/step_definition_snippet_builder/snippet_syntax");
|
|
14
|
+
const CALLBACK_NAME = 'callback';
|
|
15
|
+
const toCamelCase = (str) => {
|
|
16
|
+
return str
|
|
17
|
+
.replace(/\s(.)/g, function ($1) {
|
|
18
|
+
return $1.toUpperCase();
|
|
19
|
+
})
|
|
20
|
+
.replace(/\s/g, '')
|
|
21
|
+
.replace(/[^\w]/g, '')
|
|
22
|
+
.replace(/^(.)/, function ($1) {
|
|
23
|
+
return $1.toLowerCase();
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Generate snippets for tsflow.
|
|
28
|
+
* NOTE: Needs to be an exported function for cucumber to
|
|
29
|
+
* load this correctly from common.js configuration
|
|
30
|
+
* @param snippetInterface
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
function TsflowSnippetSyntax(snippetInterface) {
|
|
34
|
+
return {
|
|
35
|
+
build({ comment, generatedExpressions, functionName, stepParameterNames }) {
|
|
36
|
+
let functionKeyword = '';
|
|
37
|
+
if (snippetInterface === snippet_syntax_1.SnippetInterface.AsyncAwait) {
|
|
38
|
+
functionKeyword = 'async ';
|
|
39
|
+
}
|
|
40
|
+
else if (snippetInterface === snippet_syntax_1.SnippetInterface.Generator) {
|
|
41
|
+
functionKeyword = '*';
|
|
42
|
+
}
|
|
43
|
+
let implementation;
|
|
44
|
+
if (snippetInterface === snippet_syntax_1.SnippetInterface.Callback) {
|
|
45
|
+
implementation = `${CALLBACK_NAME}(null, 'pending');`;
|
|
46
|
+
}
|
|
47
|
+
else if (snippetInterface === snippet_syntax_1.SnippetInterface.Promise) {
|
|
48
|
+
implementation = "return Promise.resolve('pending');";
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
implementation = "return 'pending';";
|
|
52
|
+
}
|
|
53
|
+
const definitionChoices = generatedExpressions.map((generatedExpression, index) => {
|
|
54
|
+
const prefix = index === 0 ? '' : '// ';
|
|
55
|
+
const allParameterNames = generatedExpression.parameterNames.concat(stepParameterNames);
|
|
56
|
+
if (snippetInterface === snippet_syntax_1.SnippetInterface.Callback) {
|
|
57
|
+
allParameterNames.push(CALLBACK_NAME);
|
|
58
|
+
}
|
|
59
|
+
const pattern = generatedExpression.source.replace(/'/g, "\\'");
|
|
60
|
+
const methodName = toCamelCase(pattern);
|
|
61
|
+
const parametersStr = allParameterNames.length > 0 ? allParameterNames.join(': any, ') + ': any' : '';
|
|
62
|
+
return (`${prefix}@${functionName.toLowerCase()}('${pattern}')\n` +
|
|
63
|
+
`${functionKeyword}${methodName}(${parametersStr}): any {\n`);
|
|
64
|
+
});
|
|
65
|
+
return definitionChoices.join('') + ' // ' + comment + '\n ' + implementation + '\n}';
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
exports.TsflowSnippetSyntax = TsflowSnippetSyntax;
|
|
70
|
+
// This is needed so that cucumber.js can load the function
|
|
71
|
+
module.exports = TsflowSnippetSyntax;
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=tsflow-snippet-syntax.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsflow-snippet-syntax.js","s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;oBACjF,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;oBACxC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,cAAc,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;oBACxF,IAAI,gBAAgB,KAAK,iCAAgB,CAAC,QAAQ,EAAE;wBACnD,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;qBACtC;oBACD,MAAM,OAAO,GAAG,mBAAmB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;oBAChE,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;oBACxC,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;oBACtG,OAAO,CACN,GAAG,MAAM,IAAI,YAAY,CAAC,WAAW,EAAE,KAAK,OAAO,MAAM;wBACzD,GAAG,eAAe,GAAG,UAAU,IAAI,aAAa,YAAY,CAC5D,CAAC;gBACH,CAAC,CAAC,CAAC;gBAEH,OAAO,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,KAAK,CAAC;YACzF,CAAC;SACD,CAAC;IACH,CAAC;IArCD,kDAqCC;IACD,2DAA2D;IAC3D,MAAM,CAAC,OAAO,GAAG,mBAAmB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A string representation of a [[RegExp]] that defines a Cucumber step pattern.
|
|
3
|
+
*/
|
|
4
|
+
export declare type StepPattern = string;
|
|
5
|
+
/**
|
|
6
|
+
* A Cucumber tag name.
|
|
7
|
+
*/
|
|
8
|
+
export declare type TagName = string;
|
|
9
|
+
/**
|
|
10
|
+
* Represents a class that will be injected into a binding class to provide context
|
|
11
|
+
* during the execution of a Cucumber scenario.
|
|
12
|
+
*/
|
|
13
|
+
export interface ContextType {
|
|
14
|
+
/**
|
|
15
|
+
* A default constructor.
|
|
16
|
+
*/
|
|
17
|
+
new (): any;
|
|
18
|
+
}
|
|
19
|
+
export declare type TypeDecorator = <T>(target: {
|
|
20
|
+
new (...args: any[]): T;
|
|
21
|
+
}) => void;
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW,GAAG,MAAM,CAAC;AAEjC;;GAEG;AACH,oBAAY,OAAO,GAAG,MAAM,CAAC;AAE7B;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,QAAQ,GAAG,CAAC;CACZ;AAED,oBAAY,aAAa,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE;IAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;CAAE,KAAK,IAAI,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lynxwall/cucumber-tsflow",
|
|
3
|
+
"description": "Provides 'specflow' like bindings for CucumberJS 7.0.0+ in TypeScript 1.7+.",
|
|
4
|
+
"version": "4.0.0",
|
|
5
|
+
"author": "Lonnie Wall <lynxdev@lynxwall.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./dist",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"testing",
|
|
10
|
+
"bdd",
|
|
11
|
+
"cucumber",
|
|
12
|
+
"gherkin",
|
|
13
|
+
"tests",
|
|
14
|
+
"typescript",
|
|
15
|
+
"specflow"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/lynxwall/cucumber-js-tsflow.git"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"callsites": "^3.1.0",
|
|
23
|
+
"log4js": "^6.4.2",
|
|
24
|
+
"source-map-support": "^0.5.21",
|
|
25
|
+
"underscore": "^1.13.2"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/source-map-support": "^0.5.4"
|
|
29
|
+
}
|
|
30
|
+
}
|