@lynxwall/cucumber-tsflow 5.1.3 → 6.0.2
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 +546 -544
- package/bin/cucumber-tsflow +1 -1
- 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 +22 -22
- package/lib/cli/index.js +101 -96
- package/lib/cli/load-configuration.d.ts +20 -20
- package/lib/cli/load-configuration.js +92 -92
- package/lib/cli/run.d.ts +1 -1
- package/lib/cli/run.js +49 -44
- 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 +216 -218
- 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 +96 -95
- package/lib/cucumber/message-collector.d.ts +81 -80
- package/lib/cucumber/message-collector.js +251 -241
- package/lib/cucumber/parallel/coordinator.d.ts +79 -78
- package/lib/cucumber/parallel/coordinator.js +247 -228
- 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 -31
- package/lib/cucumber/parallel/worker.js +104 -104
- package/lib/cucumber/run-cucumber.d.ts +14 -14
- package/lib/cucumber/run-cucumber.js +117 -117
- 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 +19 -19
- package/lib/esvue.d.ts +1 -1
- package/lib/esvue.js +41 -41
- package/lib/formatters/behave-json-formatter.d.ts +49 -49
- package/lib/formatters/behave-json-formatter.js +75 -75
- package/lib/formatters/tsflow-snippet-syntax.d.ts +9 -9
- package/lib/formatters/tsflow-snippet-syntax.js +90 -93
- 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 +333 -335
- package/lib/gherkin/gherkin-manager.d.ts +29 -29
- package/lib/gherkin/gherkin-manager.js +114 -113
- package/lib/gherkin/models.d.ts +45 -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 +19 -21
- 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 +47 -45
- package/lib/transpilers/vue-sfc/main.d.ts +8 -8
- package/lib/transpilers/vue-sfc/main.js +248 -248
- 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 +23 -21
- package/lib/types/step-binding-flags.d.ts +53 -53
- package/lib/types/step-binding-flags.js +58 -58
- 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 +73 -71
- package/lib/version.d.ts +1 -1
- package/lib/version.js +5 -5
- package/package.json +58 -58
|
@@ -1,103 +1,103 @@
|
|
|
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.afterStep = exports.after = exports.afterAll = exports.beforeStep = exports.before = exports.beforeAll = void 0;
|
|
7
|
-
const binding_registry_1 = require("./binding-registry");
|
|
8
|
-
const our_callsite_1 = require("../utils/our-callsite");
|
|
9
|
-
const step_binding_1 = require("../types/step-binding");
|
|
10
|
-
const short_uuid_1 = __importDefault(require("short-uuid"));
|
|
11
|
-
/**
|
|
12
|
-
* A method decorator that marks the associated function as a 'Before All Scenario' step. The function is
|
|
13
|
-
* executed before all scenarios are executed.
|
|
14
|
-
*
|
|
15
|
-
* @param timeout Optional timeout in milliseconds
|
|
16
|
-
*/
|
|
17
|
-
function beforeAll(timeout) {
|
|
18
|
-
const callSite = our_callsite_1.Callsite.capture();
|
|
19
|
-
return createDecoratorFactory(step_binding_1.StepBindingFlags.beforeAll, callSite, undefined, timeout);
|
|
20
|
-
}
|
|
21
|
-
exports.beforeAll = beforeAll;
|
|
22
|
-
/**
|
|
23
|
-
* A method decorator that marks the associated function as a 'Before Scenario' step. The function is
|
|
24
|
-
* executed before each scenario.
|
|
25
|
-
*
|
|
26
|
-
* @param tags Optional tag or tags associated with a scenario.
|
|
27
|
-
* @param timeout Optional timeout in milliseconds
|
|
28
|
-
*/
|
|
29
|
-
function before(tags, timeout) {
|
|
30
|
-
const callSite = our_callsite_1.Callsite.capture();
|
|
31
|
-
return createDecoratorFactory(step_binding_1.StepBindingFlags.before, callSite, tags, timeout);
|
|
32
|
-
}
|
|
33
|
-
exports.before = before;
|
|
34
|
-
/**
|
|
35
|
-
* A method decorator that marks the associated function as a 'Before Step' step. The function is
|
|
36
|
-
* executed before each step.
|
|
37
|
-
*
|
|
38
|
-
* @param tags Optional tag or tags associated with a scenario.
|
|
39
|
-
* @param timeout Optional timeout in milliseconds
|
|
40
|
-
*/
|
|
41
|
-
function beforeStep(tags, timeout) {
|
|
42
|
-
const callSite = our_callsite_1.Callsite.capture();
|
|
43
|
-
return createDecoratorFactory(step_binding_1.StepBindingFlags.beforeStep, callSite, tags, timeout);
|
|
44
|
-
}
|
|
45
|
-
exports.beforeStep = beforeStep;
|
|
46
|
-
/**
|
|
47
|
-
* A method decorator that marks the associated function as an 'After All Scenario' step. The function is
|
|
48
|
-
* executed after all scenarios are executed.
|
|
49
|
-
*
|
|
50
|
-
* @param timeout Optional timeout in milliseconds
|
|
51
|
-
*/
|
|
52
|
-
function afterAll(timeout) {
|
|
53
|
-
const callSite = our_callsite_1.Callsite.capture();
|
|
54
|
-
return createDecoratorFactory(step_binding_1.StepBindingFlags.afterAll, callSite, undefined, timeout);
|
|
55
|
-
}
|
|
56
|
-
exports.afterAll = afterAll;
|
|
57
|
-
/**
|
|
58
|
-
* A method decorator that marks the associated function as an 'After Scenario' step. The function is
|
|
59
|
-
* executed after each scenario.
|
|
60
|
-
*
|
|
61
|
-
* @param tags Optional tag or tags associated with a scenario.
|
|
62
|
-
* @param timeout Optional timeout in milliseconds
|
|
63
|
-
*/
|
|
64
|
-
function after(tags, timeout) {
|
|
65
|
-
const callSite = our_callsite_1.Callsite.capture();
|
|
66
|
-
return createDecoratorFactory(step_binding_1.StepBindingFlags.after, callSite, tags, timeout);
|
|
67
|
-
}
|
|
68
|
-
exports.after = after;
|
|
69
|
-
/**
|
|
70
|
-
* A method decorator that marks the associated function as a 'After Step' step. The function is
|
|
71
|
-
* executed after each step.
|
|
72
|
-
*
|
|
73
|
-
* @param tags Optional tag or tags associated with a scenario.
|
|
74
|
-
* @param timeout Optional timeout in milliseconds
|
|
75
|
-
*/
|
|
76
|
-
function afterStep(tags, timeout) {
|
|
77
|
-
const callSite = our_callsite_1.Callsite.capture();
|
|
78
|
-
return createDecoratorFactory(step_binding_1.StepBindingFlags.afterStep, callSite, tags, timeout);
|
|
79
|
-
}
|
|
80
|
-
exports.afterStep = afterStep;
|
|
81
|
-
function checkTag(tag) {
|
|
82
|
-
return tag;
|
|
83
|
-
}
|
|
84
|
-
function createDecoratorFactory(flag, callSite, tag, timeout) {
|
|
85
|
-
return (target, propertyKey, descriptor) => {
|
|
86
|
-
const stepBinding = {
|
|
87
|
-
stepPattern: '',
|
|
88
|
-
bindingType: flag,
|
|
89
|
-
targetPrototype: target,
|
|
90
|
-
targetPropertyKey: propertyKey,
|
|
91
|
-
argsLength: target[propertyKey].length,
|
|
92
|
-
timeout: timeout,
|
|
93
|
-
callsite: callSite,
|
|
94
|
-
cucumberKey: (0, short_uuid_1.default)().new()
|
|
95
|
-
};
|
|
96
|
-
if (tag) {
|
|
97
|
-
stepBinding.tags = checkTag(tag);
|
|
98
|
-
}
|
|
99
|
-
binding_registry_1.BindingRegistry.instance.registerStepBinding(stepBinding);
|
|
100
|
-
return descriptor;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
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.afterStep = exports.after = exports.afterAll = exports.beforeStep = exports.before = exports.beforeAll = void 0;
|
|
7
|
+
const binding_registry_1 = require("./binding-registry");
|
|
8
|
+
const our_callsite_1 = require("../utils/our-callsite");
|
|
9
|
+
const step_binding_1 = require("../types/step-binding");
|
|
10
|
+
const short_uuid_1 = __importDefault(require("short-uuid"));
|
|
11
|
+
/**
|
|
12
|
+
* A method decorator that marks the associated function as a 'Before All Scenario' step. The function is
|
|
13
|
+
* executed before all scenarios are executed.
|
|
14
|
+
*
|
|
15
|
+
* @param timeout Optional timeout in milliseconds
|
|
16
|
+
*/
|
|
17
|
+
function beforeAll(timeout) {
|
|
18
|
+
const callSite = our_callsite_1.Callsite.capture();
|
|
19
|
+
return createDecoratorFactory(step_binding_1.StepBindingFlags.beforeAll, callSite, undefined, timeout);
|
|
20
|
+
}
|
|
21
|
+
exports.beforeAll = beforeAll;
|
|
22
|
+
/**
|
|
23
|
+
* A method decorator that marks the associated function as a 'Before Scenario' step. The function is
|
|
24
|
+
* executed before each scenario.
|
|
25
|
+
*
|
|
26
|
+
* @param tags Optional tag or tags associated with a scenario.
|
|
27
|
+
* @param timeout Optional timeout in milliseconds
|
|
28
|
+
*/
|
|
29
|
+
function before(tags, timeout) {
|
|
30
|
+
const callSite = our_callsite_1.Callsite.capture();
|
|
31
|
+
return createDecoratorFactory(step_binding_1.StepBindingFlags.before, callSite, tags, timeout);
|
|
32
|
+
}
|
|
33
|
+
exports.before = before;
|
|
34
|
+
/**
|
|
35
|
+
* A method decorator that marks the associated function as a 'Before Step' step. The function is
|
|
36
|
+
* executed before each step.
|
|
37
|
+
*
|
|
38
|
+
* @param tags Optional tag or tags associated with a scenario.
|
|
39
|
+
* @param timeout Optional timeout in milliseconds
|
|
40
|
+
*/
|
|
41
|
+
function beforeStep(tags, timeout) {
|
|
42
|
+
const callSite = our_callsite_1.Callsite.capture();
|
|
43
|
+
return createDecoratorFactory(step_binding_1.StepBindingFlags.beforeStep, callSite, tags, timeout);
|
|
44
|
+
}
|
|
45
|
+
exports.beforeStep = beforeStep;
|
|
46
|
+
/**
|
|
47
|
+
* A method decorator that marks the associated function as an 'After All Scenario' step. The function is
|
|
48
|
+
* executed after all scenarios are executed.
|
|
49
|
+
*
|
|
50
|
+
* @param timeout Optional timeout in milliseconds
|
|
51
|
+
*/
|
|
52
|
+
function afterAll(timeout) {
|
|
53
|
+
const callSite = our_callsite_1.Callsite.capture();
|
|
54
|
+
return createDecoratorFactory(step_binding_1.StepBindingFlags.afterAll, callSite, undefined, timeout);
|
|
55
|
+
}
|
|
56
|
+
exports.afterAll = afterAll;
|
|
57
|
+
/**
|
|
58
|
+
* A method decorator that marks the associated function as an 'After Scenario' step. The function is
|
|
59
|
+
* executed after each scenario.
|
|
60
|
+
*
|
|
61
|
+
* @param tags Optional tag or tags associated with a scenario.
|
|
62
|
+
* @param timeout Optional timeout in milliseconds
|
|
63
|
+
*/
|
|
64
|
+
function after(tags, timeout) {
|
|
65
|
+
const callSite = our_callsite_1.Callsite.capture();
|
|
66
|
+
return createDecoratorFactory(step_binding_1.StepBindingFlags.after, callSite, tags, timeout);
|
|
67
|
+
}
|
|
68
|
+
exports.after = after;
|
|
69
|
+
/**
|
|
70
|
+
* A method decorator that marks the associated function as a 'After Step' step. The function is
|
|
71
|
+
* executed after each step.
|
|
72
|
+
*
|
|
73
|
+
* @param tags Optional tag or tags associated with a scenario.
|
|
74
|
+
* @param timeout Optional timeout in milliseconds
|
|
75
|
+
*/
|
|
76
|
+
function afterStep(tags, timeout) {
|
|
77
|
+
const callSite = our_callsite_1.Callsite.capture();
|
|
78
|
+
return createDecoratorFactory(step_binding_1.StepBindingFlags.afterStep, callSite, tags, timeout);
|
|
79
|
+
}
|
|
80
|
+
exports.afterStep = afterStep;
|
|
81
|
+
function checkTag(tag) {
|
|
82
|
+
return tag;
|
|
83
|
+
}
|
|
84
|
+
function createDecoratorFactory(flag, callSite, tag, timeout) {
|
|
85
|
+
return (target, propertyKey, descriptor) => {
|
|
86
|
+
const stepBinding = {
|
|
87
|
+
stepPattern: '',
|
|
88
|
+
bindingType: flag,
|
|
89
|
+
targetPrototype: target,
|
|
90
|
+
targetPropertyKey: propertyKey,
|
|
91
|
+
argsLength: target[propertyKey].length,
|
|
92
|
+
timeout: timeout,
|
|
93
|
+
callsite: callSite,
|
|
94
|
+
cucumberKey: (0, short_uuid_1.default)().new()
|
|
95
|
+
};
|
|
96
|
+
if (tag) {
|
|
97
|
+
stepBinding.tags = checkTag(tag);
|
|
98
|
+
}
|
|
99
|
+
binding_registry_1.BindingRegistry.instance.registerStepBinding(stepBinding);
|
|
100
|
+
return descriptor;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
103
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaG9vay1kZWNvcmF0b3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2N1Y3VtYmVyL2hvb2stZGVjb3JhdG9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSx5REFBcUQ7QUFDckQsd0RBQWlEO0FBQ2pELHdEQUFzRTtBQUN0RSw0REFBbUM7QUFFbkM7Ozs7O0dBS0c7QUFDSCxTQUFnQixTQUFTLENBQUMsT0FBZ0I7SUFDekMsTUFBTSxRQUFRLEdBQUcsdUJBQVEsQ0FBQyxPQUFPLEVBQUUsQ0FBQztJQUNwQyxPQUFPLHNCQUFzQixDQUFDLCtCQUFnQixDQUFDLFNBQVMsRUFBRSxRQUFRLEVBQUUsU0FBUyxFQUFFLE9BQU8sQ0FBQyxDQUFDO0FBQ3pGLENBQUM7QUFIRCw4QkFHQztBQUNEOzs7Ozs7R0FNRztBQUNILFNBQWdCLE1BQU0sQ0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UM7QUFDSCxDQUFDIn0=
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ScenarioContext, ScenarioInfo } from '../types/scenario-context';
|
|
2
|
-
import { ContextType } from '../types/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 '../types/scenario-context';
|
|
1
|
+
import { ScenarioContext, ScenarioInfo } from '../types/scenario-context';
|
|
2
|
+
import { ContextType } from '../types/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 '../types/scenario-context';
|
|
@@ -1,95 +1,96 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.ManagedScenarioContext = void 0;
|
|
21
|
-
const underscore_1 = __importDefault(require("underscore"));
|
|
22
|
-
const scenario_context_1 = require("../types/scenario-context");
|
|
23
|
-
/**
|
|
24
|
-
* Represents a [[ScenarioContext]] implementation that manages a collection of context objects that
|
|
25
|
-
* are created and used by binding classes during a running Cucumber scenario.
|
|
26
|
-
*/
|
|
27
|
-
class ManagedScenarioContext {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.ManagedScenarioContext = void 0;
|
|
21
|
+
const underscore_1 = __importDefault(require("underscore"));
|
|
22
|
+
const scenario_context_1 = require("../types/scenario-context");
|
|
23
|
+
/**
|
|
24
|
+
* Represents a [[ScenarioContext]] implementation that manages a collection of context objects that
|
|
25
|
+
* are created and used by binding classes during a running Cucumber scenario.
|
|
26
|
+
*/
|
|
27
|
+
class ManagedScenarioContext {
|
|
28
|
+
_scenarioInfo;
|
|
29
|
+
_activeObjects = new Map();
|
|
30
|
+
constructor(scenarioTitle, tags) {
|
|
31
|
+
this._scenarioInfo = new scenario_context_1.ScenarioInfo(scenarioTitle, tags);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Gets information about the scenario.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
get scenarioInfo() {
|
|
38
|
+
return this._scenarioInfo;
|
|
39
|
+
}
|
|
40
|
+
getOrActivateBindingClass(targetPrototype, contextTypes) {
|
|
41
|
+
return this.getOrActivateObject(targetPrototype, () => {
|
|
42
|
+
return this.activateBindingClass(targetPrototype, contextTypes);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
dispose() {
|
|
46
|
+
this._activeObjects.forEach((value) => {
|
|
47
|
+
if (typeof value.dispose === 'function') {
|
|
48
|
+
value.dispose();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
activateBindingClass(targetPrototype, contextTypes) {
|
|
53
|
+
const invokeBindingConstructor = (args) => {
|
|
54
|
+
switch (contextTypes.length) {
|
|
55
|
+
case 0:
|
|
56
|
+
return new targetPrototype.constructor();
|
|
57
|
+
case 1:
|
|
58
|
+
return new targetPrototype.constructor(args[0]);
|
|
59
|
+
case 2:
|
|
60
|
+
return new targetPrototype.constructor(args[0], args[1]);
|
|
61
|
+
case 3:
|
|
62
|
+
return new targetPrototype.constructor(args[0], args[1], args[2]);
|
|
63
|
+
case 4:
|
|
64
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3]);
|
|
65
|
+
case 5:
|
|
66
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4]);
|
|
67
|
+
case 6:
|
|
68
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5]);
|
|
69
|
+
case 7:
|
|
70
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
|
71
|
+
case 8:
|
|
72
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
|
73
|
+
case 9:
|
|
74
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
|
|
75
|
+
case 10:
|
|
76
|
+
return new targetPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const contextObjects = underscore_1.default.map(contextTypes, contextType => this.getOrActivateObject(contextType.prototype, () => {
|
|
80
|
+
return new contextType();
|
|
81
|
+
}));
|
|
82
|
+
return invokeBindingConstructor(contextObjects);
|
|
83
|
+
}
|
|
84
|
+
getOrActivateObject(targetPrototype, activatorFunc) {
|
|
85
|
+
let activeObject = this._activeObjects.get(targetPrototype);
|
|
86
|
+
if (activeObject) {
|
|
87
|
+
return activeObject;
|
|
88
|
+
}
|
|
89
|
+
activeObject = activatorFunc();
|
|
90
|
+
this._activeObjects.set(targetPrototype, activeObject);
|
|
91
|
+
return activeObject;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.ManagedScenarioContext = ManagedScenarioContext;
|
|
95
|
+
__exportStar(require("../types/scenario-context"), exports);
|
|
96
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFuYWdlZC1zY2VuYXJpby1jb250ZXh0LmpzIiwic291cmNlUm9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FBYyxDQUFDLENBQUM7SUFDakQsQ0FBQztJQUVPLG1CQUFtQixDQUFDLGVBQW9CLEVBQUUsYUFBc0M7UUFDdkYsSUFBSSxZQUFZLEdBQUcsSUFBSSxDQUFDLGNBQWMsQ0FBQyxHQUFHLENBQUMsZUFBZSxDQUFDLENBQUM7UUFFNUQsSUFBSSxZQUFZLEVBQUU7WUFDakIsT0FBTyxZQUFZLENBQUM7U0FDcEI7UUFFRCxZQUFZLEdBQUcsYUFBYSxFQUFFLENBQUM7UUFFL0IsSUFBSSxDQUFDLGNBQWMsQ0FBQyxHQUFHLENBQUMsZUFBZSxFQUFFLFlBQVksQ0FBQyxDQUFDO1FBRXZELE9BQU8sWUFBWSxDQUFDO0lBQ3JCLENBQUM7Q0FDRDtBQXRIRCx3REFzSEM7QUFFRCw0REFBMEMifQ==
|
|
@@ -1,80 +1,81 @@
|
|
|
1
|
-
import * as messages from '@cucumber/messages';
|
|
2
|
-
import { StepBinding } from '../types/step-binding';
|
|
3
|
-
import { ManagedScenarioContext } from './managed-scenario-context';
|
|
4
|
-
export interface ITestCaseAttempt {
|
|
5
|
-
attempt: number;
|
|
6
|
-
willBeRetried: boolean;
|
|
7
|
-
gherkinDocument: messages.GherkinDocument;
|
|
8
|
-
pickle: messages.Pickle;
|
|
9
|
-
stepAttachments: Record<string, messages.Attachment[]>;
|
|
10
|
-
stepResults: Record<string, messages.TestStepResult>;
|
|
11
|
-
testCase: messages.TestCase;
|
|
12
|
-
worstTestStepResult: messages.TestStepResult;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Custom implementation of the EventDataCollector from cucumber.js
|
|
16
|
-
*
|
|
17
|
-
* This implements all of the functions from the original EventDataCollector along
|
|
18
|
-
* with new functions to support binding to tsFlow tests.
|
|
19
|
-
*
|
|
20
|
-
* By extending the original version we're also reducing the amount of data stored
|
|
21
|
-
* during test runs because the original MessageCollector was capturing the same
|
|
22
|
-
* pickle and testCase data that the EventDataCollector does.
|
|
23
|
-
*/
|
|
24
|
-
export default class MessageCollector {
|
|
25
|
-
private gherkinDocumentMap;
|
|
26
|
-
private pickleMap;
|
|
27
|
-
private testCaseMap;
|
|
28
|
-
private testCaseAttemptDataMap;
|
|
29
|
-
readonly undefinedParameterTypes: messages.UndefinedParameterType[];
|
|
30
|
-
private testCaseRunningMap;
|
|
31
|
-
addPickleAndTestCase(pickle: messages.Pickle, testCase: messages.TestCase): void;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* @
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* @
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
* @
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
import * as messages from '@cucumber/messages';
|
|
2
|
+
import { StepBinding } from '../types/step-binding';
|
|
3
|
+
import { ManagedScenarioContext } from './managed-scenario-context';
|
|
4
|
+
export interface ITestCaseAttempt {
|
|
5
|
+
attempt: number;
|
|
6
|
+
willBeRetried: boolean;
|
|
7
|
+
gherkinDocument: messages.GherkinDocument;
|
|
8
|
+
pickle: messages.Pickle;
|
|
9
|
+
stepAttachments: Record<string, messages.Attachment[]>;
|
|
10
|
+
stepResults: Record<string, messages.TestStepResult>;
|
|
11
|
+
testCase: messages.TestCase;
|
|
12
|
+
worstTestStepResult: messages.TestStepResult;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Custom implementation of the EventDataCollector from cucumber.js
|
|
16
|
+
*
|
|
17
|
+
* This implements all of the functions from the original EventDataCollector along
|
|
18
|
+
* with new functions to support binding to tsFlow tests.
|
|
19
|
+
*
|
|
20
|
+
* By extending the original version we're also reducing the amount of data stored
|
|
21
|
+
* during test runs because the original MessageCollector was capturing the same
|
|
22
|
+
* pickle and testCase data that the EventDataCollector does.
|
|
23
|
+
*/
|
|
24
|
+
export default class MessageCollector {
|
|
25
|
+
private gherkinDocumentMap;
|
|
26
|
+
private pickleMap;
|
|
27
|
+
private testCaseMap;
|
|
28
|
+
private testCaseAttemptDataMap;
|
|
29
|
+
readonly undefinedParameterTypes: messages.UndefinedParameterType[];
|
|
30
|
+
private testCaseRunningMap;
|
|
31
|
+
addPickleAndTestCase(pickle: messages.Pickle, testCase: messages.TestCase): void;
|
|
32
|
+
hasFailures(): boolean;
|
|
33
|
+
getGherkinDocument(uri: string): messages.GherkinDocument;
|
|
34
|
+
getPickle(pickleId: string): messages.Pickle;
|
|
35
|
+
getTestCaseAttempts(): ITestCaseAttempt[];
|
|
36
|
+
getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt;
|
|
37
|
+
parseEnvelope(envelope: messages.Envelope): void;
|
|
38
|
+
private initTestCaseAttempt;
|
|
39
|
+
storeAttachment(attachment: messages.Attachment): void;
|
|
40
|
+
storeTestStepResult({ testCaseStartedId, testStepId, testStepResult }: messages.TestStepFinished): void;
|
|
41
|
+
storeTestCaseResult({ testCaseStartedId, willBeRetried }: messages.TestCaseFinished): void;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the Pickle from hook parameters passed in from Cucumber
|
|
44
|
+
* to find a matching Pickle (scenario) and return the scenario Context
|
|
45
|
+
* @param hookParam
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
getHookScenarioContext(hookParam: any): ManagedScenarioContext | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Uses StepPattern information to find a matching scenario
|
|
51
|
+
* and return the ScenarioContext
|
|
52
|
+
* @param stepBinding
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
getStepScenarioContext(stepBinding: StepBinding): ManagedScenarioContext | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Called when a test case (scenario) starts. Intercepting
|
|
58
|
+
* this message to initialize a new ScenarioContext
|
|
59
|
+
* @param testCaseStarted
|
|
60
|
+
*/
|
|
61
|
+
private startTestCase;
|
|
62
|
+
/**
|
|
63
|
+
* Called when a test case (scenario) ends. Intercepting
|
|
64
|
+
* this message to dispose and clear the ScenarioContext
|
|
65
|
+
* @param testCaseFinished
|
|
66
|
+
*/
|
|
67
|
+
private endTestCase;
|
|
68
|
+
/**
|
|
69
|
+
* Uses the testCaleId passed in to find the associated Pickle (scenario)
|
|
70
|
+
* @param testCaseId
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
private getScenarioForTest;
|
|
74
|
+
/**
|
|
75
|
+
* StepBinding tags are initialized with an astrick when empty.
|
|
76
|
+
* Need to make sure tags has a value and not an astrick
|
|
77
|
+
* @param tags
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
private stepHasTags;
|
|
81
|
+
}
|