@lynxwall/cucumber-tsflow 6.5.7 → 7.1.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 +130 -35
- package/api/index.d.ts +6 -0
- package/bin/cucumber-tsflow +3 -3
- package/bin/cucumber-tsflow.js +3 -0
- package/lib/api/index.d.ts +17 -0
- package/lib/api/index.js +30 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/load-configuration.d.ts +21 -0
- package/lib/api/load-configuration.js +127 -0
- package/lib/api/load-configuration.js.map +1 -0
- package/lib/api/load-support.d.ts +10 -0
- package/lib/api/load-support.js +48 -0
- package/lib/api/load-support.js.map +1 -0
- package/lib/api/run-cucumber.d.ts +16 -0
- package/lib/api/run-cucumber.js +151 -0
- package/lib/api/run-cucumber.js.map +1 -0
- package/lib/api/wrapper.mjs +6 -0
- package/lib/behave.js +19 -9
- package/lib/behave.js.map +1 -0
- package/lib/bindings/binding-context.d.ts +17 -0
- package/lib/bindings/binding-context.js +36 -0
- package/lib/bindings/binding-context.js.map +1 -0
- package/lib/{cucumber → bindings}/binding-decorator.d.ts +2 -2
- package/lib/bindings/binding-decorator.js +201 -0
- package/lib/bindings/binding-decorator.js.map +1 -0
- package/lib/{cucumber → bindings}/binding-registry.d.ts +10 -10
- package/lib/bindings/binding-registry.js +232 -0
- package/lib/bindings/binding-registry.js.map +1 -0
- package/lib/{cucumber → bindings}/hook-decorators.d.ts +6 -6
- package/lib/{cucumber → bindings}/hook-decorators.js +18 -16
- package/lib/bindings/hook-decorators.js.map +1 -0
- package/lib/bindings/step-binding.d.ts +60 -0
- package/lib/bindings/step-binding.js +6 -0
- package/lib/bindings/step-binding.js.map +1 -0
- package/lib/{cucumber/step-definition-decorators.d.ts → bindings/step-decorators.d.ts} +3 -3
- package/lib/bindings/step-decorators.js +97 -0
- package/lib/bindings/step-decorators.js.map +1 -0
- package/lib/bindings/types.d.ts +72 -0
- package/lib/bindings/types.js +58 -0
- package/lib/bindings/types.js.map +1 -0
- package/lib/cli/argv-parser.js +3 -3
- package/lib/cli/argv-parser.js.map +1 -0
- package/lib/cli/index.d.ts +1 -2
- package/lib/cli/index.js +12 -40
- package/lib/cli/index.js.map +1 -0
- package/lib/cli/load-configuration.d.ts +2 -1
- package/lib/cli/load-configuration.js +12 -10
- package/lib/cli/load-configuration.js.map +1 -0
- package/lib/cli/run.js +5 -7
- package/lib/cli/run.js.map +1 -0
- package/lib/cucumber/coordinator.d.ts +15 -0
- package/lib/cucumber/coordinator.js +40 -0
- package/lib/cucumber/coordinator.js.map +1 -0
- package/lib/cucumber/make-runtime.d.ts +12 -16
- package/lib/cucumber/make-runtime.js +10 -33
- package/lib/cucumber/make-runtime.js.map +1 -0
- package/lib/cucumber/managed-scenario-context.d.ts +3 -3
- package/lib/cucumber/managed-scenario-context.js +24 -24
- package/lib/cucumber/managed-scenario-context.js.map +1 -0
- package/lib/cucumber/message-collector.d.ts +3 -0
- package/lib/cucumber/message-collector.js +38 -16
- package/lib/cucumber/message-collector.js.map +1 -0
- package/lib/cucumber/parallel/adapter.d.ts +46 -0
- package/lib/cucumber/parallel/adapter.js +156 -0
- package/lib/cucumber/parallel/adapter.js.map +1 -0
- package/lib/cucumber/parallel/run-worker.d.ts +1 -1
- package/lib/cucumber/parallel/run-worker.js +8 -16
- package/lib/cucumber/parallel/run-worker.js.map +1 -0
- package/lib/cucumber/parallel/worker.d.ts +10 -14
- package/lib/cucumber/parallel/worker.js +59 -68
- package/lib/cucumber/parallel/worker.js.map +1 -0
- package/lib/cucumber/run-cucumber.d.ts +5 -3
- package/lib/cucumber/run-cucumber.js +59 -38
- package/lib/cucumber/run-cucumber.js.map +1 -0
- package/lib/cucumber/serial/adapter.d.ts +12 -0
- package/lib/cucumber/serial/adapter.js +24 -0
- package/lib/cucumber/serial/adapter.js.map +1 -0
- package/lib/cucumber/test-case-info.js +1 -1
- package/lib/cucumber/test-case-info.js.map +1 -0
- package/lib/cucumber/test-case-runner.d.ts +2 -2
- package/lib/cucumber/test-case-runner.js +47 -19
- package/lib/cucumber/test-case-runner.js.map +1 -0
- package/lib/cucumber/utils.js +1 -1
- package/lib/cucumber/utils.js.map +1 -0
- package/lib/cucumber/worker.d.ts +17 -0
- package/lib/cucumber/worker.js +57 -0
- package/lib/cucumber/worker.js.map +1 -0
- package/lib/esnode.d.ts +1 -0
- package/lib/esnode.js +5 -7
- package/lib/esnode.js.map +1 -0
- package/lib/esvue.js +3 -6
- package/lib/esvue.js.map +1 -0
- package/lib/formatter/behave-json-formatter.d.ts +49 -0
- package/lib/formatter/behave-json-formatter.js +85 -0
- package/lib/formatter/behave-json-formatter.js.map +1 -0
- package/lib/formatter/junit-bamboo-formatter.d.ts +17 -0
- package/lib/formatter/junit-bamboo-formatter.js +175 -0
- package/lib/formatter/junit-bamboo-formatter.js.map +1 -0
- package/lib/formatter/step-definition-snippit-syntax/tsflow-snippet-syntax.d.ts +9 -0
- package/lib/formatter/step-definition-snippit-syntax/tsflow-snippet-syntax.js +85 -0
- package/lib/formatter/step-definition-snippit-syntax/tsflow-snippet-syntax.js.map +1 -0
- package/lib/formatters/behave-json-formatter.js +18 -8
- package/lib/formatters/behave-json-formatter.js.map +1 -0
- package/lib/formatters/junit-bamboo-formatter.js +2 -2
- package/lib/formatters/junit-bamboo-formatter.js.map +1 -0
- package/lib/formatters/tsflow-snippet-syntax.js +2 -3
- package/lib/formatters/tsflow-snippet-syntax.js.map +1 -0
- package/lib/gherkin/configuration.d.ts +4 -4
- package/lib/gherkin/configuration.js +1 -1
- package/lib/gherkin/configuration.js.map +1 -0
- package/lib/gherkin/gherkin-feature.js +18 -8
- package/lib/gherkin/gherkin-feature.js.map +1 -0
- package/lib/gherkin/gherkin-manager.js +2 -2
- package/lib/gherkin/gherkin-manager.js.map +1 -0
- package/lib/gherkin/models.d.ts +1 -1
- package/lib/gherkin/models.js +1 -1
- package/lib/gherkin/models.js.map +1 -0
- package/lib/index.d.ts +42 -5
- package/lib/index.js +114 -8
- package/lib/index.js.map +1 -0
- package/lib/junitbamboo.js +19 -9
- package/lib/junitbamboo.js.map +1 -0
- package/lib/runtime/coordinator.d.ts +15 -0
- package/lib/runtime/coordinator.js +40 -0
- package/lib/runtime/coordinator.js.map +1 -0
- package/lib/runtime/make-runtime.d.ts +22 -0
- package/lib/runtime/make-runtime.js +17 -0
- package/lib/runtime/make-runtime.js.map +1 -0
- package/lib/runtime/managed-scenario-context.d.ts +52 -0
- package/lib/runtime/managed-scenario-context.js +149 -0
- package/lib/runtime/managed-scenario-context.js.map +1 -0
- package/lib/runtime/message-collector.d.ts +98 -0
- package/lib/runtime/message-collector.js +284 -0
- package/lib/runtime/message-collector.js.map +1 -0
- package/lib/runtime/parallel/adapter.d.ts +47 -0
- package/lib/runtime/parallel/adapter.js +159 -0
- package/lib/runtime/parallel/adapter.js.map +1 -0
- package/lib/runtime/parallel/run-worker.d.ts +1 -0
- package/lib/runtime/parallel/run-worker.js +24 -0
- package/lib/runtime/parallel/run-worker.js.map +1 -0
- package/lib/runtime/parallel/types.d.ts +13 -0
- package/lib/runtime/parallel/types.js +3 -0
- package/lib/runtime/parallel/types.js.map +1 -0
- package/lib/runtime/parallel/worker.d.ts +44 -0
- package/lib/runtime/parallel/worker.js +118 -0
- package/lib/runtime/parallel/worker.js.map +1 -0
- package/lib/runtime/scenario-context.d.ts +16 -0
- package/lib/runtime/scenario-context.js +18 -0
- package/lib/runtime/scenario-context.js.map +1 -0
- package/lib/runtime/scenario-info.d.ts +16 -0
- package/lib/runtime/scenario-info.js +23 -0
- package/lib/runtime/scenario-info.js.map +1 -0
- package/lib/runtime/serial/adapter.d.ts +12 -0
- package/lib/runtime/serial/adapter.js +24 -0
- package/lib/runtime/serial/adapter.js.map +1 -0
- package/lib/runtime/test-case-info.d.ts +23 -0
- package/lib/runtime/test-case-info.js +3 -0
- package/lib/runtime/test-case-info.js.map +1 -0
- package/lib/runtime/test-case-runner.d.ts +48 -0
- package/lib/runtime/test-case-runner.js +345 -0
- package/lib/runtime/test-case-runner.js.map +1 -0
- package/lib/runtime/utils.d.ts +16 -0
- package/lib/runtime/utils.js +78 -0
- package/lib/runtime/utils.js.map +1 -0
- package/lib/runtime/worker.d.ts +17 -0
- package/lib/runtime/worker.js +57 -0
- package/lib/runtime/worker.js.map +1 -0
- package/lib/snippet.js +20 -10
- package/lib/snippet.js.map +1 -0
- package/lib/transpilers/esbuild-transpiler.d.ts +1 -1
- package/lib/transpilers/esbuild-transpiler.js +1 -1
- package/lib/transpilers/esbuild-transpiler.js.map +1 -0
- package/lib/transpilers/esbuild.js +4 -4
- package/lib/transpilers/esbuild.js.map +1 -0
- package/lib/transpilers/vue-sfc/compiler.js +1 -1
- package/lib/transpilers/vue-sfc/compiler.js.map +1 -0
- package/lib/transpilers/vue-sfc/index.d.ts +4 -4
- package/lib/transpilers/vue-sfc/index.js +1 -2
- package/lib/transpilers/vue-sfc/index.js.map +1 -0
- package/lib/transpilers/vue-sfc/main.d.ts +1 -1
- package/lib/transpilers/vue-sfc/main.js +1 -1
- package/lib/transpilers/vue-sfc/main.js.map +1 -0
- package/lib/transpilers/vue-sfc/script.js +1 -2
- package/lib/transpilers/vue-sfc/script.js.map +1 -0
- package/lib/transpilers/vue-sfc/template.d.ts +1 -1
- package/lib/transpilers/vue-sfc/template.js +2 -3
- package/lib/transpilers/vue-sfc/template.js.map +1 -0
- package/lib/transpilers/vue-sfc/types.d.ts +2 -2
- package/lib/transpilers/vue-sfc/types.js +1 -1
- package/lib/transpilers/vue-sfc/types.js.map +1 -0
- package/lib/transpilers/vue-sfc/utils/descriptorCache.js +1 -1
- package/lib/transpilers/vue-sfc/utils/descriptorCache.js.map +1 -0
- package/lib/transpilers/vue-sfc/utils/error.js +1 -1
- package/lib/transpilers/vue-sfc/utils/error.js.map +1 -0
- package/lib/transpilers/vue-sfc/utils/query.js +1 -1
- package/lib/transpilers/vue-sfc/utils/query.js.map +1 -0
- package/lib/tsconfig.node.tsbuildinfo +1 -0
- package/lib/tsnode.d.ts +1 -0
- package/lib/tsnode.js +4 -6
- package/lib/tsnode.js.map +1 -0
- package/lib/tsvue.js +3 -6
- package/lib/tsvue.js.map +1 -0
- package/lib/types/parallel.d.ts +11 -0
- package/lib/types/parallel.js +3 -0
- package/lib/types/parallel.js.map +1 -0
- package/lib/types/scenario-context.js +1 -1
- package/lib/types/scenario-context.js.map +1 -0
- package/lib/types/scenario-info.js +1 -1
- package/lib/types/scenario-info.js.map +1 -0
- package/lib/types/step-binding-flags.js +1 -1
- package/lib/types/step-binding-flags.js.map +1 -0
- package/lib/types/step-binding.d.ts +30 -20
- package/lib/types/step-binding.js +1 -1
- package/lib/types/step-binding.js.map +1 -0
- package/lib/types/types.js +1 -1
- package/lib/types/types.js.map +1 -0
- package/lib/utils/helpers.js +1 -1
- package/lib/utils/helpers.js.map +1 -0
- package/lib/utils/logger.d.ts +2 -2
- package/lib/utils/logger.js +7 -26
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/our-callsite.js +18 -8
- package/lib/utils/our-callsite.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +2 -2
- package/lib/version.js.map +1 -0
- package/lib/wrapper.mjs +56 -0
- package/package.json +65 -27
- package/lib/cucumber/binding-decorator.js +0 -181
- package/lib/cucumber/binding-registry.js +0 -231
- package/lib/cucumber/parallel/coordinator.d.ts +0 -79
- package/lib/cucumber/parallel/coordinator.js +0 -247
- package/lib/cucumber/runtime.d.ts +0 -40
- package/lib/cucumber/runtime.js +0 -85
- package/lib/cucumber/step-definition-decorators.js +0 -92
package/lib/index.js
CHANGED
|
@@ -10,14 +10,120 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var
|
|
14
|
-
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
37
|
};
|
|
16
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ScenarioInfo = void 0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
39
|
+
exports.Cli = exports.wrapPromiseWithTimeout = exports.Status = exports.parallelCanAssignHelpers = exports.context = exports.world = exports.World = exports.setParallelCanAssign = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.defineParameterType = exports.ScenarioInfo = exports.then = exports.when = exports.given = exports.afterStep = exports.after = exports.afterAll = exports.beforeStep = exports.before = exports.beforeAll = exports.binding = exports.formatterHelpers = exports.UsageJsonFormatter = exports.UsageFormatter = exports.SummaryFormatter = exports.SnippetsFormatter = exports.RerunFormatter = exports.ProgressFormatter = exports.JsonFormatter = exports.FormatterBuilder = exports.Formatter = exports.JunitBambooFormatter = exports.BehaveFormatter = exports.TsflowSnippet = exports.TestCaseHookDefinition = exports.DataTable = exports.supportCodeLibraryBuilder = exports.version = void 0;
|
|
40
|
+
/**
|
|
41
|
+
* User code functions and helpers
|
|
42
|
+
*
|
|
43
|
+
* @packageDocumentation
|
|
44
|
+
* @module (root)
|
|
45
|
+
* @remarks
|
|
46
|
+
* These docs cover the functions and helpers for user code registration and test setup. The entry point is `@lynxwall/cucumber-tsflow`.
|
|
47
|
+
*/
|
|
48
|
+
const node_util_1 = require("node:util");
|
|
49
|
+
const messages = __importStar(require("@cucumber/messages"));
|
|
50
|
+
const cli_1 = __importDefault(require("./cli"));
|
|
51
|
+
const formatterHelpers = __importStar(require("@cucumber/cucumber/lib/formatter/helpers/index"));
|
|
52
|
+
exports.formatterHelpers = formatterHelpers;
|
|
53
|
+
const parallelCanAssignHelpers = __importStar(require("@cucumber/cucumber/lib/support_code_library_builder/parallel_can_assign_helpers"));
|
|
54
|
+
exports.parallelCanAssignHelpers = parallelCanAssignHelpers;
|
|
55
|
+
const index_1 = __importDefault(require("@cucumber/cucumber/lib/support_code_library_builder/index"));
|
|
56
|
+
const version_1 = require("./version");
|
|
57
|
+
// type version as string
|
|
58
|
+
exports.version = version_1.version;
|
|
59
|
+
// Top level
|
|
60
|
+
var index_2 = require("@cucumber/cucumber/lib/support_code_library_builder/index");
|
|
61
|
+
Object.defineProperty(exports, "supportCodeLibraryBuilder", { enumerable: true, get: function () { return __importDefault(index_2).default; } });
|
|
62
|
+
var data_table_1 = require("@cucumber/cucumber/lib/models/data_table");
|
|
63
|
+
Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return __importDefault(data_table_1).default; } });
|
|
64
|
+
var test_case_hook_definition_1 = require("@cucumber/cucumber/lib/models/test_case_hook_definition");
|
|
65
|
+
Object.defineProperty(exports, "TestCaseHookDefinition", { enumerable: true, get: function () { return __importDefault(test_case_hook_definition_1).default; } });
|
|
66
|
+
// TsFlow Snippet Syntax and Formatters
|
|
67
|
+
var tsflow_snippet_syntax_1 = require("./formatter/step-definition-snippit-syntax/tsflow-snippet-syntax");
|
|
68
|
+
Object.defineProperty(exports, "TsflowSnippet", { enumerable: true, get: function () { return __importDefault(tsflow_snippet_syntax_1).default; } });
|
|
69
|
+
var behave_json_formatter_1 = require("./formatter/behave-json-formatter");
|
|
70
|
+
Object.defineProperty(exports, "BehaveFormatter", { enumerable: true, get: function () { return __importDefault(behave_json_formatter_1).default; } });
|
|
71
|
+
var junit_bamboo_formatter_1 = require("./formatter/junit-bamboo-formatter");
|
|
72
|
+
Object.defineProperty(exports, "JunitBambooFormatter", { enumerable: true, get: function () { return __importDefault(junit_bamboo_formatter_1).default; } });
|
|
73
|
+
// CucumberJS Formatters
|
|
74
|
+
var index_3 = require("@cucumber/cucumber/lib/formatter/index");
|
|
75
|
+
Object.defineProperty(exports, "Formatter", { enumerable: true, get: function () { return __importDefault(index_3).default; } });
|
|
76
|
+
var builder_1 = require("@cucumber/cucumber/lib/formatter/builder");
|
|
77
|
+
Object.defineProperty(exports, "FormatterBuilder", { enumerable: true, get: function () { return __importDefault(builder_1).default; } });
|
|
78
|
+
var json_formatter_1 = require("@cucumber/cucumber/lib/formatter/json_formatter");
|
|
79
|
+
Object.defineProperty(exports, "JsonFormatter", { enumerable: true, get: function () { return __importDefault(json_formatter_1).default; } });
|
|
80
|
+
var progress_formatter_1 = require("@cucumber/cucumber/lib/formatter/progress_formatter");
|
|
81
|
+
Object.defineProperty(exports, "ProgressFormatter", { enumerable: true, get: function () { return __importDefault(progress_formatter_1).default; } });
|
|
82
|
+
var rerun_formatter_1 = require("@cucumber/cucumber/lib/formatter/rerun_formatter");
|
|
83
|
+
Object.defineProperty(exports, "RerunFormatter", { enumerable: true, get: function () { return __importDefault(rerun_formatter_1).default; } });
|
|
84
|
+
var snippets_formatter_1 = require("@cucumber/cucumber/lib/formatter/snippets_formatter");
|
|
85
|
+
Object.defineProperty(exports, "SnippetsFormatter", { enumerable: true, get: function () { return __importDefault(snippets_formatter_1).default; } });
|
|
86
|
+
var summary_formatter_1 = require("@cucumber/cucumber/lib/formatter/summary_formatter");
|
|
87
|
+
Object.defineProperty(exports, "SummaryFormatter", { enumerable: true, get: function () { return __importDefault(summary_formatter_1).default; } });
|
|
88
|
+
var usage_formatter_1 = require("@cucumber/cucumber/lib/formatter/usage_formatter");
|
|
89
|
+
Object.defineProperty(exports, "UsageFormatter", { enumerable: true, get: function () { return __importDefault(usage_formatter_1).default; } });
|
|
90
|
+
var usage_json_formatter_1 = require("@cucumber/cucumber/lib/formatter/usage_json_formatter");
|
|
91
|
+
Object.defineProperty(exports, "UsageJsonFormatter", { enumerable: true, get: function () { return __importDefault(usage_json_formatter_1).default; } });
|
|
92
|
+
// Tsflow Support Code Functions - replaces CucumberJS hook and step functions
|
|
93
|
+
var binding_decorator_1 = require("./bindings/binding-decorator");
|
|
94
|
+
Object.defineProperty(exports, "binding", { enumerable: true, get: function () { return binding_decorator_1.binding; } });
|
|
95
|
+
var hook_decorators_1 = require("./bindings/hook-decorators");
|
|
96
|
+
Object.defineProperty(exports, "beforeAll", { enumerable: true, get: function () { return hook_decorators_1.beforeAll; } });
|
|
97
|
+
Object.defineProperty(exports, "before", { enumerable: true, get: function () { return hook_decorators_1.before; } });
|
|
98
|
+
Object.defineProperty(exports, "beforeStep", { enumerable: true, get: function () { return hook_decorators_1.beforeStep; } });
|
|
99
|
+
Object.defineProperty(exports, "afterAll", { enumerable: true, get: function () { return hook_decorators_1.afterAll; } });
|
|
100
|
+
Object.defineProperty(exports, "after", { enumerable: true, get: function () { return hook_decorators_1.after; } });
|
|
101
|
+
Object.defineProperty(exports, "afterStep", { enumerable: true, get: function () { return hook_decorators_1.afterStep; } });
|
|
102
|
+
var step_decorators_1 = require("./bindings/step-decorators");
|
|
103
|
+
Object.defineProperty(exports, "given", { enumerable: true, get: function () { return step_decorators_1.given; } });
|
|
104
|
+
Object.defineProperty(exports, "when", { enumerable: true, get: function () { return step_decorators_1.when; } });
|
|
105
|
+
Object.defineProperty(exports, "then", { enumerable: true, get: function () { return step_decorators_1.then; } });
|
|
106
|
+
var scenario_context_1 = require("./runtime/scenario-context");
|
|
22
107
|
Object.defineProperty(exports, "ScenarioInfo", { enumerable: true, get: function () { return scenario_context_1.ScenarioInfo; } });
|
|
23
|
-
|
|
108
|
+
// Support Code Functions
|
|
109
|
+
const { methods } = index_1.default;
|
|
110
|
+
exports.defineParameterType = methods.defineParameterType;
|
|
111
|
+
exports.setDefaultTimeout = methods.setDefaultTimeout;
|
|
112
|
+
exports.setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper;
|
|
113
|
+
exports.setWorldConstructor = methods.setWorldConstructor;
|
|
114
|
+
exports.setParallelCanAssign = methods.setParallelCanAssign;
|
|
115
|
+
var world_1 = require("@cucumber/cucumber/lib/support_code_library_builder/world");
|
|
116
|
+
Object.defineProperty(exports, "World", { enumerable: true, get: function () { return __importDefault(world_1).default; } });
|
|
117
|
+
var index_4 = require("@cucumber/cucumber/lib/runtime/scope/index");
|
|
118
|
+
Object.defineProperty(exports, "world", { enumerable: true, get: function () { return index_4.worldProxy; } });
|
|
119
|
+
Object.defineProperty(exports, "context", { enumerable: true, get: function () { return index_4.contextProxy; } });
|
|
120
|
+
exports.Status = messages.TestStepResultStatus;
|
|
121
|
+
// Time helpers
|
|
122
|
+
var time_1 = require("@cucumber/cucumber/lib/time");
|
|
123
|
+
Object.defineProperty(exports, "wrapPromiseWithTimeout", { enumerable: true, get: function () { return time_1.wrapPromiseWithTimeout; } });
|
|
124
|
+
// Deprecated
|
|
125
|
+
/**
|
|
126
|
+
* @deprecated use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
|
|
127
|
+
*/
|
|
128
|
+
exports.Cli = (0, node_util_1.deprecate)(cli_1.default, '`Cli` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
|
|
129
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
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DAA+D;AAAtD,wGAAA,KAAK,OAAA;AAAE,uGAAA,IAAI,OAAA;AAAE,uGAAA,IAAI,OAAA;AAE1B,+DAA2E;AAAjD,gHAAA,YAAY,OAAA;AAEtC,yBAAyB;AACzB,MAAM,EAAE,OAAO,EAAE,GAAG,eAAyB,CAAC;AACjC,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAClD,QAAA,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAC9C,QAAA,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAC;AACpE,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAClD,QAAA,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;AAEjE,mFAAoH;AAA3G,+GAAA,OAAO,OAAS;AAEzB,oEAA0G;AAAjG,8FAAA,UAAU,OAAS;AAAE,gGAAA,YAAY,OAAW;AAOxC,QAAA,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC;AAEpD,eAAe;AACf,oDAAqE;AAA5D,8GAAA,sBAAsB,OAAA;AAE/B,aAAa;AACb;;GAEG;AACU,QAAA,GAAG,GAAG,IAAA,qBAAS,EAC3B,aAAI,EACJ,4HAA4H,CAC5H,CAAC","sourcesContent":["/**\r\n * User code functions and helpers\r\n *\r\n * @packageDocumentation\r\n * @module (root)\r\n * @remarks\r\n * These docs cover the functions and helpers for user code registration and test setup. The entry point is `@lynxwall/cucumber-tsflow`.\r\n */\r\nimport { deprecate } from 'node:util';\r\nimport * as messages from '@cucumber/messages';\r\nimport { default as _Cli } from './cli';\r\nimport * as formatterHelpers from '@cucumber/cucumber/lib/formatter/helpers/index';\r\nimport * as parallelCanAssignHelpers from '@cucumber/cucumber/lib/support_code_library_builder/parallel_can_assign_helpers';\r\nimport supportCodeLibraryBuilder from '@cucumber/cucumber/lib/support_code_library_builder/index';\r\nimport { version as _version } from './version';\r\n\r\n// type version as string\r\nexport const version = _version as string;\r\n\r\n// Top level\r\nexport { default as supportCodeLibraryBuilder } from '@cucumber/cucumber/lib/support_code_library_builder/index';\r\nexport { default as DataTable } from '@cucumber/cucumber/lib/models/data_table';\r\nexport { default as TestCaseHookDefinition } from '@cucumber/cucumber/lib/models/test_case_hook_definition';\r\n\r\n// TsFlow Snippet Syntax and Formatters\r\nexport { default as TsflowSnippet } from './formatter/step-definition-snippit-syntax/tsflow-snippet-syntax';\r\nexport { default as BehaveFormatter } from './formatter/behave-json-formatter';\r\nexport { default as JunitBambooFormatter } from './formatter/junit-bamboo-formatter';\r\n\r\n// CucumberJS Formatters\r\nexport { default as Formatter, IFormatterOptions } from '@cucumber/cucumber/lib/formatter/index';\r\nexport { default as FormatterBuilder } from '@cucumber/cucumber/lib/formatter/builder';\r\nexport { default as JsonFormatter } from '@cucumber/cucumber/lib/formatter/json_formatter';\r\nexport { default as ProgressFormatter } from '@cucumber/cucumber/lib/formatter/progress_formatter';\r\nexport { default as RerunFormatter } from '@cucumber/cucumber/lib/formatter/rerun_formatter';\r\nexport { default as SnippetsFormatter } from '@cucumber/cucumber/lib/formatter/snippets_formatter';\r\nexport { default as SummaryFormatter } from '@cucumber/cucumber/lib/formatter/summary_formatter';\r\nexport { default as UsageFormatter } from '@cucumber/cucumber/lib/formatter/usage_formatter';\r\nexport { default as UsageJsonFormatter } from '@cucumber/cucumber/lib/formatter/usage_json_formatter';\r\nexport { formatterHelpers };\r\n\r\n// Tsflow Support Code Functions - replaces CucumberJS hook and step functions\r\nexport { binding } from './bindings/binding-decorator';\r\nexport { beforeAll, before, beforeStep, afterAll, after, afterStep } from './bindings/hook-decorators';\r\nexport { given, when, then } from './bindings/step-decorators';\r\nexport { StartTestCaseInfo, EndTestCaseInfo } from './runtime/test-case-info';\r\nexport { ScenarioContext, ScenarioInfo } from './runtime/scenario-context';\r\n\r\n// Support Code Functions\r\nconst { methods } = supportCodeLibraryBuilder;\r\nexport const defineParameterType = methods.defineParameterType;\r\nexport const setDefaultTimeout = methods.setDefaultTimeout;\r\nexport const setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper;\r\nexport const setWorldConstructor = methods.setWorldConstructor;\r\nexport const setParallelCanAssign = methods.setParallelCanAssign;\r\n\r\nexport { default as World, IWorld, IWorldOptions } from '@cucumber/cucumber/lib/support_code_library_builder/world';\r\nexport { IContext } from '@cucumber/cucumber/lib/support_code_library_builder/context';\r\nexport { worldProxy as world, contextProxy as context } from '@cucumber/cucumber/lib/runtime/scope/index';\r\nexport { parallelCanAssignHelpers };\r\n\r\nexport {\r\n\tITestCaseHookParameter,\r\n\tITestStepHookParameter\r\n} from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nexport const Status = messages.TestStepResultStatus;\r\n\r\n// Time helpers\r\nexport { wrapPromiseWithTimeout } from '@cucumber/cucumber/lib/time';\r\n\r\n// Deprecated\r\n/**\r\n * @deprecated use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md\r\n */\r\nexport const Cli = deprecate(\r\n\t_Cli,\r\n\t'`Cli` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\r\n);\r\n"]}
|
package/lib/junitbamboo.js
CHANGED
|
@@ -15,14 +15,24 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const junitbamboo = __importStar(require("./
|
|
36
|
+
const junitbamboo = __importStar(require("./formatter/junit-bamboo-formatter"));
|
|
27
37
|
module.exports = junitbamboo;
|
|
28
|
-
//# sourceMappingURL=
|
|
38
|
+
//# sourceMappingURL=junitbamboo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"junitbamboo.js","sourceRoot":"","sources":["../src/junitbamboo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAAkE;AAElE,MAAM,CAAC,OAAO,GAAG,WAAW,CAAC","sourcesContent":["import * as junitbamboo from './formatter/junit-bamboo-formatter';\r\n\r\nmodule.exports = junitbamboo;\r\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/runtime/coordinator.ts"],"names":[],"mappings":";;;AAEA,iEAAyF;AAGzF,wEAAqE;AAGrE,MAAa,WAAW;IAEd;IACA;IACA;IACA;IACA;IALT,YACS,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;IAC7B,CAAC;IAEJ,KAAK,CAAC,GAAG;QACR,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAEtC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACtC,cAAc,EAAE;gBACf,EAAE,EAAE,gBAAgB;gBACpB,SAAS,EAAE,IAAA,qBAAS,GAAE;aACtB;SACkB,CAAC,CAAC;QAEtB,MAAM,kBAAkB,GAAG,MAAM,IAAA,yBAAiB,EACjD,gBAAgB,EAChB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,kBAAkB,CACvB,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAE3D,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACtC,eAAe,EAAE;gBAChB,gBAAgB;gBAChB,SAAS,EAAE,IAAA,qBAAS,GAAE;gBACtB,OAAO;aACP;SACkB,CAAC,CAAC;QAEtB,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;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\tconstructor(\r\n\t\tprivate eventBroadcaster: EventEmitter,\r\n\t\tprivate newId: IdGenerator.NewId,\r\n\t\tprivate sourcedPickles: ReadonlyArray<SourcedPickle>,\r\n\t\tprivate supportCodeLibrary: SupportCodeLibrary,\r\n\t\tprivate adapter: RuntimeAdapter\r\n\t) {}\r\n\r\n\tasync run(): Promise<boolean> {\r\n\t\tconst testRunStartedId = this.newId();\r\n\r\n\t\tthis.eventBroadcaster.emit('envelope', {\r\n\t\t\ttestRunStarted: {\r\n\t\t\t\tid: testRunStartedId,\r\n\t\t\t\ttimestamp: timestamp()\r\n\t\t\t}\r\n\t\t} satisfies Envelope);\r\n\r\n\t\tconst assembledTestCases = await assembleTestCases(\r\n\t\t\ttestRunStartedId,\r\n\t\t\tthis.eventBroadcaster,\r\n\t\t\tthis.newId,\r\n\t\t\tthis.sourcedPickles,\r\n\t\t\tthis.supportCodeLibrary\r\n\t\t);\r\n\r\n\t\tconst success = await this.adapter.run(assembledTestCases);\r\n\r\n\t\tthis.eventBroadcaster.emit('envelope', {\r\n\t\t\ttestRunFinished: {\r\n\t\t\t\ttestRunStartedId,\r\n\t\t\t\ttimestamp: timestamp(),\r\n\t\t\t\tsuccess\r\n\t\t\t}\r\n\t\t} satisfies Envelope);\r\n\r\n\t\treturn success;\r\n\t}\r\n}\r\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { IdGenerator } from '@cucumber/messages';
|
|
3
|
+
import { IRunOptionsRuntime, ISourcesCoordinates } 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, coordinates }: {
|
|
14
|
+
environment: IRunEnvironment;
|
|
15
|
+
logger: ILogger;
|
|
16
|
+
eventBroadcaster: EventEmitter;
|
|
17
|
+
newId: IdGenerator.NewId;
|
|
18
|
+
sourcedPickles: ReadonlyArray<SourcedPickle>;
|
|
19
|
+
supportCodeLibrary: SupportCodeLibrary;
|
|
20
|
+
options: IRunOptionsRuntime;
|
|
21
|
+
coordinates: ISourcesCoordinates;
|
|
22
|
+
}): Promise<Runtime>;
|
|
@@ -0,0 +1,17 @@
|
|
|
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, coordinates }) {
|
|
12
|
+
const adapter = options.parallel > 0
|
|
13
|
+
? new adapter_1.ChildProcessAdapter(environment, logger, eventBroadcaster, options, supportCodeLibrary, coordinates)
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-runtime.js","sourceRoot":"","sources":["../../src/runtime/make-runtime.ts"],"names":[],"mappings":";;AAgBA,kCAwBC;AAhCD,gDAAyD;AACzD,8CAAoD;AACpD,+CAA4C;AAE5C;;;GAGG;AACI,KAAK,UAAU,WAAW,CAAC,EACjC,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,kBAAkB,EAClB,OAAO,EACP,WAAW,EAUX;IACA,MAAM,OAAO,GACZ,OAAO,CAAC,QAAQ,GAAG,CAAC;QACnB,CAAC,CAAC,IAAI,6BAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,CAAC;QAC1G,CAAC,CAAC,IAAI,0BAAgB,CAAC,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC/E,OAAO,IAAI,yBAAW,CAAC,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["import { EventEmitter } from 'node:events';\r\nimport { IdGenerator } from '@cucumber/messages';\r\nimport { IRunOptionsRuntime, ISourcesCoordinates } 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\tenvironment,\r\n\tlogger,\r\n\teventBroadcaster,\r\n\tsourcedPickles,\r\n\tnewId,\r\n\tsupportCodeLibrary,\r\n\toptions,\r\n\tcoordinates\r\n}: {\r\n\tenvironment: IRunEnvironment;\r\n\tlogger: ILogger;\r\n\teventBroadcaster: EventEmitter;\r\n\tnewId: IdGenerator.NewId;\r\n\tsourcedPickles: ReadonlyArray<SourcedPickle>;\r\n\tsupportCodeLibrary: SupportCodeLibrary;\r\n\toptions: IRunOptionsRuntime;\r\n\tcoordinates: ISourcesCoordinates;\r\n}): Promise<Runtime> {\r\n\tconst adapter: RuntimeAdapter =\r\n\t\toptions.parallel > 0\r\n\t\t\t? new ChildProcessAdapter(environment, logger, eventBroadcaster, options, supportCodeLibrary, coordinates)\r\n\t\t\t: new InProcessAdapter(eventBroadcaster, newId, options, supportCodeLibrary);\r\n\treturn new Coordinator(eventBroadcaster, newId, sourcedPickles, supportCodeLibrary, adapter);\r\n}\r\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ContextType } from '../bindings/types';
|
|
2
|
+
import { ScenarioContext, ScenarioInfo } from './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 './scenario-context';
|
|
@@ -0,0 +1,149 @@
|
|
|
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("./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("./scenario-context"), exports);
|
|
149
|
+
//# sourceMappingURL=managed-scenario-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-scenario-context.js","sourceRoot":"","sources":["../../src/runtime/managed-scenario-context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,4DAA2B;AAG3B,yDAAmE;AAInE,MAAM,UAAU;IACf,YAAY,GAAQ,EAAE,YAAqB,KAAK;QAC/C,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IACD,YAAY,CAAM;IAClB,SAAS,CAAU;IACnB,WAAW,GAAY,KAAK,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAa,sBAAsB;IAC1B,aAAa,CAAe;IAC5B,cAAc,GAAG,IAAI,GAAG,EAAmB,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4JC;AAED,qDAAmC","sourcesContent":["import _ from 'underscore';\r\n\r\nimport { ContextType } from '../bindings/types';\r\nimport { ScenarioContext, ScenarioInfo } from './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 './scenario-context';\r\n"]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as messages from '@cucumber/messages';
|
|
2
|
+
import { StepBinding } from '../bindings/step-binding';
|
|
3
|
+
import { ManagedScenarioContext } from './managed-scenario-context';
|
|
4
|
+
import EventEmitter from 'events';
|
|
5
|
+
import { EndTestCaseInfo } from './test-case-info';
|
|
6
|
+
import { IMessageData } from './parallel/types';
|
|
7
|
+
export interface ITestCaseAttempt {
|
|
8
|
+
attempt: number;
|
|
9
|
+
willBeRetried: boolean;
|
|
10
|
+
gherkinDocument: messages.GherkinDocument;
|
|
11
|
+
pickle: messages.Pickle;
|
|
12
|
+
stepAttachments: Record<string, messages.Attachment[]>;
|
|
13
|
+
stepResults: Record<string, messages.TestStepResult>;
|
|
14
|
+
testCase: messages.TestCase;
|
|
15
|
+
worstTestStepResult: messages.TestStepResult;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Custom implementation of the EventDataCollector from cucumber.js
|
|
19
|
+
*
|
|
20
|
+
* This implements all of the functions from the original EventDataCollector along
|
|
21
|
+
* with new functions to support binding to tsFlow tests.
|
|
22
|
+
*
|
|
23
|
+
* By extending the original version we're also reducing the amount of data stored
|
|
24
|
+
* during test runs because the original MessageCollector was capturing the same
|
|
25
|
+
* pickle and testCase data that the EventDataCollector does.
|
|
26
|
+
*/
|
|
27
|
+
export default class MessageCollector {
|
|
28
|
+
private gherkinDocumentMap;
|
|
29
|
+
private pickleMap;
|
|
30
|
+
private testCaseMap;
|
|
31
|
+
private testCaseAttemptDataMap;
|
|
32
|
+
private undefinedParameterTypes;
|
|
33
|
+
private testCaseRunningMap;
|
|
34
|
+
constructor(eventBroadcaster: EventEmitter);
|
|
35
|
+
/**
|
|
36
|
+
* Reset this message collector for a new parallel test run.
|
|
37
|
+
* @param messageData Gerkin information from initial load
|
|
38
|
+
*/
|
|
39
|
+
reset(messageData: IMessageData): void;
|
|
40
|
+
/**
|
|
41
|
+
* Get Gerkin message data for parallel runs
|
|
42
|
+
* @returns Gerkin informaion loaded during startup
|
|
43
|
+
*/
|
|
44
|
+
getMessageData(): IMessageData;
|
|
45
|
+
/**
|
|
46
|
+
* Check for failures in a test run
|
|
47
|
+
* @returns true if there are failures in the last test case attempt
|
|
48
|
+
*/
|
|
49
|
+
hasFailures(): boolean;
|
|
50
|
+
getGherkinDocument(uri: string): messages.GherkinDocument;
|
|
51
|
+
getPickle(pickleId: string): messages.Pickle;
|
|
52
|
+
getTestCaseAttempts(): ITestCaseAttempt[];
|
|
53
|
+
getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt;
|
|
54
|
+
parseEnvelope(envelope: messages.Envelope): void;
|
|
55
|
+
private initTestCaseAttempt;
|
|
56
|
+
storeAttachment(attachment: messages.Attachment): void;
|
|
57
|
+
storeTestStepResult({ testCaseStartedId, testStepId, testStepResult }: messages.TestStepFinished): void;
|
|
58
|
+
storeTestCaseResult({ testCaseStartedId, willBeRetried }: messages.TestCaseFinished): void;
|
|
59
|
+
/**
|
|
60
|
+
* Gets the Pickle from hook parameters passed in from Cucumber
|
|
61
|
+
* to find a matching Pickle (scenario) and return the scenario Context
|
|
62
|
+
* @param hookParam
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
getHookScenarioContext(hookParam: any): ManagedScenarioContext | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Uses StepPattern information to find a matching scenario
|
|
68
|
+
* and return the ScenarioContext
|
|
69
|
+
* @param stepBinding
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
getStepScenarioContext(stepBinding: StepBinding): ManagedScenarioContext | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Called when a test case (scenario) starts. Intercepting
|
|
75
|
+
* this message to initialize a new ScenarioContext
|
|
76
|
+
* @param testCaseStarted
|
|
77
|
+
*/
|
|
78
|
+
private startTestCase;
|
|
79
|
+
/**
|
|
80
|
+
* Called when a test case (scenario) ends. Intercepting
|
|
81
|
+
* this message to dispose and clear the ScenarioContext
|
|
82
|
+
* @param testCaseFinished
|
|
83
|
+
*/
|
|
84
|
+
endTestCase(endTestCase: EndTestCaseInfo): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Uses the testCaleId passed in to find the associated Pickle (scenario)
|
|
87
|
+
* @param testCaseId
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
private getScenarioForTest;
|
|
91
|
+
/**
|
|
92
|
+
* StepBinding tags are initialized with an astrick when empty.
|
|
93
|
+
* Need to make sure tags has a value and not an astrick
|
|
94
|
+
* @param tags
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
private stepHasTags;
|
|
98
|
+
}
|