@lynxwall/cucumber-tsflow 7.1.0 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +2 -1
  2. package/lib/version.d.ts +1 -1
  3. package/lib/version.js +1 -1
  4. package/lib/version.js.map +1 -1
  5. package/package.json +7 -5
  6. package/lib/cli/load-configuration.d.ts +0 -21
  7. package/lib/cli/load-configuration.js +0 -124
  8. package/lib/cli/load-configuration.js.map +0 -1
  9. package/lib/cucumber/coordinator.d.ts +0 -15
  10. package/lib/cucumber/coordinator.js +0 -40
  11. package/lib/cucumber/coordinator.js.map +0 -1
  12. package/lib/cucumber/make-runtime.d.ts +0 -21
  13. package/lib/cucumber/make-runtime.js +0 -17
  14. package/lib/cucumber/make-runtime.js.map +0 -1
  15. package/lib/cucumber/managed-scenario-context.d.ts +0 -52
  16. package/lib/cucumber/managed-scenario-context.js +0 -149
  17. package/lib/cucumber/managed-scenario-context.js.map +0 -1
  18. package/lib/cucumber/message-collector.d.ts +0 -87
  19. package/lib/cucumber/message-collector.js +0 -280
  20. package/lib/cucumber/message-collector.js.map +0 -1
  21. package/lib/cucumber/parallel/adapter.d.ts +0 -46
  22. package/lib/cucumber/parallel/adapter.js +0 -156
  23. package/lib/cucumber/parallel/adapter.js.map +0 -1
  24. package/lib/cucumber/parallel/run-worker.d.ts +0 -1
  25. package/lib/cucumber/parallel/run-worker.js +0 -24
  26. package/lib/cucumber/parallel/run-worker.js.map +0 -1
  27. package/lib/cucumber/parallel/worker.d.ts +0 -26
  28. package/lib/cucumber/parallel/worker.js +0 -95
  29. package/lib/cucumber/parallel/worker.js.map +0 -1
  30. package/lib/cucumber/run-cucumber.d.ts +0 -16
  31. package/lib/cucumber/run-cucumber.js +0 -139
  32. package/lib/cucumber/run-cucumber.js.map +0 -1
  33. package/lib/cucumber/serial/adapter.d.ts +0 -12
  34. package/lib/cucumber/serial/adapter.js +0 -24
  35. package/lib/cucumber/serial/adapter.js.map +0 -1
  36. package/lib/cucumber/test-case-info.d.ts +0 -23
  37. package/lib/cucumber/test-case-info.js +0 -3
  38. package/lib/cucumber/test-case-info.js.map +0 -1
  39. package/lib/cucumber/test-case-runner.d.ts +0 -48
  40. package/lib/cucumber/test-case-runner.js +0 -359
  41. package/lib/cucumber/test-case-runner.js.map +0 -1
  42. package/lib/cucumber/utils.d.ts +0 -16
  43. package/lib/cucumber/utils.js +0 -78
  44. package/lib/cucumber/utils.js.map +0 -1
  45. package/lib/cucumber/worker.d.ts +0 -17
  46. package/lib/cucumber/worker.js +0 -57
  47. package/lib/cucumber/worker.js.map +0 -1
  48. package/lib/formatters/behave-json-formatter.d.ts +0 -49
  49. package/lib/formatters/behave-json-formatter.js +0 -85
  50. package/lib/formatters/behave-json-formatter.js.map +0 -1
  51. package/lib/formatters/junit-bamboo-formatter.d.ts +0 -17
  52. package/lib/formatters/junit-bamboo-formatter.js +0 -175
  53. package/lib/formatters/junit-bamboo-formatter.js.map +0 -1
  54. package/lib/formatters/tsflow-snippet-syntax.d.ts +0 -9
  55. package/lib/formatters/tsflow-snippet-syntax.js +0 -89
  56. package/lib/formatters/tsflow-snippet-syntax.js.map +0 -1
  57. package/lib/types/parallel.d.ts +0 -11
  58. package/lib/types/parallel.js +0 -3
  59. package/lib/types/parallel.js.map +0 -1
  60. package/lib/types/scenario-context.d.ts +0 -16
  61. package/lib/types/scenario-context.js +0 -18
  62. package/lib/types/scenario-context.js.map +0 -1
  63. package/lib/types/scenario-info.d.ts +0 -16
  64. package/lib/types/scenario-info.js +0 -23
  65. package/lib/types/scenario-info.js.map +0 -1
  66. package/lib/types/step-binding-flags.d.ts +0 -53
  67. package/lib/types/step-binding-flags.js +0 -59
  68. package/lib/types/step-binding-flags.js.map +0 -1
  69. package/lib/types/step-binding.d.ts +0 -60
  70. package/lib/types/step-binding.js +0 -18
  71. package/lib/types/step-binding.js.map +0 -1
  72. package/lib/types/types.d.ts +0 -22
  73. package/lib/types/types.js +0 -3
  74. package/lib/types/types.js.map +0 -1
