@lynxwall/cucumber-tsflow 7.1.1 → 7.1.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/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +4 -2
- package/lib/cli/load-configuration.d.ts +0 -21
- package/lib/cli/load-configuration.js +0 -124
- package/lib/cli/load-configuration.js.map +0 -1
- package/lib/cucumber/coordinator.d.ts +0 -15
- package/lib/cucumber/coordinator.js +0 -40
- package/lib/cucumber/coordinator.js.map +0 -1
- package/lib/cucumber/make-runtime.d.ts +0 -21
- package/lib/cucumber/make-runtime.js +0 -17
- package/lib/cucumber/make-runtime.js.map +0 -1
- package/lib/cucumber/managed-scenario-context.d.ts +0 -52
- package/lib/cucumber/managed-scenario-context.js +0 -149
- package/lib/cucumber/managed-scenario-context.js.map +0 -1
- package/lib/cucumber/message-collector.d.ts +0 -87
- package/lib/cucumber/message-collector.js +0 -280
- package/lib/cucumber/message-collector.js.map +0 -1
- package/lib/cucumber/parallel/adapter.d.ts +0 -46
- package/lib/cucumber/parallel/adapter.js +0 -156
- package/lib/cucumber/parallel/adapter.js.map +0 -1
- package/lib/cucumber/parallel/run-worker.d.ts +0 -1
- package/lib/cucumber/parallel/run-worker.js +0 -24
- package/lib/cucumber/parallel/run-worker.js.map +0 -1
- package/lib/cucumber/parallel/worker.d.ts +0 -26
- package/lib/cucumber/parallel/worker.js +0 -95
- package/lib/cucumber/parallel/worker.js.map +0 -1
- package/lib/cucumber/run-cucumber.d.ts +0 -16
- package/lib/cucumber/run-cucumber.js +0 -139
- package/lib/cucumber/run-cucumber.js.map +0 -1
- package/lib/cucumber/serial/adapter.d.ts +0 -12
- package/lib/cucumber/serial/adapter.js +0 -24
- package/lib/cucumber/serial/adapter.js.map +0 -1
- package/lib/cucumber/test-case-info.d.ts +0 -23
- package/lib/cucumber/test-case-info.js +0 -3
- package/lib/cucumber/test-case-info.js.map +0 -1
- package/lib/cucumber/test-case-runner.d.ts +0 -48
- package/lib/cucumber/test-case-runner.js +0 -359
- package/lib/cucumber/test-case-runner.js.map +0 -1
- package/lib/cucumber/utils.d.ts +0 -16
- package/lib/cucumber/utils.js +0 -78
- package/lib/cucumber/utils.js.map +0 -1
- package/lib/cucumber/worker.d.ts +0 -17
- package/lib/cucumber/worker.js +0 -57
- package/lib/cucumber/worker.js.map +0 -1
- package/lib/formatters/behave-json-formatter.d.ts +0 -49
- package/lib/formatters/behave-json-formatter.js +0 -85
- package/lib/formatters/behave-json-formatter.js.map +0 -1
- package/lib/formatters/junit-bamboo-formatter.d.ts +0 -17
- package/lib/formatters/junit-bamboo-formatter.js +0 -175
- package/lib/formatters/junit-bamboo-formatter.js.map +0 -1
- package/lib/formatters/tsflow-snippet-syntax.d.ts +0 -9
- package/lib/formatters/tsflow-snippet-syntax.js +0 -89
- package/lib/formatters/tsflow-snippet-syntax.js.map +0 -1
- package/lib/types/parallel.d.ts +0 -11
- package/lib/types/parallel.js +0 -3
- package/lib/types/parallel.js.map +0 -1
- package/lib/types/scenario-context.d.ts +0 -16
- package/lib/types/scenario-context.js +0 -18
- package/lib/types/scenario-context.js.map +0 -1
- package/lib/types/scenario-info.d.ts +0 -16
- package/lib/types/scenario-info.js +0 -23
- package/lib/types/scenario-info.js.map +0 -1
- package/lib/types/step-binding-flags.d.ts +0 -53
- package/lib/types/step-binding-flags.js +0 -59
- package/lib/types/step-binding-flags.js.map +0 -1
- package/lib/types/step-binding.d.ts +0 -60
- package/lib/types/step-binding.js +0 -18
- package/lib/types/step-binding.js.map +0 -1
- package/lib/types/types.d.ts +0 -22
- package/lib/types/types.js +0 -3
- package/lib/types/types.js.map +0 -1
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "7.1.
|
|
1
|
+
export declare const version = "7.1.2";
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '7.1.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '7.1.2'\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynxwall/cucumber-tsflow",
|
|
3
3
|
"description": "Provides 'specflow' like bindings for CucumberJS 11.2.0 in TypeScript 5.8+.",
|
|
4
|
-
"version": "7.1.
|
|
4
|
+
"version": "7.1.2",
|
|
5
5
|
"author": "Lonnie Wall <lynxdev@lynxwall.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -88,7 +88,9 @@
|
|
|
88
88
|
"build": "genversion --es6 src/version.ts && tsc --build tsconfig.node.json && shx cp src/wrapper.mjs lib/ && shx cp src/api/wrapper.mjs lib/api/",
|
|
89
89
|
"build:watch": "tsc --build tsconfig.node.json --watch"
|
|
90
90
|
},
|
|
91
|
-
"bin":
|
|
91
|
+
"bin": {
|
|
92
|
+
"cucumber-tsflow": "bin/cucumber-tsflow.js"
|
|
93
|
+
},
|
|
92
94
|
"files": [
|
|
93
95
|
"api/",
|
|
94
96
|
"bin/",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ILoadConfigurationOptions, IRunConfiguration } from '@cucumber/cucumber/lib/api/types';
|
|
2
|
-
import { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';
|
|
3
|
-
import { ITsflowConfiguration } from './argv-parser';
|
|
4
|
-
export interface ITsflowResolvedConfiguration {
|
|
5
|
-
/**
|
|
6
|
-
* The final flat configuration object resolved from the configuration file/profiles plus any extra provided.
|
|
7
|
-
*/
|
|
8
|
-
useConfiguration: ITsflowConfiguration;
|
|
9
|
-
/**
|
|
10
|
-
* The format that can be passed into `runCucumber`.
|
|
11
|
-
*/
|
|
12
|
-
runConfiguration: IRunConfiguration;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Load user-authored configuration to be used in a test run.
|
|
16
|
-
*
|
|
17
|
-
* @public
|
|
18
|
-
* @param options - Coordinates required to find configuration.
|
|
19
|
-
* @param environment - Project environment.
|
|
20
|
-
*/
|
|
21
|
-
export declare const loadConfiguration: (options?: ILoadConfigurationOptions, environment?: IRunEnvironment) => Promise<ITsflowResolvedConfiguration>;
|
|
@@ -1,124 +0,0 @@
|
|
|
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.loadConfiguration = void 0;
|
|
7
|
-
const locate_file_1 = require("@cucumber/cucumber/lib/configuration/locate_file");
|
|
8
|
-
const index_1 = require("@cucumber/cucumber/lib/configuration/index");
|
|
9
|
-
const validate_configuration_1 = require("@cucumber/cucumber/lib/configuration/validate_configuration");
|
|
10
|
-
const convert_configuration_1 = require("@cucumber/cucumber/lib/api/convert_configuration");
|
|
11
|
-
const index_2 = require("@cucumber/cucumber/lib/environment/index");
|
|
12
|
-
const helpers_1 = require("../utils/helpers");
|
|
13
|
-
const gherkin_manager_1 = __importDefault(require("../gherkin/gherkin-manager"));
|
|
14
|
-
const ansis_1 = __importDefault(require("ansis"));
|
|
15
|
-
/**
|
|
16
|
-
* Load user-authored configuration to be used in a test run.
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
19
|
-
* @param options - Coordinates required to find configuration.
|
|
20
|
-
* @param environment - Project environment.
|
|
21
|
-
*/
|
|
22
|
-
const loadConfiguration = async (options = {}, environment = {}) => {
|
|
23
|
-
const { cwd, env, logger } = (0, index_2.makeEnvironment)(environment);
|
|
24
|
-
const configFile = options.file ?? (0, locate_file_1.locateFile)(cwd);
|
|
25
|
-
if (configFile) {
|
|
26
|
-
logger.debug(`Configuration will be loaded from "${configFile}"`);
|
|
27
|
-
}
|
|
28
|
-
else if (configFile === false) {
|
|
29
|
-
logger.debug('Skipping configuration file resolution');
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
logger.debug('No configuration file found');
|
|
33
|
-
}
|
|
34
|
-
const profileConfiguration = configFile ? await (0, index_1.fromFile)(logger, cwd, configFile, options.profiles) : {};
|
|
35
|
-
// if a feature was passed in on command line it's added
|
|
36
|
-
// to the provided configuration as paths. We need to clear
|
|
37
|
-
// any paths from configuration so that only the feature passed
|
|
38
|
-
// in is executed.
|
|
39
|
-
const paths = options.provided.paths;
|
|
40
|
-
if (paths && paths?.length > 0) {
|
|
41
|
-
profileConfiguration.paths = [];
|
|
42
|
-
}
|
|
43
|
-
const original = (0, index_1.mergeConfigurations)(index_1.DEFAULT_CONFIGURATION, profileConfiguration, (0, index_1.parseConfiguration)(logger, 'Provided', options.provided));
|
|
44
|
-
switch (original.transpiler) {
|
|
45
|
-
case 'esvue':
|
|
46
|
-
original.requireModule.push('@lynxwall/cucumber-tsflow/lib/esvue');
|
|
47
|
-
break;
|
|
48
|
-
case 'tsvue':
|
|
49
|
-
original.requireModule.push('@lynxwall/cucumber-tsflow/lib/tsvue');
|
|
50
|
-
break;
|
|
51
|
-
case 'tsnode':
|
|
52
|
-
original.requireModule.push('@lynxwall/cucumber-tsflow/lib/tsnode');
|
|
53
|
-
break;
|
|
54
|
-
default:
|
|
55
|
-
// defaulting to esbuild
|
|
56
|
-
original.requireModule.push('@lynxwall/cucumber-tsflow/lib/esnode');
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
// set the snippet syntax
|
|
60
|
-
if (!original.formatOptions.snippetSyntax) {
|
|
61
|
-
original.formatOptions.snippetSyntax = '@lynxwall/cucumber-tsflow/lib/snippet.js';
|
|
62
|
-
}
|
|
63
|
-
// look for behave format
|
|
64
|
-
for (let idx = 0; idx < original.format.length; idx++) {
|
|
65
|
-
if (typeof original.format[idx] === 'string') {
|
|
66
|
-
const formatItem = original.format[idx];
|
|
67
|
-
if (formatItem.startsWith('behave:')) {
|
|
68
|
-
original.format[idx] = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/lib/behave.js');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else if (original.format[idx].length > 0) {
|
|
72
|
-
const formatItem = original.format[idx][0];
|
|
73
|
-
if (formatItem.startsWith('behave')) {
|
|
74
|
-
const newVal = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/lib/behave.js');
|
|
75
|
-
original.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// look for junitbamboo format
|
|
80
|
-
for (let idx = 0; idx < original.format.length; idx++) {
|
|
81
|
-
if (typeof original.format[idx] === 'string') {
|
|
82
|
-
const formatItem = original.format[idx];
|
|
83
|
-
if (formatItem.startsWith('junitbamboo:')) {
|
|
84
|
-
original.format[idx] = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/lib/junitbamboo.js');
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
else if (original.format[idx].length > 0) {
|
|
88
|
-
const formatItem = original.format[idx][0];
|
|
89
|
-
if (formatItem.startsWith('junitbamboo')) {
|
|
90
|
-
const newVal = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/lib/junitbamboo.js');
|
|
91
|
-
original.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
// check to see if a debugFile was passed in
|
|
96
|
-
if ((0, helpers_1.hasStringValue)(original.debugFile)) {
|
|
97
|
-
// Initialize gherkin manager with path to feature files
|
|
98
|
-
const gherkin = new gherkin_manager_1.default();
|
|
99
|
-
await gherkin.loadFeatures(original.paths);
|
|
100
|
-
const features = gherkin.findFeaturesByStepFile(original.debugFile);
|
|
101
|
-
if (features.length > 0) {
|
|
102
|
-
original.paths = [];
|
|
103
|
-
features.forEach(x => original.paths.push(x.featureFile));
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
// log a message if the feature path is not found
|
|
107
|
-
logger.warn(ansis_1.default.yellow(`\nUnable to find feature for debugFile: ${original.debugFile}`));
|
|
108
|
-
logger.warn(ansis_1.default.yellow('All tests will be executed\n'));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
// check to see if enable-vue-style was set
|
|
112
|
-
// if not, default it to false
|
|
113
|
-
if (original.enableVueStyle === null || original.enableVueStyle === undefined) {
|
|
114
|
-
original.enableVueStyle = false;
|
|
115
|
-
}
|
|
116
|
-
(0, validate_configuration_1.validateConfiguration)(original, logger);
|
|
117
|
-
const runnable = await (0, convert_configuration_1.convertConfiguration)(logger, original, env);
|
|
118
|
-
return {
|
|
119
|
-
useConfiguration: original,
|
|
120
|
-
runConfiguration: runnable
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
exports.loadConfiguration = loadConfiguration;
|
|
124
|
-
//# sourceMappingURL=load-configuration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-configuration.js","sourceRoot":"","sources":["../../src/cli/load-configuration.ts"],"names":[],"mappings":";;;;;;AACA,kFAA8E;AAC9E,sEAMoD;AACpD,wGAAoG;AACpG,4FAAwF;AACxF,oEAA4F;AAE5F,8CAAkD;AAClD,iFAAwD;AACxD,kDAA0B;AAa1B;;;;;;GAMG;AACI,MAAM,iBAAiB,GAAG,KAAK,EACrC,UAAqC,EAAE,EACvC,cAA+B,EAAE,EACO,EAAE;IAC1C,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,uBAAe,EAAC,WAAW,CAA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IRunConfiguration } from '@cucumber/cucumber/lib/api/types';\r\nimport { locateFile } from '@cucumber/cucumber/lib/configuration/locate_file';\r\nimport {\r\n\tDEFAULT_CONFIGURATION,\r\n\tfromFile,\r\n\tIConfiguration,\r\n\tparseConfiguration,\r\n\tmergeConfigurations\r\n} from '@cucumber/cucumber/lib/configuration/index';\r\nimport { validateConfiguration } from '@cucumber/cucumber/lib/configuration/validate_configuration';\r\nimport { convertConfiguration } from '@cucumber/cucumber/lib/api/convert_configuration';\r\nimport { IRunEnvironment, makeEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { ITsflowConfiguration } from './argv-parser';\r\nimport { hasStringValue } from '../utils/helpers';\r\nimport GherkinManager from '../gherkin/gherkin-manager';\r\nimport chalk from 'ansis';\r\n\r\nexport interface ITsflowResolvedConfiguration {\r\n\t/**\r\n\t * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.\r\n\t */\r\n\tuseConfiguration: ITsflowConfiguration;\r\n\t/**\r\n\t * The format that can be passed into `runCucumber`.\r\n\t */\r\n\trunConfiguration: IRunConfiguration;\r\n}\r\n\r\n/**\r\n * Load user-authored configuration to be used in a test run.\r\n *\r\n * @public\r\n * @param options - Coordinates required to find configuration.\r\n * @param environment - Project environment.\r\n */\r\nexport const loadConfiguration = async (\r\n\toptions: ILoadConfigurationOptions = {},\r\n\tenvironment: IRunEnvironment = {}\r\n): Promise<ITsflowResolvedConfiguration> => {\r\n\tconst { cwd, env, logger } = makeEnvironment(environment);\r\n\tconst configFile = options.file ?? locateFile(cwd);\r\n\tif (configFile) {\r\n\t\tlogger.debug(`Configuration will be loaded from \"${configFile}\"`);\r\n\t} else if (configFile === false) {\r\n\t\tlogger.debug('Skipping configuration file resolution');\r\n\t} else {\r\n\t\tlogger.debug('No configuration file found');\r\n\t}\r\n\tconst profileConfiguration = configFile ? await fromFile(logger, cwd, configFile, options.profiles) : {};\r\n\r\n\t// if a feature was passed in on command line it's added\r\n\t// to the provided configuration as paths. We need to clear\r\n\t// any paths from configuration so that only the feature passed\r\n\t// in is executed.\r\n\tconst paths = (options.provided as Partial<IConfiguration>).paths;\r\n\tif (paths && paths?.length > 0) {\r\n\t\tprofileConfiguration.paths = [];\r\n\t}\r\n\r\n\tconst original = mergeConfigurations(\r\n\t\tDEFAULT_CONFIGURATION,\r\n\t\tprofileConfiguration,\r\n\t\tparseConfiguration(logger, 'Provided', options.provided)\r\n\t) as ITsflowConfiguration;\r\n\r\n\tswitch (original.transpiler) {\r\n\t\tcase 'esvue':\r\n\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/esvue');\r\n\t\t\tbreak;\r\n\t\tcase 'tsvue':\r\n\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/tsvue');\r\n\t\t\tbreak;\r\n\t\tcase 'tsnode':\r\n\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/tsnode');\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t// defaulting to esbuild\r\n\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/esnode');\r\n\t\t\tbreak;\r\n\t}\r\n\t// set the snippet syntax\r\n\tif (!original.formatOptions.snippetSyntax) {\r\n\t\toriginal.formatOptions.snippetSyntax = '@lynxwall/cucumber-tsflow/lib/snippet.js';\r\n\t}\r\n\t// look for behave format\r\n\tfor (let idx = 0; idx < original.format.length; idx++) {\r\n\t\tif (typeof original.format[idx] === 'string') {\r\n\t\t\tconst formatItem = original.format[idx] as string;\r\n\t\t\tif (formatItem.startsWith('behave:')) {\r\n\t\t\t\toriginal.format[idx] = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/lib/behave.js');\r\n\t\t\t}\r\n\t\t} else if (original.format[idx].length > 0) {\r\n\t\t\tconst formatItem = original.format[idx][0] as string;\r\n\t\t\tif (formatItem.startsWith('behave')) {\r\n\t\t\t\tconst newVal = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/lib/behave.js');\r\n\t\t\t\toriginal.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// look for junitbamboo format\r\n\tfor (let idx = 0; idx < original.format.length; idx++) {\r\n\t\tif (typeof original.format[idx] === 'string') {\r\n\t\t\tconst formatItem = original.format[idx] as string;\r\n\t\t\tif (formatItem.startsWith('junitbamboo:')) {\r\n\t\t\t\toriginal.format[idx] = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/lib/junitbamboo.js');\r\n\t\t\t}\r\n\t\t} else if (original.format[idx].length > 0) {\r\n\t\t\tconst formatItem = original.format[idx][0] as string;\r\n\t\t\tif (formatItem.startsWith('junitbamboo')) {\r\n\t\t\t\tconst newVal = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/lib/junitbamboo.js');\r\n\t\t\t\toriginal.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// check to see if a debugFile was passed in\r\n\tif (hasStringValue(original.debugFile)) {\r\n\t\t// Initialize gherkin manager with path to feature files\r\n\t\tconst gherkin = new GherkinManager();\r\n\t\tawait gherkin.loadFeatures(original.paths);\r\n\t\tconst features = gherkin.findFeaturesByStepFile(original.debugFile);\r\n\t\tif (features.length > 0) {\r\n\t\t\toriginal.paths = [];\r\n\t\t\tfeatures.forEach(x => original.paths.push(x.featureFile));\r\n\t\t} else {\r\n\t\t\t// log a message if the feature path is not found\r\n\t\t\tlogger.warn(chalk.yellow(`\\nUnable to find feature for debugFile: ${original.debugFile}`));\r\n\t\t\tlogger.warn(chalk.yellow('All tests will be executed\\n'));\r\n\t\t}\r\n\t}\r\n\r\n\t// check to see if enable-vue-style was set\r\n\t// if not, default it to false\r\n\tif (original.enableVueStyle === null || original.enableVueStyle === undefined) {\r\n\t\toriginal.enableVueStyle = false;\r\n\t}\r\n\r\n\tvalidateConfiguration(original, logger);\r\n\tconst runnable = await convertConfiguration(logger, original, env);\r\n\treturn {\r\n\t\tuseConfiguration: original,\r\n\t\trunConfiguration: runnable\r\n\t};\r\n};\r\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
import { IdGenerator } from '@cucumber/messages';
|
|
3
|
-
import { SourcedPickle } from '@cucumber/cucumber/lib/assemble/index';
|
|
4
|
-
import { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';
|
|
5
|
-
import { RuntimeAdapter } from '@cucumber/cucumber/lib/runtime/types';
|
|
6
|
-
import { Runtime } from '@cucumber/cucumber/lib/runtime/index';
|
|
7
|
-
export declare class Coordinator implements Runtime {
|
|
8
|
-
private eventBroadcaster;
|
|
9
|
-
private newId;
|
|
10
|
-
private sourcedPickles;
|
|
11
|
-
private supportCodeLibrary;
|
|
12
|
-
private adapter;
|
|
13
|
-
constructor(eventBroadcaster: EventEmitter, newId: IdGenerator.NewId, sourcedPickles: ReadonlyArray<SourcedPickle>, supportCodeLibrary: SupportCodeLibrary, adapter: RuntimeAdapter);
|
|
14
|
-
run(): Promise<boolean>;
|
|
15
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Coordinator = void 0;
|
|
4
|
-
const index_1 = require("@cucumber/cucumber/lib/assemble/index");
|
|
5
|
-
const stopwatch_1 = require("@cucumber/cucumber/lib/runtime/stopwatch");
|
|
6
|
-
class Coordinator {
|
|
7
|
-
eventBroadcaster;
|
|
8
|
-
newId;
|
|
9
|
-
sourcedPickles;
|
|
10
|
-
supportCodeLibrary;
|
|
11
|
-
adapter;
|
|
12
|
-
constructor(eventBroadcaster, newId, sourcedPickles, supportCodeLibrary, adapter) {
|
|
13
|
-
this.eventBroadcaster = eventBroadcaster;
|
|
14
|
-
this.newId = newId;
|
|
15
|
-
this.sourcedPickles = sourcedPickles;
|
|
16
|
-
this.supportCodeLibrary = supportCodeLibrary;
|
|
17
|
-
this.adapter = adapter;
|
|
18
|
-
}
|
|
19
|
-
async run() {
|
|
20
|
-
const testRunStartedId = this.newId();
|
|
21
|
-
this.eventBroadcaster.emit('envelope', {
|
|
22
|
-
testRunStarted: {
|
|
23
|
-
id: testRunStartedId,
|
|
24
|
-
timestamp: (0, stopwatch_1.timestamp)(),
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
const assembledTestCases = await (0, index_1.assembleTestCases)(testRunStartedId, this.eventBroadcaster, this.newId, this.sourcedPickles, this.supportCodeLibrary);
|
|
28
|
-
const success = await this.adapter.run(assembledTestCases);
|
|
29
|
-
this.eventBroadcaster.emit('envelope', {
|
|
30
|
-
testRunFinished: {
|
|
31
|
-
testRunStartedId,
|
|
32
|
-
timestamp: (0, stopwatch_1.timestamp)(),
|
|
33
|
-
success,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
return success;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.Coordinator = Coordinator;
|
|
40
|
-
//# sourceMappingURL=coordinator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/cucumber/coordinator.ts"],"names":[],"mappings":";;;AAEA,iEAAwF;AAGxF,wEAAoE;AAGpE,MAAa,WAAW;IAEZ;IACA;IACA;IACA;IACA;IALV,YACU,gBAA8B,EAC9B,KAAwB,EACxB,cAA4C,EAC5C,kBAAsC,EACtC,OAAuB;QAJvB,qBAAgB,GAAhB,gBAAgB,CAAc;QAC9B,UAAK,GAAL,KAAK,CAAmB;QACxB,mBAAc,GAAd,cAAc,CAA8B;QAC5C,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,YAAO,GAAP,OAAO,CAAgB;IAC9B,CAAC;IAEJ,KAAK,CAAC,GAAG;QACP,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,EAAE,CAAA;QAErC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACrC,cAAc,EAAE;gBACd,EAAE,EAAE,gBAAgB;gBACpB,SAAS,EAAE,IAAA,qBAAS,GAAE;aACvB;SACiB,CAAC,CAAA;QAErB,MAAM,kBAAkB,GAAG,MAAM,IAAA,yBAAiB,EAChD,gBAAgB,EAChB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,kBAAkB,CACxB,CAAA;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;QAE1D,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACrC,eAAe,EAAE;gBACf,gBAAgB;gBAChB,SAAS,EAAE,IAAA,qBAAS,GAAE;gBACtB,OAAO;aACR;SACiB,CAAC,CAAA;QAErB,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAvCD,kCAuCC","sourcesContent":["import { EventEmitter } from 'node:events'\r\nimport { Envelope, IdGenerator } from '@cucumber/messages'\r\nimport { assembleTestCases, SourcedPickle } from '@cucumber/cucumber/lib/assemble/index'\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types'\r\nimport { RuntimeAdapter } from '@cucumber/cucumber/lib/runtime/types'\r\nimport { timestamp } from '@cucumber/cucumber/lib/runtime/stopwatch'\r\nimport { Runtime } from '@cucumber/cucumber/lib/runtime/index'\r\n\r\nexport class Coordinator implements Runtime {\r\n constructor(\r\n private eventBroadcaster: EventEmitter,\r\n private newId: IdGenerator.NewId,\r\n private sourcedPickles: ReadonlyArray<SourcedPickle>,\r\n private supportCodeLibrary: SupportCodeLibrary,\r\n private adapter: RuntimeAdapter\r\n ) {}\r\n\r\n async run(): Promise<boolean> {\r\n const testRunStartedId = this.newId()\r\n\r\n this.eventBroadcaster.emit('envelope', {\r\n testRunStarted: {\r\n id: testRunStartedId,\r\n timestamp: timestamp(),\r\n },\r\n } satisfies Envelope)\r\n\r\n const assembledTestCases = await assembleTestCases(\r\n testRunStartedId,\r\n this.eventBroadcaster,\r\n this.newId,\r\n this.sourcedPickles,\r\n this.supportCodeLibrary\r\n )\r\n\r\n const success = await this.adapter.run(assembledTestCases)\r\n\r\n this.eventBroadcaster.emit('envelope', {\r\n testRunFinished: {\r\n testRunStartedId,\r\n timestamp: timestamp(),\r\n success,\r\n },\r\n } satisfies Envelope)\r\n\r\n return success\r\n }\r\n}\r\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
import { IdGenerator } from '@cucumber/messages';
|
|
3
|
-
import { IRunOptionsRuntime } from '@cucumber/cucumber/lib/api/index';
|
|
4
|
-
import { ILogger } from '@cucumber/cucumber/lib/environment/index';
|
|
5
|
-
import { SourcedPickle } from '@cucumber/cucumber/lib/assemble/index';
|
|
6
|
-
import { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';
|
|
7
|
-
import { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index';
|
|
8
|
-
import { Runtime } from '@cucumber/cucumber/lib/runtime/types';
|
|
9
|
-
/**
|
|
10
|
-
* Extending this function from cucumber.js to use our own implementation
|
|
11
|
-
* of the Coordinator.
|
|
12
|
-
*/
|
|
13
|
-
export declare function makeRuntime({ environment, logger, eventBroadcaster, sourcedPickles, newId, supportCodeLibrary, options, }: {
|
|
14
|
-
environment: IRunEnvironment;
|
|
15
|
-
logger: ILogger;
|
|
16
|
-
eventBroadcaster: EventEmitter;
|
|
17
|
-
newId: IdGenerator.NewId;
|
|
18
|
-
sourcedPickles: ReadonlyArray<SourcedPickle>;
|
|
19
|
-
supportCodeLibrary: SupportCodeLibrary;
|
|
20
|
-
options: IRunOptionsRuntime;
|
|
21
|
-
}): Promise<Runtime>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeRuntime = makeRuntime;
|
|
4
|
-
const adapter_1 = require("./parallel/adapter");
|
|
5
|
-
const adapter_2 = require("./serial/adapter");
|
|
6
|
-
const coordinator_1 = require("./coordinator");
|
|
7
|
-
/**
|
|
8
|
-
* Extending this function from cucumber.js to use our own implementation
|
|
9
|
-
* of the Coordinator.
|
|
10
|
-
*/
|
|
11
|
-
async function makeRuntime({ environment, logger, eventBroadcaster, sourcedPickles, newId, supportCodeLibrary, options, }) {
|
|
12
|
-
const adapter = options.parallel > 0
|
|
13
|
-
? new adapter_1.ChildProcessAdapter(environment, logger, eventBroadcaster, options, supportCodeLibrary)
|
|
14
|
-
: new adapter_2.InProcessAdapter(eventBroadcaster, newId, options, supportCodeLibrary);
|
|
15
|
-
return new coordinator_1.Coordinator(eventBroadcaster, newId, sourcedPickles, supportCodeLibrary, adapter);
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=make-runtime.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"make-runtime.js","sourceRoot":"","sources":["../../src/cucumber/make-runtime.ts"],"names":[],"mappings":";;AAgBA,kCAuCC;AA/CD,gDAAwD;AACxD,8CAAmD;AACnD,+CAA2C;AAE3C;;;GAGG;AACI,KAAK,UAAU,WAAW,CAAC,EAChC,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,kBAAkB,EAClB,OAAO,GASR;IACC,MAAM,OAAO,GACX,OAAO,CAAC,QAAQ,GAAG,CAAC;QAClB,CAAC,CAAC,IAAI,6BAAmB,CACrB,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,kBAAkB,CACnB;QACH,CAAC,CAAC,IAAI,0BAAgB,CAClB,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,kBAAkB,CACnB,CAAA;IACP,OAAO,IAAI,yBAAW,CACpB,gBAAgB,EAChB,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,OAAO,CACR,CAAA;AACH,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\r\nimport { IdGenerator } from '@cucumber/messages'\r\nimport { IRunOptionsRuntime } from '@cucumber/cucumber/lib/api/index'\r\nimport { ILogger } from '@cucumber/cucumber/lib/environment/index'\r\nimport { SourcedPickle } from '@cucumber/cucumber/lib/assemble/index'\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types'\r\nimport { IRunEnvironment } from '@cucumber/cucumber/lib/environment/index'\r\nimport { Runtime, RuntimeAdapter } from '@cucumber/cucumber/lib/runtime/types'\r\nimport { ChildProcessAdapter } from './parallel/adapter'\r\nimport { InProcessAdapter } from './serial/adapter'\r\nimport { Coordinator } from './coordinator'\r\n\r\n/**\r\n * Extending this function from cucumber.js to use our own implementation\r\n * of the Coordinator.\r\n */\r\nexport async function makeRuntime({\r\n environment,\r\n logger,\r\n eventBroadcaster,\r\n sourcedPickles,\r\n newId,\r\n supportCodeLibrary,\r\n options,\r\n}: {\r\n environment: IRunEnvironment\r\n logger: ILogger\r\n eventBroadcaster: EventEmitter\r\n newId: IdGenerator.NewId\r\n sourcedPickles: ReadonlyArray<SourcedPickle>\r\n supportCodeLibrary: SupportCodeLibrary\r\n options: IRunOptionsRuntime\r\n}): Promise<Runtime> {\r\n const adapter: RuntimeAdapter =\r\n options.parallel > 0\r\n ? new ChildProcessAdapter(\r\n environment,\r\n logger,\r\n eventBroadcaster,\r\n options,\r\n supportCodeLibrary\r\n )\r\n : new InProcessAdapter(\r\n eventBroadcaster,\r\n newId,\r\n options,\r\n supportCodeLibrary\r\n )\r\n return new Coordinator(\r\n eventBroadcaster,\r\n newId,\r\n sourcedPickles,\r\n supportCodeLibrary,\r\n adapter\r\n )\r\n}\r\n"]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ContextType } from '../types/types';
|
|
2
|
-
import { ScenarioContext, ScenarioInfo } from '../types/scenario-context';
|
|
3
|
-
import { EndTestCaseInfo, StartTestCaseInfo } from './test-case-info';
|
|
4
|
-
import { World } from '@cucumber/cucumber';
|
|
5
|
-
/**
|
|
6
|
-
* Represents a [[ScenarioContext]] implementation that manages a collection of context objects that
|
|
7
|
-
* are created and used by binding classes during a running Cucumber scenario.
|
|
8
|
-
*/
|
|
9
|
-
export declare class ManagedScenarioContext implements ScenarioContext {
|
|
10
|
-
private _scenarioInfo;
|
|
11
|
-
private _activeObjects;
|
|
12
|
-
constructor(scenarioTitle: string, tags: string[]);
|
|
13
|
-
/**
|
|
14
|
-
* Gets information about the scenario.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
get scenarioInfo(): ScenarioInfo;
|
|
18
|
-
getOrActivateBindingClass(classPrototype: any, contextTypes: ContextType[], worldObj: World): any;
|
|
19
|
-
/**
|
|
20
|
-
* If context objects are passed into our step, this function will
|
|
21
|
-
* call initialize on the context objects only once.
|
|
22
|
-
* Using Promise.resolve so that initialize can be synchronous or async.
|
|
23
|
-
*/
|
|
24
|
-
initialize(startTestCase: StartTestCaseInfo): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* All objects support dispose, which is executed when a
|
|
27
|
-
* test run is ended. Using Promise.resolve to support
|
|
28
|
-
* synchronous or async functions.
|
|
29
|
-
*/
|
|
30
|
-
dispose(endTestCase: EndTestCaseInfo): Promise<void>;
|
|
31
|
-
private activateBindingClass;
|
|
32
|
-
/**
|
|
33
|
-
* Get or activate any object
|
|
34
|
-
*
|
|
35
|
-
* @param classPrototype prototype for the object
|
|
36
|
-
* @param activatorFunc callback function used to create an instance of the object
|
|
37
|
-
* @param optional optional parameter passed into constructors
|
|
38
|
-
* @returns
|
|
39
|
-
*/
|
|
40
|
-
private getOrActivateObject;
|
|
41
|
-
/**
|
|
42
|
-
* Get or activate Context objects. Marks an object as a context
|
|
43
|
-
* object in ActiveInfo to let the system know it supports an initialize function.
|
|
44
|
-
*
|
|
45
|
-
* @param classPrototype prototype for the object
|
|
46
|
-
* @param activatorFunc callback function used to create an instance of the object
|
|
47
|
-
* @param optional optional parameter passed into constructors
|
|
48
|
-
* @returns
|
|
49
|
-
*/
|
|
50
|
-
private getOrActivateContext;
|
|
51
|
-
}
|
|
52
|
-
export * from '../types/scenario-context';
|
|
@@ -1,149 +0,0 @@
|
|
|
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
|
-
class ActiveInfo {
|
|
24
|
-
constructor(obj, isContext = false) {
|
|
25
|
-
this.activeObject = obj;
|
|
26
|
-
this.isContext = isContext;
|
|
27
|
-
}
|
|
28
|
-
activeObject;
|
|
29
|
-
isContext;
|
|
30
|
-
initialized = false;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Represents a [[ScenarioContext]] implementation that manages a collection of context objects that
|
|
34
|
-
* are created and used by binding classes during a running Cucumber scenario.
|
|
35
|
-
*/
|
|
36
|
-
class ManagedScenarioContext {
|
|
37
|
-
_scenarioInfo;
|
|
38
|
-
_activeObjects = new Map();
|
|
39
|
-
constructor(scenarioTitle, tags) {
|
|
40
|
-
this._scenarioInfo = new scenario_context_1.ScenarioInfo(scenarioTitle, tags);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Gets information about the scenario.
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
get scenarioInfo() {
|
|
47
|
-
return this._scenarioInfo;
|
|
48
|
-
}
|
|
49
|
-
getOrActivateBindingClass(classPrototype, contextTypes, worldObj) {
|
|
50
|
-
return this.getOrActivateObject(classPrototype, () => {
|
|
51
|
-
return this.activateBindingClass(classPrototype, contextTypes, worldObj);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* If context objects are passed into our step, this function will
|
|
56
|
-
* call initialize on the context objects only once.
|
|
57
|
-
* Using Promise.resolve so that initialize can be synchronous or async.
|
|
58
|
-
*/
|
|
59
|
-
async initialize(startTestCase) {
|
|
60
|
-
for (const [_key, value] of this._activeObjects) {
|
|
61
|
-
if (value.isContext && !value.initialized && typeof value.activeObject.initialize === 'function') {
|
|
62
|
-
await Promise.resolve(value.activeObject.initialize(startTestCase));
|
|
63
|
-
value.initialized = true;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* All objects support dispose, which is executed when a
|
|
69
|
-
* test run is ended. Using Promise.resolve to support
|
|
70
|
-
* synchronous or async functions.
|
|
71
|
-
*/
|
|
72
|
-
async dispose(endTestCase) {
|
|
73
|
-
for (const [_key, value] of this._activeObjects) {
|
|
74
|
-
if (typeof value.activeObject.dispose === 'function') {
|
|
75
|
-
await Promise.resolve(value.activeObject.dispose(endTestCase));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
activateBindingClass(classPrototype, contextTypes, worldObj) {
|
|
80
|
-
const invokeBindingConstructor = (args) => {
|
|
81
|
-
switch (contextTypes.length) {
|
|
82
|
-
case 0:
|
|
83
|
-
return new classPrototype.constructor();
|
|
84
|
-
case 1:
|
|
85
|
-
return new classPrototype.constructor(args[0]);
|
|
86
|
-
case 2:
|
|
87
|
-
return new classPrototype.constructor(args[0], args[1]);
|
|
88
|
-
case 3:
|
|
89
|
-
return new classPrototype.constructor(args[0], args[1], args[2]);
|
|
90
|
-
case 4:
|
|
91
|
-
return new classPrototype.constructor(args[0], args[1], args[2], args[3]);
|
|
92
|
-
case 5:
|
|
93
|
-
return new classPrototype.constructor(args[0], args[1], args[2], args[3], args[4]);
|
|
94
|
-
case 6:
|
|
95
|
-
return new classPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5]);
|
|
96
|
-
case 7:
|
|
97
|
-
return new classPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
|
98
|
-
case 8:
|
|
99
|
-
return new classPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
|
100
|
-
case 9:
|
|
101
|
-
return new classPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
|
|
102
|
-
case 10:
|
|
103
|
-
return new classPrototype.constructor(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const contextObjects = underscore_1.default.map(contextTypes, contextType => this.getOrActivateContext(contextType.prototype, (worldObj) => {
|
|
107
|
-
return new contextType(worldObj);
|
|
108
|
-
}, worldObj));
|
|
109
|
-
return invokeBindingConstructor(contextObjects);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Get or activate any object
|
|
113
|
-
*
|
|
114
|
-
* @param classPrototype prototype for the object
|
|
115
|
-
* @param activatorFunc callback function used to create an instance of the object
|
|
116
|
-
* @param optional optional parameter passed into constructors
|
|
117
|
-
* @returns
|
|
118
|
-
*/
|
|
119
|
-
getOrActivateObject(classPrototype, activatorFunc, optional) {
|
|
120
|
-
let activeObject = this._activeObjects.get(classPrototype)?.activeObject;
|
|
121
|
-
if (activeObject) {
|
|
122
|
-
return activeObject;
|
|
123
|
-
}
|
|
124
|
-
activeObject = activatorFunc(optional);
|
|
125
|
-
this._activeObjects.set(classPrototype, new ActiveInfo(activeObject));
|
|
126
|
-
return activeObject;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Get or activate Context objects. Marks an object as a context
|
|
130
|
-
* object in ActiveInfo to let the system know it supports an initialize function.
|
|
131
|
-
*
|
|
132
|
-
* @param classPrototype prototype for the object
|
|
133
|
-
* @param activatorFunc callback function used to create an instance of the object
|
|
134
|
-
* @param optional optional parameter passed into constructors
|
|
135
|
-
* @returns
|
|
136
|
-
*/
|
|
137
|
-
getOrActivateContext(classPrototype, activatorFunc, optional) {
|
|
138
|
-
let activeObject = this._activeObjects.get(classPrototype)?.activeObject;
|
|
139
|
-
if (activeObject) {
|
|
140
|
-
return activeObject;
|
|
141
|
-
}
|
|
142
|
-
activeObject = activatorFunc(optional);
|
|
143
|
-
this._activeObjects.set(classPrototype, new ActiveInfo(activeObject, true));
|
|
144
|
-
return activeObject;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.ManagedScenarioContext = ManagedScenarioContext;
|
|
148
|
-
__exportStar(require("../types/scenario-context"), exports);
|
|
149
|
-
//# sourceMappingURL=managed-scenario-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"managed-scenario-context.js","sourceRoot":"","sources":["../../src/cucumber/managed-scenario-context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,4DAA2B;AAG3B,gEAA0E;AAI1E,MAAM,UAAU;IACf,YAAY,GAAQ,EAAE,YAAqB,KAAK;QAC/C,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC;QACxB,IAAI,CAA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AY,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5E,OAAO,YAAY,CAAC;IACrB,CAAC;CACD;AA5JD,wDA4JC;AAED,4DAA0C","sourcesContent":["import _ from 'underscore';\r\n\r\nimport { ContextType } from '../types/types';\r\nimport { ScenarioContext, ScenarioInfo } from '../types/scenario-context';\r\nimport { EndTestCaseInfo, StartTestCaseInfo } from './test-case-info';\r\nimport { World } from '@cucumber/cucumber';\r\n\r\nclass ActiveInfo {\r\n\tconstructor(obj: any, isContext: boolean = false) {\r\n\t\tthis.activeObject = obj;\r\n\t\tthis.isContext = isContext;\r\n\t}\r\n\tactiveObject: any;\r\n\tisContext: boolean;\r\n\tinitialized: boolean = false;\r\n}\r\n\r\n/**\r\n * Represents a [[ScenarioContext]] implementation that manages a collection of context objects that\r\n * are created and used by binding classes during a running Cucumber scenario.\r\n */\r\nexport class ManagedScenarioContext implements ScenarioContext {\r\n\tprivate _scenarioInfo: ScenarioInfo;\r\n\tprivate _activeObjects = new Map<any, ActiveInfo>();\r\n\r\n\tconstructor(scenarioTitle: string, tags: string[]) {\r\n\t\tthis._scenarioInfo = new ScenarioInfo(scenarioTitle, tags);\r\n\t}\r\n\r\n\t/**\r\n\t * Gets information about the scenario.\r\n\t *\r\n\t */\r\n\tpublic get scenarioInfo(): ScenarioInfo {\r\n\t\treturn this._scenarioInfo;\r\n\t}\r\n\r\n\tpublic getOrActivateBindingClass(classPrototype: any, contextTypes: ContextType[], worldObj: World): any {\r\n\t\treturn this.getOrActivateObject(classPrototype, () => {\r\n\t\t\treturn this.activateBindingClass(classPrototype, contextTypes, worldObj);\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * If context objects are passed into our step, this function will\r\n\t * call initialize on the context objects only once.\r\n\t * Using Promise.resolve so that initialize can be synchronous or async.\r\n\t */\r\n\tpublic async initialize(startTestCase: StartTestCaseInfo): Promise<void> {\r\n\t\tfor (const [_key, value] of this._activeObjects) {\r\n\t\t\tif (value.isContext && !value.initialized && typeof value.activeObject.initialize === 'function') {\r\n\t\t\t\tawait Promise.resolve(value.activeObject.initialize(startTestCase));\r\n\t\t\t\tvalue.initialized = true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * All objects support dispose, which is executed when a\r\n\t * test run is ended. Using Promise.resolve to support\r\n\t * synchronous or async functions.\r\n\t */\r\n\tpublic async dispose(endTestCase: EndTestCaseInfo): Promise<void> {\r\n\t\tfor (const [_key, value] of this._activeObjects) {\r\n\t\t\tif (typeof value.activeObject.dispose === 'function') {\r\n\t\t\t\tawait Promise.resolve(value.activeObject.dispose(endTestCase));\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tprivate activateBindingClass(classPrototype: any, contextTypes: ContextType[], worldObj: World): any {\r\n\t\tconst invokeBindingConstructor = (args: any[]): any => {\r\n\t\t\tswitch (contextTypes.length) {\r\n\t\t\t\tcase 0:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)();\r\n\t\t\t\tcase 1:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)(args[0]);\r\n\t\t\t\tcase 2:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)(args[0], args[1]);\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)(args[0], args[1], args[2]);\r\n\t\t\t\tcase 4:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)(args[0], args[1], args[2], args[3]);\r\n\t\t\t\tcase 5:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)(args[0], args[1], args[2], args[3], args[4]);\r\n\t\t\t\tcase 6:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)(args[0], args[1], args[2], args[3], args[4], args[5]);\r\n\t\t\t\tcase 7:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\r\n\t\t\t\tcase 8:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)(\r\n\t\t\t\t\t\targs[0],\r\n\t\t\t\t\t\targs[1],\r\n\t\t\t\t\t\targs[2],\r\n\t\t\t\t\t\targs[3],\r\n\t\t\t\t\t\targs[4],\r\n\t\t\t\t\t\targs[5],\r\n\t\t\t\t\t\targs[6],\r\n\t\t\t\t\t\targs[7]\r\n\t\t\t\t\t);\r\n\t\t\t\tcase 9:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)(\r\n\t\t\t\t\t\targs[0],\r\n\t\t\t\t\t\targs[1],\r\n\t\t\t\t\t\targs[2],\r\n\t\t\t\t\t\targs[3],\r\n\t\t\t\t\t\targs[4],\r\n\t\t\t\t\t\targs[5],\r\n\t\t\t\t\t\targs[6],\r\n\t\t\t\t\t\targs[7],\r\n\t\t\t\t\t\targs[8]\r\n\t\t\t\t\t);\r\n\t\t\t\tcase 10:\r\n\t\t\t\t\treturn new (classPrototype.constructor as any)(\r\n\t\t\t\t\t\targs[0],\r\n\t\t\t\t\t\targs[1],\r\n\t\t\t\t\t\targs[2],\r\n\t\t\t\t\t\targs[3],\r\n\t\t\t\t\t\targs[4],\r\n\t\t\t\t\t\targs[5],\r\n\t\t\t\t\t\targs[6],\r\n\t\t\t\t\t\targs[7],\r\n\t\t\t\t\t\targs[8],\r\n\t\t\t\t\t\targs[9]\r\n\t\t\t\t\t);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tconst contextObjects = _.map(contextTypes, contextType =>\r\n\t\t\tthis.getOrActivateContext(\r\n\t\t\t\tcontextType.prototype,\r\n\t\t\t\t(worldObj?: any) => {\r\n\t\t\t\t\treturn new contextType(worldObj);\r\n\t\t\t\t},\r\n\t\t\t\tworldObj\r\n\t\t\t)\r\n\t\t);\r\n\r\n\t\treturn invokeBindingConstructor(contextObjects);\r\n\t}\r\n\r\n\t/**\r\n\t * Get or activate any object\r\n\t *\r\n\t * @param classPrototype prototype for the object\r\n\t * @param activatorFunc callback function used to create an instance of the object\r\n\t * @param optional optional parameter passed into constructors\r\n\t * @returns\r\n\t */\r\n\tprivate getOrActivateObject(classPrototype: any, activatorFunc: (...args: any[]) => any, optional?: any): any {\r\n\t\tlet activeObject = this._activeObjects.get(classPrototype)?.activeObject;\r\n\t\tif (activeObject) {\r\n\t\t\treturn activeObject;\r\n\t\t}\r\n\t\tactiveObject = activatorFunc(optional);\r\n\t\tthis._activeObjects.set(classPrototype, new ActiveInfo(activeObject));\r\n\t\treturn activeObject;\r\n\t}\r\n\r\n\t/**\r\n\t * Get or activate Context objects. Marks an object as a context\r\n\t * object in ActiveInfo to let the system know it supports an initialize function.\r\n\t *\r\n\t * @param classPrototype prototype for the object\r\n\t * @param activatorFunc callback function used to create an instance of the object\r\n\t * @param optional optional parameter passed into constructors\r\n\t * @returns\r\n\t */\r\n\tprivate getOrActivateContext(classPrototype: any, activatorFunc: (...args: any[]) => any, optional?: any): any {\r\n\t\tlet activeObject = this._activeObjects.get(classPrototype)?.activeObject;\r\n\t\tif (activeObject) {\r\n\t\t\treturn activeObject;\r\n\t\t}\r\n\t\tactiveObject = activatorFunc(optional);\r\n\t\tthis._activeObjects.set(classPrototype, new ActiveInfo(activeObject, true));\r\n\t\treturn activeObject;\r\n\t}\r\n}\r\n\r\nexport * from '../types/scenario-context';\r\n"]}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as messages from '@cucumber/messages';
|
|
2
|
-
import { StepBinding } from '../types/step-binding';
|
|
3
|
-
import { ManagedScenarioContext } from './managed-scenario-context';
|
|
4
|
-
import { EndTestCaseInfo } from './test-case-info';
|
|
5
|
-
import { IMessageData } from '../types/parallel';
|
|
6
|
-
export interface ITestCaseAttempt {
|
|
7
|
-
attempt: number;
|
|
8
|
-
willBeRetried: boolean;
|
|
9
|
-
gherkinDocument: messages.GherkinDocument;
|
|
10
|
-
pickle: messages.Pickle;
|
|
11
|
-
stepAttachments: Record<string, messages.Attachment[]>;
|
|
12
|
-
stepResults: Record<string, messages.TestStepResult>;
|
|
13
|
-
testCase: messages.TestCase;
|
|
14
|
-
worstTestStepResult: messages.TestStepResult;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Custom implementation of the EventDataCollector from cucumber.js
|
|
18
|
-
*
|
|
19
|
-
* This implements all of the functions from the original EventDataCollector along
|
|
20
|
-
* with new functions to support binding to tsFlow tests.
|
|
21
|
-
*
|
|
22
|
-
* By extending the original version we're also reducing the amount of data stored
|
|
23
|
-
* during test runs because the original MessageCollector was capturing the same
|
|
24
|
-
* pickle and testCase data that the EventDataCollector does.
|
|
25
|
-
*/
|
|
26
|
-
export default class MessageCollector {
|
|
27
|
-
private gherkinDocumentMap;
|
|
28
|
-
private pickleMap;
|
|
29
|
-
private testCaseMap;
|
|
30
|
-
private testCaseAttemptDataMap;
|
|
31
|
-
readonly undefinedParameterTypes: messages.UndefinedParameterType[];
|
|
32
|
-
private testCaseRunningMap;
|
|
33
|
-
private collectorEvents;
|
|
34
|
-
onTestCaseEnd(Handler: (testCaseFinished: messages.TestCaseFinished) => void): void;
|
|
35
|
-
addMessageData(messageData: IMessageData): void;
|
|
36
|
-
getMessageData(): IMessageData;
|
|
37
|
-
addPickleAndTestCase(pickle: messages.Pickle, testCase: messages.TestCase): void;
|
|
38
|
-
hasFailures(): boolean;
|
|
39
|
-
getGherkinDocument(uri: string): messages.GherkinDocument;
|
|
40
|
-
getPickle(pickleId: string): messages.Pickle;
|
|
41
|
-
getTestCaseAttempts(): ITestCaseAttempt[];
|
|
42
|
-
getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt;
|
|
43
|
-
parseEnvelope(envelope: messages.Envelope): void;
|
|
44
|
-
private initTestCaseAttempt;
|
|
45
|
-
storeAttachment(attachment: messages.Attachment): void;
|
|
46
|
-
storeTestStepResult({ testCaseStartedId, testStepId, testStepResult }: messages.TestStepFinished): void;
|
|
47
|
-
storeTestCaseResult({ testCaseStartedId, willBeRetried }: messages.TestCaseFinished): void;
|
|
48
|
-
/**
|
|
49
|
-
* Gets the Pickle from hook parameters passed in from Cucumber
|
|
50
|
-
* to find a matching Pickle (scenario) and return the scenario Context
|
|
51
|
-
* @param hookParam
|
|
52
|
-
* @returns
|
|
53
|
-
*/
|
|
54
|
-
getHookScenarioContext(hookParam: any): ManagedScenarioContext | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Uses StepPattern information to find a matching scenario
|
|
57
|
-
* and return the ScenarioContext
|
|
58
|
-
* @param stepBinding
|
|
59
|
-
* @returns
|
|
60
|
-
*/
|
|
61
|
-
getStepScenarioContext(stepBinding: StepBinding): ManagedScenarioContext | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* Called when a test case (scenario) starts. Intercepting
|
|
64
|
-
* this message to initialize a new ScenarioContext
|
|
65
|
-
* @param testCaseStarted
|
|
66
|
-
*/
|
|
67
|
-
private startTestCase;
|
|
68
|
-
/**
|
|
69
|
-
* Called when a test case (scenario) ends. Intercepting
|
|
70
|
-
* this message to dispose and clear the ScenarioContext
|
|
71
|
-
* @param testCaseFinished
|
|
72
|
-
*/
|
|
73
|
-
endTestCase(endTestCase: EndTestCaseInfo): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* Uses the testCaleId passed in to find the associated Pickle (scenario)
|
|
76
|
-
* @param testCaseId
|
|
77
|
-
* @returns
|
|
78
|
-
*/
|
|
79
|
-
private getScenarioForTest;
|
|
80
|
-
/**
|
|
81
|
-
* StepBinding tags are initialized with an astrick when empty.
|
|
82
|
-
* Need to make sure tags has a value and not an astrick
|
|
83
|
-
* @param tags
|
|
84
|
-
* @returns
|
|
85
|
-
*/
|
|
86
|
-
private stepHasTags;
|
|
87
|
-
}
|