@lynxwall/cucumber-tsflow 6.5.7 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -10
- 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 +18 -8
- 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 +8 -8
- 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 +17 -15
- package/lib/bindings/hook-decorators.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/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/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 +6 -4
- package/lib/index.js +30 -18
- package/lib/index.js.map +1 -0
- package/lib/junitbamboo.js +18 -8
- 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/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 +359 -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 +21 -0
- package/package.json +68 -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
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { WorkerToCoordinatorEvent, RunCommand } from '@cucumber/cucumber/lib/runtime/parallel/types';
|
|
2
|
+
import { InitializeTsflowCommand, CoordinatorToWorkerCommand } from './types';
|
|
3
|
+
type IExitFunction = (exitCode: number, error?: Error, message?: string) => void;
|
|
4
|
+
type IMessageSender = (command: WorkerToCoordinatorEvent) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Represents a child process running in parallel executions
|
|
7
|
+
*/
|
|
8
|
+
export declare class ChildProcessWorker {
|
|
9
|
+
private readonly cwd;
|
|
10
|
+
private readonly exit;
|
|
11
|
+
private readonly id;
|
|
12
|
+
private readonly eventBroadcaster;
|
|
13
|
+
private readonly newId;
|
|
14
|
+
private readonly sendMessage;
|
|
15
|
+
private options;
|
|
16
|
+
private supportCodeLibrary;
|
|
17
|
+
private worker;
|
|
18
|
+
constructor({ cwd, exit, id, sendMessage }: {
|
|
19
|
+
cwd: string;
|
|
20
|
+
exit: IExitFunction;
|
|
21
|
+
id: string;
|
|
22
|
+
sendMessage: IMessageSender;
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Initialize this child process worker
|
|
26
|
+
*/
|
|
27
|
+
initialize({ supportCodeCoordinates, supportCodeIds, options, messageData }: InitializeTsflowCommand): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Finialize the worker, which runs AfterAll hooks
|
|
30
|
+
*/
|
|
31
|
+
finalize(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Interaction with the main process and child workers is done through IPC communications
|
|
34
|
+
* This receives commands from the parent process and calls appropriate child operations.
|
|
35
|
+
* @param command commands sent to this worker
|
|
36
|
+
*/
|
|
37
|
+
receiveMessage(command: CoordinatorToWorkerCommand): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Run all test cases on the worker
|
|
40
|
+
* @param command RunCommand
|
|
41
|
+
*/
|
|
42
|
+
runTestCase(command: RunCommand): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
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.ChildProcessWorker = void 0;
|
|
7
|
+
const node_events_1 = require("node:events");
|
|
8
|
+
const node_url_1 = require("node:url");
|
|
9
|
+
const node_module_1 = require("node:module");
|
|
10
|
+
const messages_1 = require("@cucumber/messages");
|
|
11
|
+
const index_1 = __importDefault(require("@cucumber/cucumber/lib/support_code_library_builder/index"));
|
|
12
|
+
const try_require_1 = __importDefault(require("@cucumber/cucumber/lib/try_require"));
|
|
13
|
+
const worker_1 = require("../worker");
|
|
14
|
+
const logger_1 = __importDefault(require("../../utils/logger"));
|
|
15
|
+
const paths_1 = require("@cucumber/cucumber/lib/paths/paths");
|
|
16
|
+
const binding_registry_1 = require("../../bindings/binding-registry");
|
|
17
|
+
const message_collector_1 = __importDefault(require("../message-collector"));
|
|
18
|
+
const { uuid } = messages_1.IdGenerator;
|
|
19
|
+
/**
|
|
20
|
+
* Represents a child process running in parallel executions
|
|
21
|
+
*/
|
|
22
|
+
class ChildProcessWorker {
|
|
23
|
+
cwd;
|
|
24
|
+
exit;
|
|
25
|
+
id;
|
|
26
|
+
eventBroadcaster;
|
|
27
|
+
newId;
|
|
28
|
+
sendMessage;
|
|
29
|
+
options;
|
|
30
|
+
supportCodeLibrary;
|
|
31
|
+
worker;
|
|
32
|
+
constructor({ cwd, exit, id, sendMessage }) {
|
|
33
|
+
this.id = id;
|
|
34
|
+
this.newId = uuid();
|
|
35
|
+
this.cwd = cwd;
|
|
36
|
+
this.exit = exit;
|
|
37
|
+
this.sendMessage = sendMessage;
|
|
38
|
+
this.eventBroadcaster = new node_events_1.EventEmitter();
|
|
39
|
+
// initialize a message collector for this process to handle our
|
|
40
|
+
// integration with event data
|
|
41
|
+
global.messageCollector = new message_collector_1.default(this.eventBroadcaster);
|
|
42
|
+
// pass any envelope messages up to the parent process to keep our main
|
|
43
|
+
// message collector in sync with this one.
|
|
44
|
+
this.eventBroadcaster.on('envelope', (envelope) => this.sendMessage({ type: 'ENVELOPE', envelope }));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Initialize this child process worker
|
|
48
|
+
*/
|
|
49
|
+
async initialize({ supportCodeCoordinates, supportCodeIds, options, messageData }) {
|
|
50
|
+
// reset the message collector with message data passed in
|
|
51
|
+
global.messageCollector.reset(messageData);
|
|
52
|
+
// Get correct paths and reset the support code library
|
|
53
|
+
const resolvedPaths = await (0, paths_1.resolvePaths)(logger_1.default, this.cwd, messageData.coordinates, supportCodeCoordinates);
|
|
54
|
+
const { requirePaths, importPaths } = resolvedPaths;
|
|
55
|
+
index_1.default.reset(this.cwd, this.newId, {
|
|
56
|
+
requirePaths,
|
|
57
|
+
requireModules: supportCodeCoordinates.requireModules,
|
|
58
|
+
importPaths,
|
|
59
|
+
loaders: supportCodeCoordinates.loaders
|
|
60
|
+
});
|
|
61
|
+
// Load any require modules for CommonJS or loaders and imports for ESM
|
|
62
|
+
supportCodeCoordinates.requireModules.map(module => (0, try_require_1.default)(module));
|
|
63
|
+
requirePaths.map(module => (0, try_require_1.default)(module));
|
|
64
|
+
for (const specifier of supportCodeCoordinates.loaders) {
|
|
65
|
+
(0, node_module_1.register)(specifier, (0, node_url_1.pathToFileURL)('./'));
|
|
66
|
+
}
|
|
67
|
+
for (const path of supportCodeCoordinates.importPaths) {
|
|
68
|
+
await import((0, node_url_1.pathToFileURL)(path).toString());
|
|
69
|
+
}
|
|
70
|
+
// Finalize the support code library with IDs passed in and
|
|
71
|
+
// update entries in the library with info from our binding registry.
|
|
72
|
+
this.supportCodeLibrary = index_1.default.finalize(supportCodeIds);
|
|
73
|
+
this.supportCodeLibrary = binding_registry_1.BindingRegistry.instance.updateSupportCodeLibrary(this.supportCodeLibrary);
|
|
74
|
+
// Initialize a worker and run BeforeAll hooks
|
|
75
|
+
this.options = options;
|
|
76
|
+
this.worker = new worker_1.Worker(this.id, this.eventBroadcaster, this.newId, this.options, this.supportCodeLibrary);
|
|
77
|
+
await this.worker.runBeforeAllHooks();
|
|
78
|
+
this.sendMessage({ type: 'READY' });
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Finialize the worker, which runs AfterAll hooks
|
|
82
|
+
*/
|
|
83
|
+
async finalize() {
|
|
84
|
+
await this.worker.runAfterAllHooks();
|
|
85
|
+
this.exit(0);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Interaction with the main process and child workers is done through IPC communications
|
|
89
|
+
* This receives commands from the parent process and calls appropriate child operations.
|
|
90
|
+
* @param command commands sent to this worker
|
|
91
|
+
*/
|
|
92
|
+
async receiveMessage(command) {
|
|
93
|
+
switch (command.type) {
|
|
94
|
+
case 'INITIALIZE':
|
|
95
|
+
await this.initialize(command);
|
|
96
|
+
break;
|
|
97
|
+
case 'RUN':
|
|
98
|
+
await this.runTestCase(command);
|
|
99
|
+
break;
|
|
100
|
+
case 'FINALIZE':
|
|
101
|
+
await this.finalize();
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Run all test cases on the worker
|
|
107
|
+
* @param command RunCommand
|
|
108
|
+
*/
|
|
109
|
+
async runTestCase(command) {
|
|
110
|
+
const success = await this.worker.runTestCase(command.assembledTestCase, command.failing);
|
|
111
|
+
this.sendMessage({
|
|
112
|
+
type: 'FINISHED',
|
|
113
|
+
success
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.ChildProcessWorker = ChildProcessWorker;
|
|
118
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/runtime/parallel/worker.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA2C;AAC3C,uCAAyC;AACzC,6CAAuC;AACvC,iDAA2D;AAC3D,sGAAkG;AAElG,qFAA4D;AAE5D,sCAAmC;AAEnC,gEAAwC;AACxC,8DAAkE;AAClE,sEAAkE;AAElE,6EAAoD;AAEpD,MAAM,EAAE,IAAI,EAAE,GAAG,sBAAW,CAAC;AAK7B;;GAEG;AACH,MAAa,kBAAkB;IACb,GAAG,CAAS;IACZ,IAAI,CAAgB;IAEpB,EAAE,CAAS;IACX,gBAAgB,CAAe;IAC/B,KAAK,CAAoB;IACzB,WAAW,CAAiB;IACrC,OAAO,CAAkB;IACzB,kBAAkB,CAAsB;IACxC,MAAM,CAAU;IAExB,YAAY,EACX,GAAG,EACH,IAAI,EACJ,EAAE,EACF,WAAW,EAMX;QACA,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,gBAAgB,GAAG,IAAI,0BAAY,EAAE,CAAC;QAE3C,gEAAgE;QAChE,8BAA8B;QAC9B,MAAM,CAAC,gBAAgB,GAAG,IAAI,2BAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAEtE,uEAAuE;QACvE,2CAA2C;QAC3C,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAkB,EAAE,EAA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,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1F,IAAI,CAAC,WAAW,CAAC;YAChB,IAAI,EAAE,UAAU;YAChB,OAAO;SACP,CAAC,CAAC;IACJ,CAAC;CACD;AAvHD,gDAuHC","sourcesContent":["import { EventEmitter } from 'node:events';\r\nimport { pathToFileURL } from 'node:url';\r\nimport { register } from 'node:module';\r\nimport { Envelope, IdGenerator } from '@cucumber/messages';\r\nimport supportCodeLibraryBuilder from '@cucumber/cucumber/lib/support_code_library_builder/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport tryRequire from '@cucumber/cucumber/lib/try_require';\r\nimport { RuntimeOptions } from '@cucumber/cucumber/lib/runtime/index';\r\nimport { Worker } from '../worker';\r\nimport { WorkerToCoordinatorEvent, RunCommand } from '@cucumber/cucumber/lib/runtime/parallel/types';\r\nimport logger from '../../utils/logger';\r\nimport { resolvePaths } from '@cucumber/cucumber/lib/paths/paths';\r\nimport { BindingRegistry } from '../../bindings/binding-registry';\r\nimport { InitializeTsflowCommand, CoordinatorToWorkerCommand } from './types';\r\nimport MessageCollector from '../message-collector';\r\n\r\nconst { uuid } = IdGenerator;\r\n\r\ntype IExitFunction = (exitCode: number, error?: Error, message?: string) => void;\r\ntype IMessageSender = (command: WorkerToCoordinatorEvent) => void;\r\n\r\n/**\r\n * Represents a child process running in parallel executions\r\n */\r\nexport class ChildProcessWorker {\r\n\tprivate readonly cwd: string;\r\n\tprivate readonly exit: IExitFunction;\r\n\r\n\tprivate readonly id: string;\r\n\tprivate readonly eventBroadcaster: EventEmitter;\r\n\tprivate readonly newId: IdGenerator.NewId;\r\n\tprivate readonly sendMessage: IMessageSender;\r\n\tprivate options!: RuntimeOptions;\r\n\tprivate supportCodeLibrary!: SupportCodeLibrary;\r\n\tprivate worker!: Worker;\r\n\r\n\tconstructor({\r\n\t\tcwd,\r\n\t\texit,\r\n\t\tid,\r\n\t\tsendMessage\r\n\t}: {\r\n\t\tcwd: string;\r\n\t\texit: IExitFunction;\r\n\t\tid: string;\r\n\t\tsendMessage: IMessageSender;\r\n\t}) {\r\n\t\tthis.id = id;\r\n\t\tthis.newId = uuid();\r\n\t\tthis.cwd = cwd;\r\n\t\tthis.exit = exit;\r\n\t\tthis.sendMessage = sendMessage;\r\n\t\tthis.eventBroadcaster = new EventEmitter();\r\n\r\n\t\t// initialize a message collector for this process to handle our\r\n\t\t// integration with event data\r\n\t\tglobal.messageCollector = new MessageCollector(this.eventBroadcaster);\r\n\r\n\t\t// pass any envelope messages up to the parent process to keep our main\r\n\t\t// message collector in sync with this one.\r\n\t\tthis.eventBroadcaster.on('envelope', (envelope: Envelope) => this.sendMessage({ type: 'ENVELOPE', envelope }));\r\n\t}\r\n\r\n\t/**\r\n\t * Initialize this child process worker\r\n\t */\r\n\tasync initialize({\r\n\t\tsupportCodeCoordinates,\r\n\t\tsupportCodeIds,\r\n\t\toptions,\r\n\t\tmessageData\r\n\t}: InitializeTsflowCommand): Promise<void> {\r\n\t\t// reset the message collector with message data passed in\r\n\t\tglobal.messageCollector.reset(messageData);\r\n\r\n\t\t// Get correct paths and reset the support code library\r\n\t\tconst resolvedPaths = await resolvePaths(logger, this.cwd, messageData.coordinates, supportCodeCoordinates);\r\n\t\tconst { requirePaths, importPaths } = resolvedPaths;\r\n\t\tsupportCodeLibraryBuilder.reset(this.cwd, this.newId, {\r\n\t\t\trequirePaths,\r\n\t\t\trequireModules: supportCodeCoordinates.requireModules,\r\n\t\t\timportPaths,\r\n\t\t\tloaders: supportCodeCoordinates.loaders\r\n\t\t});\r\n\t\t// Load any require modules for CommonJS or loaders and imports for ESM\r\n\t\tsupportCodeCoordinates.requireModules.map(module => tryRequire(module));\r\n\t\trequirePaths.map(module => tryRequire(module));\r\n\t\tfor (const specifier of supportCodeCoordinates.loaders) {\r\n\t\t\tregister(specifier, pathToFileURL('./'));\r\n\t\t}\r\n\t\tfor (const path of supportCodeCoordinates.importPaths) {\r\n\t\t\tawait import(pathToFileURL(path).toString());\r\n\t\t}\r\n\t\t// Finalize the support code library with IDs passed in and\r\n\t\t// update entries in the library with info from our binding registry.\r\n\t\tthis.supportCodeLibrary = supportCodeLibraryBuilder.finalize(supportCodeIds);\r\n\t\tthis.supportCodeLibrary = BindingRegistry.instance.updateSupportCodeLibrary(this.supportCodeLibrary);\r\n\r\n\t\t// Initialize a worker and run BeforeAll hooks\r\n\t\tthis.options = options;\r\n\t\tthis.worker = new Worker(this.id, this.eventBroadcaster, this.newId, this.options, this.supportCodeLibrary);\r\n\t\tawait this.worker.runBeforeAllHooks();\r\n\t\tthis.sendMessage({ type: 'READY' });\r\n\t}\r\n\r\n\t/**\r\n\t * Finialize the worker, which runs AfterAll hooks\r\n\t */\r\n\tasync finalize(): Promise<void> {\r\n\t\tawait this.worker.runAfterAllHooks();\r\n\t\tthis.exit(0);\r\n\t}\r\n\r\n\t/**\r\n\t * Interaction with the main process and child workers is done through IPC communications\r\n\t * This receives commands from the parent process and calls appropriate child operations.\r\n\t * @param command commands sent to this worker\r\n\t */\r\n\tasync receiveMessage(command: CoordinatorToWorkerCommand): Promise<void> {\r\n\t\tswitch (command.type) {\r\n\t\t\tcase 'INITIALIZE':\r\n\t\t\t\tawait this.initialize(command);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'RUN':\r\n\t\t\t\tawait this.runTestCase(command);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'FINALIZE':\r\n\t\t\t\tawait this.finalize();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Run all test cases on the worker\r\n\t * @param command RunCommand\r\n\t */\r\n\tasync runTestCase(command: RunCommand): Promise<void> {\r\n\t\tconst success = await this.worker.runTestCase(command.assembledTestCase, command.failing);\r\n\t\tthis.sendMessage({\r\n\t\t\ttype: 'FINISHED',\r\n\t\t\tsuccess\r\n\t\t});\r\n\t}\r\n}\r\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { IdGenerator } from '@cucumber/messages';
|
|
3
|
+
import { RuntimeAdapter } from '@cucumber/cucumber/lib/runtime/types';
|
|
4
|
+
import { AssembledTestCase } from '@cucumber/cucumber/lib/assemble/index';
|
|
5
|
+
import { RuntimeOptions } from '@cucumber/cucumber/lib/runtime/index';
|
|
6
|
+
import { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';
|
|
7
|
+
export declare class InProcessAdapter implements RuntimeAdapter {
|
|
8
|
+
private readonly worker;
|
|
9
|
+
private failing;
|
|
10
|
+
constructor(eventBroadcaster: EventEmitter, newId: IdGenerator.NewId, options: RuntimeOptions, supportCodeLibrary: SupportCodeLibrary);
|
|
11
|
+
run(assembledTestCases: ReadonlyArray<AssembledTestCase>): Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InProcessAdapter = void 0;
|
|
4
|
+
const worker_1 = require("../worker");
|
|
5
|
+
class InProcessAdapter {
|
|
6
|
+
worker;
|
|
7
|
+
failing = false;
|
|
8
|
+
constructor(eventBroadcaster, newId, options, supportCodeLibrary) {
|
|
9
|
+
this.worker = new worker_1.Worker(undefined, eventBroadcaster, newId, options, supportCodeLibrary);
|
|
10
|
+
}
|
|
11
|
+
async run(assembledTestCases) {
|
|
12
|
+
await this.worker.runBeforeAllHooks();
|
|
13
|
+
for (const item of assembledTestCases) {
|
|
14
|
+
const success = await this.worker.runTestCase(item, this.failing);
|
|
15
|
+
if (!success) {
|
|
16
|
+
this.failing = true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
await this.worker.runAfterAllHooks();
|
|
20
|
+
return !this.failing;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.InProcessAdapter = InProcessAdapter;
|
|
24
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/runtime/serial/adapter.ts"],"names":[],"mappings":";;;AAIA,sCAAmC;AAInC,MAAa,gBAAgB;IACX,MAAM,CAAS;IACxB,OAAO,GAAY,KAAK,CAAC;IAEjC,YACC,gBAA8B,EAC9B,KAAwB,EACxB,OAAuB,EACvB,kBAAsC;QAEtC,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC3F,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,kBAAoD;QAC7D,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACtC,KAAK,MAAM,IAAI,IAAI,kBAAkB,EAAE,CAAC;YACvC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAClE,IAAI,CAAC,OAAO,EAAE,CAAC;gBACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACrB,CAAC;QACF,CAAC;QACD,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACD;AAxBD,4CAwBC","sourcesContent":["import { EventEmitter } from 'node:events';\r\nimport { IdGenerator } from '@cucumber/messages';\r\nimport { RuntimeAdapter } from '@cucumber/cucumber/lib/runtime/types';\r\nimport { AssembledTestCase } from '@cucumber/cucumber/lib/assemble/index';\r\nimport { Worker } from '../worker';\r\nimport { RuntimeOptions } from '@cucumber/cucumber/lib/runtime/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\n\r\nexport class InProcessAdapter implements RuntimeAdapter {\r\n\tprivate readonly worker: Worker;\r\n\tprivate failing: boolean = false;\r\n\r\n\tconstructor(\r\n\t\teventBroadcaster: EventEmitter,\r\n\t\tnewId: IdGenerator.NewId,\r\n\t\toptions: RuntimeOptions,\r\n\t\tsupportCodeLibrary: SupportCodeLibrary\r\n\t) {\r\n\t\tthis.worker = new Worker(undefined, eventBroadcaster, newId, options, supportCodeLibrary);\r\n\t}\r\n\r\n\tasync run(assembledTestCases: ReadonlyArray<AssembledTestCase>): Promise<boolean> {\r\n\t\tawait this.worker.runBeforeAllHooks();\r\n\t\tfor (const item of assembledTestCases) {\r\n\t\t\tconst success = await this.worker.runTestCase(item, this.failing);\r\n\t\t\tif (!success) {\r\n\t\t\t\tthis.failing = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tawait this.worker.runAfterAllHooks();\r\n\t\treturn !this.failing;\r\n\t}\r\n}\r\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { GherkinDocument, Pickle, TestStepResult } from '@cucumber/messages';
|
|
2
|
+
/**
|
|
3
|
+
* Parameter passed into initialize() at the
|
|
4
|
+
* start of a test case (scenario) before most
|
|
5
|
+
* hooks and all steps
|
|
6
|
+
*/
|
|
7
|
+
export interface StartTestCaseInfo {
|
|
8
|
+
gherkinDocument: GherkinDocument;
|
|
9
|
+
pickle: Pickle;
|
|
10
|
+
testCaseStartedId: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parameter passed into dispost() at the
|
|
14
|
+
* end of a test case (scenario) after the
|
|
15
|
+
* last After hook has executed.
|
|
16
|
+
*/
|
|
17
|
+
export interface EndTestCaseInfo {
|
|
18
|
+
gherkinDocument: GherkinDocument;
|
|
19
|
+
pickle: Pickle;
|
|
20
|
+
result: TestStepResult;
|
|
21
|
+
willBeRetried: boolean;
|
|
22
|
+
testCaseStartedId: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-case-info.js","sourceRoot":"","sources":["../../src/runtime/test-case-info.ts"],"names":[],"mappings":"","sourcesContent":["import type { GherkinDocument, Pickle, TestStepResult } from '@cucumber/messages';\r\n\r\n/**\r\n * Parameter passed into initialize() at the\r\n * start of a test case (scenario) before most\r\n * hooks and all steps\r\n */\r\nexport interface StartTestCaseInfo {\r\n\tgherkinDocument: GherkinDocument;\r\n\tpickle: Pickle;\r\n\ttestCaseStartedId: string;\r\n}\r\n\r\n/**\r\n * Parameter passed into dispost() at the\r\n * end of a test case (scenario) after the\r\n * last After hook has executed.\r\n */\r\nexport interface EndTestCaseInfo {\r\n\tgherkinDocument: GherkinDocument;\r\n\tpickle: Pickle;\r\n\tresult: TestStepResult;\r\n\twillBeRetried: boolean;\r\n\ttestCaseStartedId: string;\r\n}\r\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { INewTestCaseRunnerOptions } from '@cucumber/cucumber/lib/runtime/test_case_runner';
|
|
2
|
+
import * as messages from '@cucumber/messages';
|
|
3
|
+
import { ITestCaseHookParameter } from '@cucumber/cucumber/lib/support_code_library_builder/types';
|
|
4
|
+
import TestCaseHookDefinition from '@cucumber/cucumber/lib/models/test_case_hook_definition';
|
|
5
|
+
import TestStepHookDefinition from '@cucumber/cucumber/lib/models/test_step_hook_definition';
|
|
6
|
+
import { IDefinition } from '@cucumber/cucumber/lib/models/definition';
|
|
7
|
+
import { StepBinding } from '../types/step-binding';
|
|
8
|
+
import { ManagedScenarioContext } from './managed-scenario-context';
|
|
9
|
+
export default class TestCaseRunner {
|
|
10
|
+
private readonly workerId;
|
|
11
|
+
private readonly attachmentManager;
|
|
12
|
+
private currentTestCaseStartedId?;
|
|
13
|
+
private currentTestStepId?;
|
|
14
|
+
private readonly eventBroadcaster;
|
|
15
|
+
private readonly gherkinDocument;
|
|
16
|
+
private readonly newId;
|
|
17
|
+
private readonly pickle;
|
|
18
|
+
private readonly testCase;
|
|
19
|
+
private readonly maxAttempts;
|
|
20
|
+
private readonly skip;
|
|
21
|
+
private readonly filterStackTraces;
|
|
22
|
+
private readonly supportCodeLibrary;
|
|
23
|
+
private testStepResults?;
|
|
24
|
+
private world;
|
|
25
|
+
private readonly worldParameters;
|
|
26
|
+
private bindingRegistry;
|
|
27
|
+
constructor({ workerId, eventBroadcaster, gherkinDocument, newId, pickle, testCase, retries, skip, filterStackTraces, supportCodeLibrary, worldParameters }: INewTestCaseRunnerOptions);
|
|
28
|
+
resetTestProgressData(): void;
|
|
29
|
+
getBeforeStepHookDefinitions(): TestStepHookDefinition[];
|
|
30
|
+
getAfterStepHookDefinitions(): TestStepHookDefinition[];
|
|
31
|
+
getWorstStepResult(): messages.TestStepResult;
|
|
32
|
+
invokeStep(stepParam: messages.PickleStep | null, stepDefinition: IDefinition, hookParameter?: any): Promise<messages.TestStepResult>;
|
|
33
|
+
isSkippingSteps(): boolean;
|
|
34
|
+
shouldSkipHook(isBeforeHook: boolean): boolean;
|
|
35
|
+
aroundTestStep(testStepId: string, runStepFn: () => Promise<messages.TestStepResult>): Promise<void>;
|
|
36
|
+
run(): Promise<messages.TestStepResultStatus>;
|
|
37
|
+
runAttempt(attempt: number, moreAttemptsRemaining: boolean): Promise<boolean>;
|
|
38
|
+
runHook(hookDefinition: TestCaseHookDefinition, hookParameter: ITestCaseHookParameter, isBeforeHook: boolean): Promise<messages.TestStepResult>;
|
|
39
|
+
runStepHooks(stepHooks: TestStepHookDefinition[], pickleStep: messages.PickleStep, stepResult?: messages.TestStepResult): Promise<messages.TestStepResult[]>;
|
|
40
|
+
runStep(pickleStep: messages.PickleStep, testStep: messages.TestStep): Promise<messages.TestStepResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Helper used to initialize any context types that are passed into
|
|
43
|
+
* a binding class before any hooks or steps are executed.
|
|
44
|
+
* @param stepBinding
|
|
45
|
+
* @param scenarioContext
|
|
46
|
+
*/
|
|
47
|
+
initializeContext(stepBinding: StepBinding, scenarioContext: ManagedScenarioContext): Promise<void>;
|
|
48
|
+
}
|