@@ -1,359 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __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 };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- const helpers_1 = require("@cucumber/cucumber/lib/runtime/helpers");
40
- const index_1 = __importDefault(require("@cucumber/cucumber/lib/runtime/attachment_manager/index"));
41
- const step_runner_1 = __importDefault(require("@cucumber/cucumber/lib/runtime/step_runner"));
42
- const messages = __importStar(require("@cucumber/messages"));
43
- const messages_1 = require("@cucumber/messages");
44
- const value_checker_1 = require("@cucumber/cucumber/lib/value_checker");
45
- const binding_registry_1 = require("../bindings/binding-registry");
46
- const console_1 = require("console");
47
- const stopwatch_1 = require("@cucumber/cucumber/lib/runtime/stopwatch");
48
- class TestCaseRunner {
49
- workerId;
50
- attachmentManager;
51
- currentTestCaseStartedId;
52
- currentTestStepId;
53
- eventBroadcaster;
54
- gherkinDocument;
55
- newId;
56
- pickle;
57
- testCase;
58
- maxAttempts;
59
- skip;
60
- filterStackTraces;
61
- supportCodeLibrary;
62
- testStepResults;
63
- world;
64
- worldParameters;
65
- bindingRegistry;
66
- constructor({ workerId, eventBroadcaster, gherkinDocument, newId, pickle, testCase, retries = 0, skip, filterStackTraces, supportCodeLibrary, worldParameters }) {
67
- this.attachmentManager = new index_1.default(({ data, media, fileName }) => {
68
- if ((0, value_checker_1.doesNotHaveValue)(this.currentTestStepId)) {
69
- throw new Error('Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish.');
70
- }
71
- const attachment = {
72
- attachment: {
73
- body: data,
74
- contentEncoding: media.encoding,
75
- mediaType: media.contentType,
76
- fileName,
77
- testCaseStartedId: this.currentTestCaseStartedId,
78
- testStepId: this.currentTestStepId
79
- }
80
- };
81
- this.eventBroadcaster.emit('envelope', attachment);
82
- });
83
- this.workerId = workerId;
84
- this.attachmentManager = new index_1.default(({ data, media, fileName }) => {
85
- if ((0, value_checker_1.doesNotHaveValue)(this.currentTestStepId)) {
86
- throw new Error('Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish.');
87
- }
88
- const attachment = {
89
- attachment: {
90
- body: data,
91
- contentEncoding: media.encoding,
92
- mediaType: media.contentType,
93
- fileName,
94
- testCaseStartedId: this.currentTestCaseStartedId,
95
- testStepId: this.currentTestStepId
96
- }
97
- };
98
- this.eventBroadcaster.emit('envelope', attachment);
99
- });
100
- this.eventBroadcaster = eventBroadcaster;
101
- this.gherkinDocument = gherkinDocument;
102
- this.maxAttempts = 1 + (skip ? 0 : retries);
103
- this.newId = newId;
104
- this.pickle = pickle;
105
- this.testCase = testCase;
106
- this.skip = skip;
107
- this.filterStackTraces = filterStackTraces;
108
- this.supportCodeLibrary = supportCodeLibrary;
109
- this.worldParameters = worldParameters;
110
- this.resetTestProgressData();
111
- this.bindingRegistry = binding_registry_1.BindingRegistry.instance;
112
- }
113
- resetTestProgressData() {
114
- this.world = new this.supportCodeLibrary.World({
115
- attach: this.attachmentManager.create.bind(this.attachmentManager),
116
- log: this.attachmentManager.log.bind(this.attachmentManager),
117
- link: this.attachmentManager.link.bind(this.attachmentManager),
118
- parameters: structuredClone(this.worldParameters)
119
- });
120
- this.testStepResults = [];
121
- }
122
- getBeforeStepHookDefinitions() {
123
- return this.supportCodeLibrary.beforeTestStepHookDefinitions.filter(hookDefinition => hookDefinition.appliesToTestCase(this.pickle));
124
- }
125
- getAfterStepHookDefinitions() {
126
- return this.supportCodeLibrary.afterTestStepHookDefinitions
127
- .slice(0)
128
- .reverse()
129
- .filter(hookDefinition => hookDefinition.appliesToTestCase(this.pickle));
130
- }
131
- getWorstStepResult() {
132
- if (!this.testStepResults || this.testStepResults.length === 0) {
133
- return {
134
- status: this.skip ? messages.TestStepResultStatus.SKIPPED : messages.TestStepResultStatus.PASSED,
135
- duration: messages.TimeConversion.millisecondsToDuration(0)
136
- };
137
- }
138
- return (0, messages_1.getWorstTestStepResult)(this.testStepResults);
139
- }
140
- async invokeStep(stepParam, stepDefinition, hookParameter) {
141
- const step = stepParam;
142
- return await step_runner_1.default.run({
143
- defaultTimeout: this.supportCodeLibrary.defaultTimeout,
144
- filterStackTraces: this.filterStackTraces,
145
- hookParameter,
146
- step,
147
- stepDefinition,
148
- world: this.world
149
- });
150
- }
151
- isSkippingSteps() {
152
- return this.getWorstStepResult().status !== messages.TestStepResultStatus.PASSED;
153
- }
154
- shouldSkipHook(isBeforeHook) {
155
- return this.skip || (this.isSkippingSteps() && isBeforeHook);
156
- }
157
- async aroundTestStep(testStepId, runStepFn) {
158
- const testStepStarted = {
159
- testStepStarted: {
160
- testCaseStartedId: this.currentTestCaseStartedId,
161
- testStepId,
162
- timestamp: (0, stopwatch_1.timestamp)()
163
- }
164
- };
165
- this.eventBroadcaster.emit('envelope', testStepStarted);
166
- this.currentTestStepId = testStepId;
167
- const testStepResult = await runStepFn();
168
- this.currentTestStepId = undefined;
169
- this.testStepResults?.push(testStepResult);
170
- const testStepFinished = {
171
- testStepFinished: {
172
- testCaseStartedId: this.currentTestCaseStartedId,
173
- testStepId,
174
- testStepResult,
175
- timestamp: (0, stopwatch_1.timestamp)()
176
- }
177
- };
178
- this.eventBroadcaster.emit('envelope', testStepFinished);
179
- }
180
- async run() {
181
- for (let attempt = 0; attempt < this.maxAttempts; attempt++) {
182
- const moreAttemptsRemaining = attempt + 1 < this.maxAttempts;
183
- const willBeRetried = await this.runAttempt(attempt, moreAttemptsRemaining);
184
- if (!willBeRetried) {
185
- break;
186
- }
187
- this.resetTestProgressData();
188
- }
189
- return this.getWorstStepResult().status;
190
- }
191
- async runAttempt(attempt, moreAttemptsRemaining) {
192
- this.currentTestCaseStartedId = this.newId();
193
- const testCaseStarted = {
194
- testCaseStarted: {
195
- attempt,
196
- testCaseId: this.testCase.id,
197
- id: this.currentTestCaseStartedId,
198
- timestamp: (0, stopwatch_1.timestamp)()
199
- }
200
- };
201
- this.eventBroadcaster.emit('envelope', testCaseStarted);
202
- // used to determine whether a hook is a Before or After
203
- let didWeRunStepsYet = false;
204
- for (const testStep of this.testCase.testSteps) {
205
- await this.aroundTestStep(testStep.id, async () => {
206
- if ((0, value_checker_1.doesHaveValue)(testStep.hookId)) {
207
- const hookParameter = {
208
- gherkinDocument: this.gherkinDocument,
209
- pickle: this.pickle,
210
- testCaseStartedId: this.currentTestCaseStartedId
211
- };
212
- if (didWeRunStepsYet) {
213
- hookParameter.result = this.getWorstStepResult();
214
- hookParameter.willBeRetried =
215
- this.getWorstStepResult().status === messages.TestStepResultStatus.FAILED && moreAttemptsRemaining;
216
- }
217
- return await this.runHook(findHookDefinition(testStep.hookId, this.supportCodeLibrary), hookParameter, !didWeRunStepsYet);
218
- }
219
- else {
220
- const pickleStep = this.pickle.steps.find(pickleStep => pickleStep.id === testStep.pickleStepId);
221
- const testStepResult = await this.runStep(pickleStep, testStep);
222
- didWeRunStepsYet = true;
223
- return testStepResult;
224
- }
225
- });
226
- }
227
- const worseResult = this.getWorstStepResult();
228
- const willBeRetried = worseResult.status === messages.TestStepResultStatus.FAILED && moreAttemptsRemaining;
229
- const endTestCaseParameter = {
230
- gherkinDocument: this.gherkinDocument,
231
- pickle: this.pickle,
232
- testCaseStartedId: this.currentTestCaseStartedId,
233
- result: worseResult,
234
- willBeRetried: willBeRetried
235
- };
236
- // End test case will call dispose on all context types
237
- // passed into a binding and then end the context.
238
- await global.messageCollector.endTestCase(endTestCaseParameter);
239
- const testCaseFinished = {
240
- testCaseFinished: {
241
- testCaseStartedId: this.currentTestCaseStartedId,
242
- timestamp: (0, stopwatch_1.timestamp)(),
243
- willBeRetried
244
- }
245
- };
246
- this.eventBroadcaster.emit('envelope', testCaseFinished);
247
- return willBeRetried;
248
- }
249
- async runHook(hookDefinition, hookParameter, isBeforeHook) {
250
- if (this.shouldSkipHook(isBeforeHook)) {
251
- return {
252
- status: messages.TestStepResultStatus.SKIPPED,
253
- duration: messages.TimeConversion.millisecondsToDuration(0)
254
- };
255
- }
256
- // Get the step binding and scenario context so that we can
257
- // initialize any context objects before hooks are executed
258
- const stepBinding = this.bindingRegistry.getStepBindingByCucumberKey(hookDefinition.options.cucumberKey);
259
- if (!stepBinding)
260
- throw (0, console_1.error)('Unable to find StepBinding!');
261
- const scenarioContext = global.messageCollector.getHookScenarioContext(hookParameter);
262
- if (!scenarioContext)
263
- throw (0, console_1.error)('Unable to find the ManagedScenarioContext!');
264
- await this.initializeContext(stepBinding, scenarioContext);
265
- return await this.invokeStep(null, hookDefinition, hookParameter);
266
- }
267
- async runStepHooks(stepHooks, pickleStep, stepResult) {
268
- const stepHooksResult = [];
269
- const hookParameter = {
270
- gherkinDocument: this.gherkinDocument,
271
- pickle: this.pickle,
272
- pickleStep,
273
- testCaseStartedId: this.currentTestCaseStartedId,
274
- testStepId: this.currentTestStepId,
275
- result: stepResult
276
- };
277
- for (const stepHookDefinition of stepHooks) {
278
- stepHooksResult.push(await this.invokeStep(null, stepHookDefinition, hookParameter));
279
- }
280
- return stepHooksResult;
281
- }
282
- async runStep(pickleStep, testStep) {
283
- const stepDefinitions = testStep.stepDefinitionIds?.map(stepDefinitionId => {
284
- return findStepDefinition(stepDefinitionId, this.supportCodeLibrary);
285
- });
286
- if (!stepDefinitions || stepDefinitions.length === 0) {
287
- return {
288
- status: messages.TestStepResultStatus.UNDEFINED,
289
- duration: messages.TimeConversion.millisecondsToDuration(0)
290
- };
291
- }
292
- else if (stepDefinitions.length > 1) {
293
- return {
294
- message: (0, helpers_1.getAmbiguousStepException)(stepDefinitions),
295
- status: messages.TestStepResultStatus.AMBIGUOUS,
296
- duration: messages.TimeConversion.millisecondsToDuration(0)
297
- };
298
- }
299
- else if (this.isSkippingSteps()) {
300
- return {
301
- status: messages.TestStepResultStatus.SKIPPED,
302
- duration: messages.TimeConversion.millisecondsToDuration(0)
303
- };
304
- }
305
- // Get the step binding and scenario context so that we can
306
- // initialize any context objects before hooks are executed
307
- const stepBinding = this.bindingRegistry.getStepBindingByCucumberKey(stepDefinitions[0].options.cucumberKey);
308
- if (!stepBinding)
309
- throw (0, console_1.error)('Unable to find StepBinding!');
310
- const scenarioContext = global.messageCollector.getStepScenarioContext(stepBinding);
311
- if (!scenarioContext)
312
- throw (0, console_1.error)('Unable to find the ManagedScenarioContext!');
313
- await this.initializeContext(stepBinding, scenarioContext);
314
- // next execute any before step hooks followed by the step if there are no
315
- // failures in before step hooks.
316
- let stepResult;
317
- let stepResults = await this.runStepHooks(this.getBeforeStepHookDefinitions(), pickleStep);
318
- if ((0, messages_1.getWorstTestStepResult)(stepResults).status !== messages.TestStepResultStatus.FAILED) {
319
- stepResult = await this.invokeStep(pickleStep, stepDefinitions[0]);
320
- stepResults.push(stepResult);
321
- }
322
- // run the after step hooks
323
- const afterStepHookResults = await this.runStepHooks(this.getAfterStepHookDefinitions(), pickleStep, stepResult);
324
- stepResults = stepResults.concat(afterStepHookResults);
325
- const finalStepResult = (0, messages_1.getWorstTestStepResult)(stepResults);
326
- let finalDuration = messages.TimeConversion.millisecondsToDuration(0);
327
- for (const result of stepResults) {
328
- finalDuration = messages.TimeConversion.addDurations(finalDuration, result.duration);
329
- }
330
- finalStepResult.duration = finalDuration;
331
- return finalStepResult;
332
- }
333
- /**
334
- * Helper used to initialize any context types that are passed into
335
- * a binding class before any hooks or steps are executed.
336
- * @param stepBinding
337
- * @param scenarioContext
338
- */
339
- async initializeContext(stepBinding, scenarioContext) {
340
- const contextTypes = this.bindingRegistry.getContextTypesForClass(stepBinding.classPrototype);
341
- if (contextTypes.length > 0) {
342
- scenarioContext.getOrActivateBindingClass(stepBinding.classPrototype, contextTypes, this.world);
343
- const startTestCaseParameter = {
344
- gherkinDocument: this.gherkinDocument,
345
- pickle: this.pickle,
346
- testCaseStartedId: this.currentTestCaseStartedId
347
- };
348
- await scenarioContext.initialize(startTestCaseParameter);
349
- }
350
- }
351
- }
352
- exports.default = TestCaseRunner;
353
- function findHookDefinition(id, supportCodeLibrary) {
354
- return [...supportCodeLibrary.beforeTestCaseHookDefinitions, ...supportCodeLibrary.afterTestCaseHookDefinitions].find(definition => definition.id === id);
355
- }
356
- function findStepDefinition(id, supportCodeLibrary) {
357
- return supportCodeLibrary.stepDefinitions.find(definition => definition.id === id);
358
- }
359
- //# sourceMappingURL=test-case-runner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-case-runner.js","sourceRoot":"","sources":["../../src/cucumber/test-case-runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAAmF;AAEnF,oGAA+G;AAC/G,6FAAoE;AACpE,6DAA+C;AAC/C,iDAAyE;AAUzE,wEAAuF;AAEvF,mEAA+D;AAG/D,qCAAgC;AAGhC,wEAAqE;AA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CACpH,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CACjC,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,EAAU,EAAE,kBAAsC;IAC7E,OAAO,kBAAkB,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAE,CAAC;AACrF,CAAC","sourcesContent":["import { getAmbiguousStepException } from '@cucumber/cucumber/lib/runtime/helpers';\r\nimport { INewTestCaseRunnerOptions } from '@cucumber/cucumber/lib/runtime/test_case_runner';\r\nimport AttachmentManager, { ICreateAttachment } from '@cucumber/cucumber/lib/runtime/attachment_manager/index';\r\nimport StepRunner from '@cucumber/cucumber/lib/runtime/step_runner';\r\nimport * as messages from '@cucumber/messages';\r\nimport { getWorstTestStepResult, IdGenerator } from '@cucumber/messages';\r\nimport { EventEmitter } from 'events';\r\nimport {\r\n\tSupportCodeLibrary,\r\n\tITestCaseHookParameter,\r\n\tITestStepHookParameter\r\n} from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport TestCaseHookDefinition from '@cucumber/cucumber/lib/models/test_case_hook_definition';\r\nimport TestStepHookDefinition from '@cucumber/cucumber/lib/models/test_step_hook_definition';\r\nimport { IDefinition } from '@cucumber/cucumber/lib/models/definition';\r\nimport { doesHaveValue, doesNotHaveValue } from '@cucumber/cucumber/lib/value_checker';\r\nimport StepDefinition from '@cucumber/cucumber/lib/models/step_definition';\r\nimport { BindingRegistry } from '../bindings/binding-registry';\r\nimport { StepBinding } from '../types/step-binding';\r\nimport { ManagedScenarioContext } from './managed-scenario-context';\r\nimport { error } from 'console';\r\nimport { EndTestCaseInfo, StartTestCaseInfo } from './test-case-info';\r\nimport { IWorldOptions } from '@cucumber/cucumber/lib/support_code_library_builder/world';\r\nimport { timestamp } from '@cucumber/cucumber/lib/runtime/stopwatch';\r\n\r\nexport default class TestCaseRunner {\r\n\tprivate readonly workerId: string | undefined;\r\n\tprivate readonly attachmentManager: AttachmentManager;\r\n\tprivate currentTestCaseStartedId?: string;\r\n\tprivate currentTestStepId?: string;\r\n\tprivate readonly eventBroadcaster: EventEmitter;\r\n\tprivate readonly gherkinDocument: messages.GherkinDocument;\r\n\tprivate readonly newId: IdGenerator.NewId;\r\n\tprivate readonly pickle: messages.Pickle;\r\n\tprivate readonly testCase: messages.TestCase;\r\n\tprivate readonly maxAttempts: number;\r\n\tprivate readonly skip: boolean;\r\n\tprivate readonly filterStackTraces: boolean;\r\n\tprivate readonly supportCodeLibrary: SupportCodeLibrary;\r\n\tprivate testStepResults?: messages.TestStepResult[];\r\n\tprivate world: any;\r\n\tprivate readonly worldParameters: any;\r\n\tprivate bindingRegistry: BindingRegistry;\r\n\r\n\tconstructor({\r\n\t\tworkerId,\r\n\t\teventBroadcaster,\r\n\t\tgherkinDocument,\r\n\t\tnewId,\r\n\t\tpickle,\r\n\t\ttestCase,\r\n\t\tretries = 0,\r\n\t\tskip,\r\n\t\tfilterStackTraces,\r\n\t\tsupportCodeLibrary,\r\n\t\tworldParameters\r\n\t}: INewTestCaseRunnerOptions) {\r\n\t\tthis.attachmentManager = new AttachmentManager(({ data, media, fileName }) => {\r\n\t\t\tif (doesNotHaveValue(this.currentTestStepId)) {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t'Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish.'\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tconst attachment: messages.Envelope = {\r\n\t\t\t\tattachment: {\r\n\t\t\t\t\tbody: data,\r\n\t\t\t\t\tcontentEncoding: media.encoding,\r\n\t\t\t\t\tmediaType: media.contentType,\r\n\t\t\t\t\tfileName,\r\n\t\t\t\t\ttestCaseStartedId: this.currentTestCaseStartedId,\r\n\t\t\t\t\ttestStepId: this.currentTestStepId\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tthis.eventBroadcaster.emit('envelope', attachment);\r\n\t\t});\r\n\t\tthis.workerId = workerId;\r\n\t\tthis.attachmentManager = new AttachmentManager(({ data, media, fileName }) => {\r\n\t\t\tif (doesNotHaveValue(this.currentTestStepId)) {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t'Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish.'\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tconst attachment: messages.Envelope = {\r\n\t\t\t\tattachment: {\r\n\t\t\t\t\tbody: data,\r\n\t\t\t\t\tcontentEncoding: media.encoding,\r\n\t\t\t\t\tmediaType: media.contentType,\r\n\t\t\t\t\tfileName,\r\n\t\t\t\t\ttestCaseStartedId: this.currentTestCaseStartedId,\r\n\t\t\t\t\ttestStepId: this.currentTestStepId\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tthis.eventBroadcaster.emit('envelope', attachment);\r\n\t\t});\r\n\t\tthis.eventBroadcaster = eventBroadcaster;\r\n\t\tthis.gherkinDocument = gherkinDocument;\r\n\t\tthis.maxAttempts = 1 + (skip ? 0 : retries);\r\n\t\tthis.newId = newId;\r\n\t\tthis.pickle = pickle;\r\n\t\tthis.testCase = testCase;\r\n\t\tthis.skip = skip;\r\n\t\tthis.filterStackTraces = filterStackTraces;\r\n\t\tthis.supportCodeLibrary = supportCodeLibrary;\r\n\t\tthis.worldParameters = worldParameters;\r\n\t\tthis.resetTestProgressData();\r\n\t\tthis.bindingRegistry = BindingRegistry.instance;\r\n\t}\r\n\r\n\tresetTestProgressData(): void {\r\n\t\tthis.world = new this.supportCodeLibrary.World({\r\n\t\t\tattach: this.attachmentManager.create.bind(this.attachmentManager) as unknown as ICreateAttachment,\r\n\t\t\tlog: this.attachmentManager.log.bind(this.attachmentManager),\r\n\t\t\tlink: this.attachmentManager.link.bind(this.attachmentManager),\r\n\t\t\tparameters: structuredClone(this.worldParameters)\r\n\t\t} satisfies IWorldOptions);\r\n\t\tthis.testStepResults = [];\r\n\t}\r\n\r\n\tgetBeforeStepHookDefinitions(): TestStepHookDefinition[] {\r\n\t\treturn this.supportCodeLibrary.beforeTestStepHookDefinitions.filter(hookDefinition =>\r\n\t\t\thookDefinition.appliesToTestCase(this.pickle)\r\n\t\t);\r\n\t}\r\n\r\n\tgetAfterStepHookDefinitions(): TestStepHookDefinition[] {\r\n\t\treturn this.supportCodeLibrary.afterTestStepHookDefinitions\r\n\t\t\t.slice(0)\r\n\t\t\t.reverse()\r\n\t\t\t.filter(hookDefinition => hookDefinition.appliesToTestCase(this.pickle));\r\n\t}\r\n\r\n\tgetWorstStepResult(): messages.TestStepResult {\r\n\t\tif (!this.testStepResults || this.testStepResults.length === 0) {\r\n\t\t\treturn {\r\n\t\t\t\tstatus: this.skip ? messages.TestStepResultStatus.SKIPPED : messages.TestStepResultStatus.PASSED,\r\n\t\t\t\tduration: messages.TimeConversion.millisecondsToDuration(0)\r\n\t\t\t};\r\n\t\t}\r\n\t\treturn getWorstTestStepResult(this.testStepResults);\r\n\t}\r\n\r\n\tasync invokeStep(\r\n\t\tstepParam: messages.PickleStep | null,\r\n\t\tstepDefinition: IDefinition,\r\n\t\thookParameter?: any\r\n\t): Promise<messages.TestStepResult> {\r\n\t\tconst step = stepParam!;\r\n\t\treturn await StepRunner.run({\r\n\t\t\tdefaultTimeout: this.supportCodeLibrary.defaultTimeout,\r\n\t\t\tfilterStackTraces: this.filterStackTraces,\r\n\t\t\thookParameter,\r\n\t\t\tstep,\r\n\t\t\tstepDefinition,\r\n\t\t\tworld: this.world\r\n\t\t});\r\n\t}\r\n\r\n\tisSkippingSteps(): boolean {\r\n\t\treturn this.getWorstStepResult().status !== messages.TestStepResultStatus.PASSED;\r\n\t}\r\n\r\n\tshouldSkipHook(isBeforeHook: boolean): boolean {\r\n\t\treturn this.skip || (this.isSkippingSteps() && isBeforeHook);\r\n\t}\r\n\r\n\tasync aroundTestStep(testStepId: string, runStepFn: () => Promise<messages.TestStepResult>): Promise<void> {\r\n\t\tconst testStepStarted: messages.Envelope = {\r\n\t\t\ttestStepStarted: {\r\n\t\t\t\ttestCaseStartedId: this.currentTestCaseStartedId!,\r\n\t\t\t\ttestStepId,\r\n\t\t\t\ttimestamp: timestamp()\r\n\t\t\t}\r\n\t\t};\r\n\t\tthis.eventBroadcaster.emit('envelope', testStepStarted);\r\n\t\tthis.currentTestStepId = testStepId;\r\n\t\tconst testStepResult = await runStepFn();\r\n\t\tthis.currentTestStepId = undefined;\r\n\t\tthis.testStepResults?.push(testStepResult);\r\n\t\tconst testStepFinished: messages.Envelope = {\r\n\t\t\ttestStepFinished: {\r\n\t\t\t\ttestCaseStartedId: this.currentTestCaseStartedId!,\r\n\t\t\t\ttestStepId,\r\n\t\t\t\ttestStepResult,\r\n\t\t\t\ttimestamp: timestamp()\r\n\t\t\t}\r\n\t\t};\r\n\t\tthis.eventBroadcaster.emit('envelope', testStepFinished);\r\n\t}\r\n\r\n\tasync run(): Promise<messages.TestStepResultStatus> {\r\n\t\tfor (let attempt = 0; attempt < this.maxAttempts; attempt++) {\r\n\t\t\tconst moreAttemptsRemaining = attempt + 1 < this.maxAttempts;\r\n\r\n\t\t\tconst willBeRetried = await this.runAttempt(attempt, moreAttemptsRemaining);\r\n\r\n\t\t\tif (!willBeRetried) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tthis.resetTestProgressData();\r\n\t\t}\r\n\t\treturn this.getWorstStepResult().status;\r\n\t}\r\n\r\n\tasync runAttempt(attempt: number, moreAttemptsRemaining: boolean): Promise<boolean> {\r\n\t\tthis.currentTestCaseStartedId = this.newId();\r\n\t\tconst testCaseStarted: messages.Envelope = {\r\n\t\t\ttestCaseStarted: {\r\n\t\t\t\tattempt,\r\n\t\t\t\ttestCaseId: this.testCase.id,\r\n\t\t\t\tid: this.currentTestCaseStartedId,\r\n\t\t\t\ttimestamp: timestamp()\r\n\t\t\t}\r\n\t\t};\r\n\t\tthis.eventBroadcaster.emit('envelope', testCaseStarted);\r\n\t\t// used to determine whether a hook is a Before or After\r\n\t\tlet didWeRunStepsYet = false;\r\n\t\tfor (const testStep of this.testCase.testSteps) {\r\n\t\t\tawait this.aroundTestStep(testStep.id, async () => {\r\n\t\t\t\tif (doesHaveValue(testStep.hookId)) {\r\n\t\t\t\t\tconst hookParameter: ITestCaseHookParameter = {\r\n\t\t\t\t\t\tgherkinDocument: this.gherkinDocument,\r\n\t\t\t\t\t\tpickle: this.pickle,\r\n\t\t\t\t\t\ttestCaseStartedId: this.currentTestCaseStartedId!\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif (didWeRunStepsYet) {\r\n\t\t\t\t\t\thookParameter.result = this.getWorstStepResult();\r\n\t\t\t\t\t\thookParameter.willBeRetried =\r\n\t\t\t\t\t\t\tthis.getWorstStepResult().status === messages.TestStepResultStatus.FAILED && moreAttemptsRemaining;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn await this.runHook(\r\n\t\t\t\t\t\tfindHookDefinition(testStep.hookId!, this.supportCodeLibrary),\r\n\t\t\t\t\t\thookParameter,\r\n\t\t\t\t\t\t!didWeRunStepsYet\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconst pickleStep = this.pickle.steps.find(pickleStep => pickleStep.id === testStep.pickleStepId);\r\n\t\t\t\t\tconst testStepResult = await this.runStep(pickleStep!, testStep);\r\n\t\t\t\t\tdidWeRunStepsYet = true;\r\n\t\t\t\t\treturn testStepResult;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\tconst worseResult = this.getWorstStepResult();\r\n\t\tconst willBeRetried = worseResult.status === messages.TestStepResultStatus.FAILED && moreAttemptsRemaining;\r\n\r\n\t\tconst endTestCaseParameter: EndTestCaseInfo = {\r\n\t\t\tgherkinDocument: this.gherkinDocument,\r\n\t\t\tpickle: this.pickle,\r\n\t\t\ttestCaseStartedId: this.currentTestCaseStartedId!,\r\n\t\t\tresult: worseResult,\r\n\t\t\twillBeRetried: willBeRetried\r\n\t\t};\r\n\r\n\t\t// End test case will call dispose on all context types\r\n\t\t// passed into a binding and then end the context.\r\n\t\tawait global.messageCollector.endTestCase(endTestCaseParameter);\r\n\r\n\t\tconst testCaseFinished: messages.Envelope = {\r\n\t\t\ttestCaseFinished: {\r\n\t\t\t\ttestCaseStartedId: this.currentTestCaseStartedId,\r\n\t\t\t\ttimestamp: timestamp(),\r\n\t\t\t\twillBeRetried\r\n\t\t\t}\r\n\t\t};\r\n\t\tthis.eventBroadcaster.emit('envelope', testCaseFinished);\r\n\r\n\t\treturn willBeRetried;\r\n\t}\r\n\r\n\tasync runHook(\r\n\t\thookDefinition: TestCaseHookDefinition,\r\n\t\thookParameter: ITestCaseHookParameter,\r\n\t\tisBeforeHook: boolean\r\n\t): Promise<messages.TestStepResult> {\r\n\t\tif (this.shouldSkipHook(isBeforeHook)) {\r\n\t\t\treturn {\r\n\t\t\t\tstatus: messages.TestStepResultStatus.SKIPPED,\r\n\t\t\t\tduration: messages.TimeConversion.millisecondsToDuration(0)\r\n\t\t\t};\r\n\t\t}\r\n\t\t// Get the step binding and scenario context so that we can\r\n\t\t// initialize any context objects before hooks are executed\r\n\t\tconst stepBinding = this.bindingRegistry.getStepBindingByCucumberKey((hookDefinition.options as any).cucumberKey);\r\n\t\tif (!stepBinding) throw error('Unable to find StepBinding!');\r\n\t\tconst scenarioContext = global.messageCollector.getHookScenarioContext(hookParameter);\r\n\t\tif (!scenarioContext) throw error('Unable to find the ManagedScenarioContext!');\r\n\t\tawait this.initializeContext(stepBinding, scenarioContext);\r\n\r\n\t\treturn await this.invokeStep(null, hookDefinition, hookParameter);\r\n\t}\r\n\r\n\tasync runStepHooks(\r\n\t\tstepHooks: TestStepHookDefinition[],\r\n\t\tpickleStep: messages.PickleStep,\r\n\t\tstepResult?: messages.TestStepResult\r\n\t): Promise<messages.TestStepResult[]> {\r\n\t\tconst stepHooksResult = [];\r\n\t\tconst hookParameter: ITestStepHookParameter = {\r\n\t\t\tgherkinDocument: this.gherkinDocument,\r\n\t\t\tpickle: this.pickle,\r\n\t\t\tpickleStep,\r\n\t\t\ttestCaseStartedId: this.currentTestCaseStartedId!,\r\n\t\t\ttestStepId: this.currentTestStepId!,\r\n\t\t\tresult: stepResult!\r\n\t\t};\r\n\t\tfor (const stepHookDefinition of stepHooks) {\r\n\t\t\tstepHooksResult.push(await this.invokeStep(null, stepHookDefinition, hookParameter));\r\n\t\t}\r\n\t\treturn stepHooksResult;\r\n\t}\r\n\r\n\tasync runStep(pickleStep: messages.PickleStep, testStep: messages.TestStep): Promise<messages.TestStepResult> {\r\n\t\tconst stepDefinitions = testStep.stepDefinitionIds?.map(stepDefinitionId => {\r\n\t\t\treturn findStepDefinition(stepDefinitionId, this.supportCodeLibrary);\r\n\t\t});\r\n\r\n\t\tif (!stepDefinitions || stepDefinitions.length === 0) {\r\n\t\t\treturn {\r\n\t\t\t\tstatus: messages.TestStepResultStatus.UNDEFINED,\r\n\t\t\t\tduration: messages.TimeConversion.millisecondsToDuration(0)\r\n\t\t\t};\r\n\t\t} else if (stepDefinitions.length > 1) {\r\n\t\t\treturn {\r\n\t\t\t\tmessage: getAmbiguousStepException(stepDefinitions),\r\n\t\t\t\tstatus: messages.TestStepResultStatus.AMBIGUOUS,\r\n\t\t\t\tduration: messages.TimeConversion.millisecondsToDuration(0)\r\n\t\t\t};\r\n\t\t} else if (this.isSkippingSteps()) {\r\n\t\t\treturn {\r\n\t\t\t\tstatus: messages.TestStepResultStatus.SKIPPED,\r\n\t\t\t\tduration: messages.TimeConversion.millisecondsToDuration(0)\r\n\t\t\t};\r\n\t\t}\r\n\t\t// Get the step binding and scenario context so that we can\r\n\t\t// initialize any context objects before hooks are executed\r\n\t\tconst stepBinding = this.bindingRegistry.getStepBindingByCucumberKey(\r\n\t\t\t(stepDefinitions[0].options as any).cucumberKey\r\n\t\t);\r\n\t\tif (!stepBinding) throw error('Unable to find StepBinding!');\r\n\t\tconst scenarioContext = global.messageCollector.getStepScenarioContext(stepBinding);\r\n\t\tif (!scenarioContext) throw error('Unable to find the ManagedScenarioContext!');\r\n\t\tawait this.initializeContext(stepBinding, scenarioContext);\r\n\r\n\t\t// next execute any before step hooks followed by the step if there are no\r\n\t\t// failures in before step hooks.\r\n\t\tlet stepResult;\r\n\t\tlet stepResults = await this.runStepHooks(this.getBeforeStepHookDefinitions(), pickleStep);\r\n\t\tif (getWorstTestStepResult(stepResults).status !== messages.TestStepResultStatus.FAILED) {\r\n\t\t\tstepResult = await this.invokeStep(pickleStep, stepDefinitions[0]);\r\n\t\t\tstepResults.push(stepResult);\r\n\t\t}\r\n\t\t// run the after step hooks\r\n\t\tconst afterStepHookResults = await this.runStepHooks(this.getAfterStepHookDefinitions(), pickleStep, stepResult);\r\n\t\tstepResults = stepResults.concat(afterStepHookResults);\r\n\r\n\t\tconst finalStepResult = getWorstTestStepResult(stepResults);\r\n\t\tlet finalDuration = messages.TimeConversion.millisecondsToDuration(0);\r\n\t\tfor (const result of stepResults) {\r\n\t\t\tfinalDuration = messages.TimeConversion.addDurations(finalDuration, result.duration);\r\n\t\t}\r\n\t\tfinalStepResult.duration = finalDuration;\r\n\t\treturn finalStepResult;\r\n\t}\r\n\r\n\t/**\r\n\t * Helper used to initialize any context types that are passed into\r\n\t * a binding class before any hooks or steps are executed.\r\n\t * @param stepBinding\r\n\t * @param scenarioContext\r\n\t */\r\n\tasync initializeContext(stepBinding: StepBinding, scenarioContext: ManagedScenarioContext): Promise<void> {\r\n\t\tconst contextTypes = this.bindingRegistry.getContextTypesForClass(stepBinding.classPrototype);\r\n\t\tif (contextTypes.length > 0) {\r\n\t\t\tscenarioContext.getOrActivateBindingClass(stepBinding.classPrototype, contextTypes, this.world);\r\n\r\n\t\t\tconst startTestCaseParameter: StartTestCaseInfo = {\r\n\t\t\t\tgherkinDocument: this.gherkinDocument,\r\n\t\t\t\tpickle: this.pickle,\r\n\t\t\t\ttestCaseStartedId: this.currentTestCaseStartedId!\r\n\t\t\t};\r\n\t\t\tawait scenarioContext.initialize(startTestCaseParameter);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction findHookDefinition(id: string, supportCodeLibrary: SupportCodeLibrary): TestCaseHookDefinition {\r\n\treturn [...supportCodeLibrary.beforeTestCaseHookDefinitions, ...supportCodeLibrary.afterTestCaseHookDefinitions].find(\r\n\t\tdefinition => definition.id === id\r\n\t)!;\r\n}\r\n\r\nfunction findStepDefinition(id: string, supportCodeLibrary: SupportCodeLibrary): StepDefinition {\r\n\treturn supportCodeLibrary.stepDefinitions.find(definition => definition.id === id)!;\r\n}\r\n"]}
@@ -1,16 +0,0 @@
1
- /**
2
- * Uses a regular expression to match a step expression with
3
- * the feature text passed in
4
- * @param stepText
5
- * @param featureText
6
- * @returns
7
- */
8
- export declare const hasMatchingStep: (stepText: string, featureText: string) => boolean;
9
- /**
10
- * Helper that uses a lexical parser to apply the tag patterns used by
11
- * Cucumber to associate hooks with scenario and feature tags
12
- * @param tagPattern examples: 'tag1', 'tag1 and tag2', 'tag1 or tag2)
13
- * @param tags
14
- * @returns
15
- */
16
- export declare const hasMatchingTags: (tagPattern: string, tags: string[]) => boolean;
@@ -1,78 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.hasMatchingTags = exports.hasMatchingStep = void 0;
7
- const logical_expression_parser_1 = __importDefault(require("@jeanbenitez/logical-expression-parser"));
8
- const logger_1 = __importDefault(require("../utils/logger"));
9
- /**
10
- * Uses a regular expression to match a step expression with
11
- * the feature text passed in
12
- * @param stepText
13
- * @param featureText
14
- * @returns
15
- */
16
- const hasMatchingStep = (stepText, featureText) => {
17
- if (stepText.trim().length === 0)
18
- return false;
19
- try {
20
- const regexStep = new RegExp(getRegTextForStep(stepText));
21
- const match = featureText.match(regexStep);
22
- return match !== null && match.length > 0;
23
- }
24
- catch (err) {
25
- logger_1.default.error(err.message);
26
- return false;
27
- }
28
- };
29
- exports.hasMatchingStep = hasMatchingStep;
30
- /**
31
- * Helper that uses a lexical parser to apply the tag patterns used by
32
- * Cucumber to associate hooks with scenario and feature tags
33
- * @param tagPattern examples: 'tag1', 'tag1 and tag2', 'tag1 or tag2)
34
- * @param tags
35
- * @returns
36
- */
37
- const hasMatchingTags = (tagPattern, tags) => {
38
- return logical_expression_parser_1.default.parse(tagPattern.toLowerCase(), (t) => tags.map(tag => tag.toLowerCase()).includes(t));
39
- };
40
- exports.hasMatchingTags = hasMatchingTags;
41
- const getRegTextForStep = (step) => {
42
- //Ruby interpolation (like `#{Something}` ) should be replaced with `.*`
43
- //https://github.com/alexkrechik/VSCucumberAutoComplete/issues/65
44
- step = step.replace(/#{(.*?)}/g, '.*');
45
- //Parameter-types
46
- //https://github.com/alexkrechik/VSCucumberAutoComplete/issues/66
47
- //https://docs.cucumber.io/cucumber/cucumber-expressions/
48
- step = step.replace(/{float}/g, '-?\\d*\\.?\\d+');
49
- step = step.replace(/{bigdecimal}/g, '-?\\d*\\.?\\d+');
50
- step = step.replace(/{double}/g, '-?\\d*\\.?\\d+');
51
- step = step.replace(/{int}/g, '-?\\d+');
52
- step = step.replace(/{biginteger}/g, '-?\\d+');
53
- step = step.replace(/{byte}/g, '-?\\d+');
54
- step = step.replace(/{short}/g, '-?\\d+');
55
- step = step.replace(/{long}/g, '-?\\d+');
56
- step = step.replace(/{stringInDoubleQuotes}/g, '"[^"]+"');
57
- step = step.replace(/{word}/g, '[A-Za-z]+');
58
- step = step.replace(/{string}/g, '("|\')[^\\1]*\\1');
59
- step = step.replace(/{boolean}/g, 'true|false');
60
- step = step.replace(/{}/g, '.*');
61
- //Optional Text
62
- step = step.replace(/\(([a-z]+)\)/g, '($1)?');
63
- //Alternative text a/b/c === (a|b|c)
64
- step = step.replace(/([a-zA-Z]+)(?:\/([a-zA-Z]+))+/g, match => `(${match.replace(/\//g, '|')})`);
65
- //Handle Cucumber Expressions (like `{Something}`) should be replaced with `.*`
66
- //https://github.com/alexkrechik/VSCucumberAutoComplete/issues/99
67
- //Cucumber Expressions Custom Parameter Type Documentation
68
- //https://docs.cucumber.io/cucumber-expressions/#custom-parameters
69
- step = step.replace(/([^\\]|^){(?![\d,])(.*?)}/g, '$1.*');
70
- //Escape all the regex symbols to avoid errors
71
- step = escapeRegExp(step);
72
- return step;
73
- };
74
- const escapeRegExp = (str) => {
75
- // eslint-disable-next-line no-useless-escape
76
- return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '$&');
77
- };
78
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/cucumber/utils.ts"],"names":[],"mappings":";;;;;;AAAA,uGAAyD;AACzD,6DAAqC;AAErC;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAE,WAAmB,EAAW,EAAE;IACjF,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE/C,IAAI,CAAC;QACJ,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1D,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3C,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,gBAAM,CAAC,KAAK,CAAE,GAAW,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,CAAC;AAXW,QAAA,eAAe,mBAW1B;AAEF;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAE,IAAc,EAAW,EAAE;IAC9E,OAAO,mCAAG,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAA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CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEjC,eAAe;IACf,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAE9C,oCAAoC;IACpC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAEjG,+EAA+E;IAC/E,iEAAiE;IACjE,0DAA0D;IAC1D,kEAAkE;IAClE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;IAE1D,8CAA8C;IAC9C,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAE1B,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,GAAW,EAAU,EAAE;IAC5C,6CAA6C;IAC7C,OAAO,GAAG,CAAC,OAAO,CAAC,qCAAqC,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["import lep from '@jeanbenitez/logical-expression-parser';\r\nimport logger from '../utils/logger';\r\n\r\n/**\r\n * Uses a regular expression to match a step expression with\r\n * the feature text passed in\r\n * @param stepText\r\n * @param featureText\r\n * @returns\r\n */\r\nexport const hasMatchingStep = (stepText: string, featureText: string): boolean => {\r\n\tif (stepText.trim().length === 0) return false;\r\n\r\n\ttry {\r\n\t\tconst regexStep = new RegExp(getRegTextForStep(stepText));\r\n\t\tconst match = featureText.match(regexStep);\r\n\t\treturn match !== null && match.length > 0;\r\n\t} catch (err) {\r\n\t\tlogger.error((err as any).message);\r\n\t\treturn false;\r\n\t}\r\n};\r\n\r\n/**\r\n * Helper that uses a lexical parser to apply the tag patterns used by\r\n * Cucumber to associate hooks with scenario and feature tags\r\n * @param tagPattern examples: 'tag1', 'tag1 and tag2', 'tag1 or tag2)\r\n * @param tags\r\n * @returns\r\n */\r\nexport const hasMatchingTags = (tagPattern: string, tags: string[]): boolean => {\r\n\treturn lep.parse(tagPattern.toLowerCase(), (t: string) => tags.map(tag => tag.toLowerCase()).includes(t));\r\n};\r\n\r\nconst getRegTextForStep = (step: string): string => {\r\n\t//Ruby interpolation (like `#{Something}` ) should be replaced with `.*`\r\n\t//https://github.com/alexkrechik/VSCucumberAutoComplete/issues/65\r\n\tstep = step.replace(/#{(.*?)}/g, '.*');\r\n\r\n\t//Parameter-types\r\n\t//https://github.com/alexkrechik/VSCucumberAutoComplete/issues/66\r\n\t//https://docs.cucumber.io/cucumber/cucumber-expressions/\r\n\tstep = step.replace(/{float}/g, '-?\\\\d*\\\\.?\\\\d+');\r\n\tstep = step.replace(/{bigdecimal}/g, '-?\\\\d*\\\\.?\\\\d+');\r\n\tstep = step.replace(/{double}/g, '-?\\\\d*\\\\.?\\\\d+');\r\n\tstep = step.replace(/{int}/g, '-?\\\\d+');\r\n\tstep = step.replace(/{biginteger}/g, '-?\\\\d+');\r\n\tstep = step.replace(/{byte}/g, '-?\\\\d+');\r\n\tstep = step.replace(/{short}/g, '-?\\\\d+');\r\n\tstep = step.replace(/{long}/g, '-?\\\\d+');\r\n\tstep = step.replace(/{stringInDoubleQuotes}/g, '\"[^\"]+\"');\r\n\tstep = step.replace(/{word}/g, '[A-Za-z]+');\r\n\tstep = step.replace(/{string}/g, '(\"|\\')[^\\\\1]*\\\\1');\r\n\tstep = step.replace(/{boolean}/g, 'true|false');\r\n\tstep = step.replace(/{}/g, '.*');\r\n\r\n\t//Optional Text\r\n\tstep = step.replace(/\\(([a-z]+)\\)/g, '($1)?');\r\n\r\n\t//Alternative text a/b/c === (a|b|c)\r\n\tstep = step.replace(/([a-zA-Z]+)(?:\\/([a-zA-Z]+))+/g, match => `(${match.replace(/\\//g, '|')})`);\r\n\r\n\t//Handle Cucumber Expressions (like `{Something}`) should be replaced with `.*`\r\n\t//https://github.com/alexkrechik/VSCucumberAutoComplete/issues/99\r\n\t//Cucumber Expressions Custom Parameter Type Documentation\r\n\t//https://docs.cucumber.io/cucumber-expressions/#custom-parameters\r\n\tstep = step.replace(/([^\\\\]|^){(?![\\d,])(.*?)}/g, '$1.*');\r\n\r\n\t//Escape all the regex symbols to avoid errors\r\n\tstep = escapeRegExp(step);\r\n\r\n\treturn step;\r\n};\r\n\r\nconst escapeRegExp = (str: string): string => {\r\n\t// eslint-disable-next-line no-useless-escape\r\n\treturn str.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '$&');\r\n};\r\n"]}
@@ -1,17 +0,0 @@
1
- import { EventEmitter } from 'node:events';
2
- import { IdGenerator } from '@cucumber/messages';
3
- import { AssembledTestCase } from '@cucumber/cucumber/lib/assemble/index';
4
- import { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';
5
- import { RuntimeOptions } from '@cucumber/cucumber/lib/runtime/index';
6
- export declare class Worker {
7
- private readonly workerId;
8
- private readonly eventBroadcaster;
9
- private readonly newId;
10
- private readonly options;
11
- private readonly supportCodeLibrary;
12
- private readonly runTestRunHooks;
13
- constructor(workerId: string | undefined, eventBroadcaster: EventEmitter, newId: IdGenerator.NewId, options: RuntimeOptions, supportCodeLibrary: SupportCodeLibrary);
14
- runBeforeAllHooks(): Promise<void>;
15
- runTestCase({ gherkinDocument, pickle, testCase }: AssembledTestCase, failing: boolean): Promise<boolean>;
16
- runAfterAllHooks(): Promise<void>;
17
- }
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Worker = void 0;
7
- const test_case_runner_1 = __importDefault(require("./test-case-runner"));
8
- const helpers_1 = require("@cucumber/cucumber/lib/runtime/helpers");
9
- const run_test_run_hooks_1 = require("@cucumber/cucumber/lib/runtime/run_test_run_hooks");
10
- class Worker {
11
- workerId;
12
- eventBroadcaster;
13
- newId;
14
- options;
15
- supportCodeLibrary;
16
- runTestRunHooks;
17
- constructor(workerId, eventBroadcaster, newId, options, supportCodeLibrary) {
18
- this.workerId = workerId;
19
- this.eventBroadcaster = eventBroadcaster;
20
- this.newId = newId;
21
- this.options = options;
22
- this.supportCodeLibrary = supportCodeLibrary;
23
- this.runTestRunHooks = (0, run_test_run_hooks_1.makeRunTestRunHooks)(this.options.dryRun, this.supportCodeLibrary.defaultTimeout, this.options.worldParameters, (name, location) => {
24
- let message = `${name} hook errored`;
25
- if (this.workerId) {
26
- message += ` on worker ${this.workerId}`;
27
- }
28
- message += `, process exiting: ${location}`;
29
- return message;
30
- });
31
- }
32
- async runBeforeAllHooks() {
33
- await this.runTestRunHooks(this.supportCodeLibrary.beforeTestRunHookDefinitions, 'a BeforeAll');
34
- }
35
- async runTestCase({ gherkinDocument, pickle, testCase }, failing) {
36
- const testCaseRunner = new test_case_runner_1.default({
37
- workerId: this.workerId,
38
- eventBroadcaster: this.eventBroadcaster,
39
- newId: this.newId,
40
- gherkinDocument,
41
- pickle,
42
- testCase,
43
- retries: (0, helpers_1.retriesForPickle)(pickle, this.options),
44
- skip: this.options.dryRun || (this.options.failFast && failing),
45
- filterStackTraces: this.options.filterStacktraces,
46
- supportCodeLibrary: this.supportCodeLibrary,
47
- worldParameters: this.options.worldParameters
48
- });
49
- const status = await testCaseRunner.run();
50
- return !(0, helpers_1.shouldCauseFailure)(status, this.options);
51
- }
52
- async runAfterAllHooks() {
53
- await this.runTestRunHooks(this.supportCodeLibrary.afterTestRunHookDefinitions.slice(0).reverse(), 'an AfterAll');
54
- }
55
- }
56
- exports.Worker = Worker;
57
- //# sourceMappingURL=worker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/cucumber/worker.ts"],"names":[],"mappings":";;;;;;AAIA,0EAAgD;AAChD,oEAA8F;AAC9F,0FAA0G;AAG1G,MAAa,MAAM;IAIA;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AAO,CAAC;YAC/C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC;YAC/D,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB;YACjD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,eAAe,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe;SAC7C,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE,CAAC;QAE1C,OAAO,CAAC,IAAA,4BAAkB,EAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,gBAAgB;QACrB,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;IACnH,CAAC;CACD;AApDD,wBAoDC","sourcesContent":["import { EventEmitter } from 'node:events';\r\nimport { IdGenerator } from '@cucumber/messages';\r\nimport { AssembledTestCase } from '@cucumber/cucumber/lib/assemble/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport TestCaseRunner from './test-case-runner';\r\nimport { retriesForPickle, shouldCauseFailure } from '@cucumber/cucumber/lib/runtime/helpers';\r\nimport { makeRunTestRunHooks, RunsTestRunHooks } from '@cucumber/cucumber/lib/runtime/run_test_run_hooks';\r\nimport { RuntimeOptions } from '@cucumber/cucumber/lib/runtime/index';\r\n\r\nexport class Worker {\r\n\tprivate readonly runTestRunHooks: RunsTestRunHooks;\r\n\r\n\tconstructor(\r\n\t\tprivate readonly workerId: string | undefined,\r\n\t\tprivate readonly eventBroadcaster: EventEmitter,\r\n\t\tprivate readonly newId: IdGenerator.NewId,\r\n\t\tprivate readonly options: RuntimeOptions,\r\n\t\tprivate readonly supportCodeLibrary: SupportCodeLibrary\r\n\t) {\r\n\t\tthis.runTestRunHooks = makeRunTestRunHooks(\r\n\t\t\tthis.options.dryRun,\r\n\t\t\tthis.supportCodeLibrary.defaultTimeout,\r\n\t\t\tthis.options.worldParameters,\r\n\t\t\t(name, location) => {\r\n\t\t\t\tlet message = `${name} hook errored`;\r\n\t\t\t\tif (this.workerId) {\r\n\t\t\t\t\tmessage += ` on worker ${this.workerId}`;\r\n\t\t\t\t}\r\n\t\t\t\tmessage += `, process exiting: ${location}`;\r\n\t\t\t\treturn message;\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n\r\n\tasync runBeforeAllHooks() {\r\n\t\tawait this.runTestRunHooks(this.supportCodeLibrary.beforeTestRunHookDefinitions, 'a BeforeAll');\r\n\t}\r\n\r\n\tasync runTestCase({ gherkinDocument, pickle, testCase }: AssembledTestCase, failing: boolean): Promise<boolean> {\r\n\t\tconst testCaseRunner = new TestCaseRunner({\r\n\t\t\tworkerId: this.workerId,\r\n\t\t\teventBroadcaster: this.eventBroadcaster,\r\n\t\t\tnewId: this.newId,\r\n\t\t\tgherkinDocument,\r\n\t\t\tpickle,\r\n\t\t\ttestCase,\r\n\t\t\tretries: retriesForPickle(pickle, this.options),\r\n\t\t\tskip: this.options.dryRun || (this.options.failFast && failing),\r\n\t\t\tfilterStackTraces: this.options.filterStacktraces,\r\n\t\t\tsupportCodeLibrary: this.supportCodeLibrary,\r\n\t\t\tworldParameters: this.options.worldParameters\r\n\t\t});\r\n\r\n\t\tconst status = await testCaseRunner.run();\r\n\r\n\t\treturn !shouldCauseFailure(status, this.options);\r\n\t}\r\n\r\n\tasync runAfterAllHooks() {\r\n\t\tawait this.runTestRunHooks(this.supportCodeLibrary.afterTestRunHookDefinitions.slice(0).reverse(), 'an AfterAll');\r\n\t}\r\n}\r\n"]}