allure-cucumberjs 3.13.0 → 3.15.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 +1 -1
- package/dist/cjs/legacy.js +1 -0
- package/dist/cjs/legacy.js.map +1 -1
- package/dist/cjs/reporter.js +150 -33
- package/dist/cjs/reporter.js.map +1 -1
- package/dist/cjs/utils.js +3 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/legacy.js +1 -0
- package/dist/esm/legacy.js.map +1 -1
- package/dist/esm/reporter.js +154 -37
- package/dist/esm/reporter.js.map +1 -1
- package/dist/esm/utils.js +1 -0
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/reporter.d.ts +8 -1
- package/dist/types/utils.d.ts +1 -0
- package/package.json +6 -9
package/dist/esm/reporter.js
CHANGED
|
@@ -9,12 +9,16 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
9
9
|
import { extname } from "node:path";
|
|
10
10
|
import { Formatter, World } from "@cucumber/cucumber";
|
|
11
11
|
import { TimeConversion } from "@cucumber/messages";
|
|
12
|
-
import { AttachmentContentEncoding, TestStepResultStatus } from "@cucumber/messages";
|
|
12
|
+
import { AttachmentContentEncoding, StepDefinitionPatternType, TestStepResultStatus } from "@cucumber/messages";
|
|
13
13
|
import { ContentType, LabelName, Stage, Status } from "allure-js-commons";
|
|
14
|
-
import { getMessageAndTraceFromError, getStatusFromError } from "allure-js-commons/sdk";
|
|
15
|
-
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, applyLinkTemplate, createDefaultWriter, createStepResult, getEnvironmentLabels, getFallbackTestCaseIdLabel, getFrameworkLabel, getHostLabel, getLanguageLabel, getPackageLabel, getProjectName, getThreadLabel, getWorstTestStepResult, md5 } from "allure-js-commons/sdk/reporter";
|
|
14
|
+
import { getMessageAndTraceFromError, getStatusFromError, hasLabel, toGlobalErrorMessage } from "allure-js-commons/sdk";
|
|
15
|
+
import { ALLURE_RUNTIME_MESSAGE_CONTENT_TYPE, ReporterRuntime, applyLinkTemplate, createDefaultWriter, createStepResult, getEnvironmentLabels, getFallbackTestCaseIdLabel, getFrameworkLabel, getHostLabel, getLanguageLabel, getPackageLabel, getProjectName, getThreadLabel, getWorstTestStepResult, isUrl, md5 } from "allure-js-commons/sdk/reporter";
|
|
16
16
|
import { AllureCucumberWorld } from "./legacy.js";
|
|
17
|
-
import { getPathRelativeToProjectRoot, getPosixPathRelativeToProjectRoot } from "./utils.js";
|
|
17
|
+
import { getPathRelativeToProjectRoot, getPosixPathRelativeToProjectRoot, serializeCsvRow } from "./utils.js";
|
|
18
|
+
var UNDEFINED_STEP_MESSAGE = "The step doesn't have an implementation.";
|
|
19
|
+
var UNDEFINED_TEST_MESSAGE = "The test doesn't have an implementation.";
|
|
20
|
+
var PENDING_STEP_MESSAGE = "The step is pending.";
|
|
21
|
+
var AMBIGUOUS_STEP_MESSAGE = "The step is ambiguous.";
|
|
18
22
|
export default class AllureCucumberReporter extends Formatter {
|
|
19
23
|
constructor(options) {
|
|
20
24
|
super(options);
|
|
@@ -27,13 +31,19 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
27
31
|
_defineProperty(this, "scenarioMap", new Map());
|
|
28
32
|
_defineProperty(this, "stepMap", new Map());
|
|
29
33
|
_defineProperty(this, "testStepMap", new Map());
|
|
34
|
+
_defineProperty(this, "stepDefinitionMap", new Map());
|
|
30
35
|
_defineProperty(this, "pickleStepMap", new Map());
|
|
31
36
|
_defineProperty(this, "pickleMap", new Map());
|
|
32
37
|
_defineProperty(this, "testCaseMap", new Map());
|
|
33
|
-
_defineProperty(this, "
|
|
38
|
+
_defineProperty(this, "featureNamesByTestCaseStartedId", new Map());
|
|
34
39
|
_defineProperty(this, "testResultUuids", new Map());
|
|
35
40
|
_defineProperty(this, "scopeUuids", new Map());
|
|
36
41
|
_defineProperty(this, "fixtureUuids", new Map());
|
|
42
|
+
_defineProperty(this, "testRunHookTypes", new Map());
|
|
43
|
+
_defineProperty(this, "testRunHookStartedMap", new Map());
|
|
44
|
+
// executions of test run hooks running in this process, by hook id
|
|
45
|
+
_defineProperty(this, "runningTestRunHooks", new Map());
|
|
46
|
+
_defineProperty(this, "reportedTestRunHookStartedIds", new Set());
|
|
37
47
|
var _ref = options.parsedArgvOptions,
|
|
38
48
|
{
|
|
39
49
|
resultsDir,
|
|
@@ -92,34 +102,34 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
92
102
|
var runTestRunHook = this.runTestRunHook.bind(this);
|
|
93
103
|
var runCallbackTestRunHook = this.runCallbackTestRunHook.bind(this);
|
|
94
104
|
hook.code = originalCode.length > 0 ? function (callback) {
|
|
95
|
-
return runCallbackTestRunHook(hookName, originalCode, this, callback);
|
|
105
|
+
return runCallbackTestRunHook(hook.id, hookName, originalCode, this, callback);
|
|
96
106
|
} : function () {
|
|
97
|
-
return runTestRunHook(hookName, () => originalCode.call(this));
|
|
107
|
+
return runTestRunHook(hook.id, hookName, () => originalCode.call(this));
|
|
98
108
|
};
|
|
99
109
|
});
|
|
100
110
|
}
|
|
101
|
-
runTestRunHook(name, runHook) {
|
|
111
|
+
runTestRunHook(hookId, name, runHook) {
|
|
102
112
|
try {
|
|
103
113
|
var result = runHook();
|
|
104
114
|
if (isPromiseLike(result)) {
|
|
105
115
|
return result.then(value => value, error => {
|
|
106
|
-
this.emitTestRunHookGlobalError(name, error);
|
|
116
|
+
this.emitTestRunHookGlobalError(hookId, name, error);
|
|
107
117
|
return deferReject(error);
|
|
108
118
|
});
|
|
109
119
|
}
|
|
110
120
|
return result;
|
|
111
121
|
} catch (error) {
|
|
112
|
-
this.emitTestRunHookGlobalError(name, error);
|
|
122
|
+
this.emitTestRunHookGlobalError(hookId, name, error);
|
|
113
123
|
return deferReject(error);
|
|
114
124
|
}
|
|
115
125
|
}
|
|
116
|
-
runCallbackTestRunHook(name, originalCode, thisArg, callback) {
|
|
126
|
+
runCallbackTestRunHook(hookId, name, originalCode, thisArg, callback) {
|
|
117
127
|
var finished = false;
|
|
118
128
|
var finish = (error, result) => {
|
|
119
129
|
if (!finished) {
|
|
120
130
|
finished = true;
|
|
121
131
|
if (error) {
|
|
122
|
-
this.emitTestRunHookGlobalError(name, error);
|
|
132
|
+
this.emitTestRunHookGlobalError(hookId, name, error);
|
|
123
133
|
}
|
|
124
134
|
}
|
|
125
135
|
if (error) {
|
|
@@ -139,8 +149,17 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
139
149
|
throw error;
|
|
140
150
|
}
|
|
141
151
|
}
|
|
142
|
-
emitTestRunHookGlobalError(name, error) {
|
|
143
|
-
|
|
152
|
+
emitTestRunHookGlobalError(hookId, name, error) {
|
|
153
|
+
// the same execution is reported again with the testRunHookFinished message (Cucumber 12.3+)
|
|
154
|
+
var testRunHookStartedId = this.runningTestRunHooks.get(hookId);
|
|
155
|
+
if (testRunHookStartedId) {
|
|
156
|
+
this.reportedTestRunHookStartedIds.add(testRunHookStartedId);
|
|
157
|
+
}
|
|
158
|
+
this.allureRuntime.applyGlobalRuntimeMessages([toGlobalErrorMessage({
|
|
159
|
+
name,
|
|
160
|
+
details: getMessageAndTraceFromError(this.toError(error)),
|
|
161
|
+
status: getStatusFromError(error)
|
|
162
|
+
})]);
|
|
144
163
|
}
|
|
145
164
|
toError(error) {
|
|
146
165
|
if (error instanceof Error) {
|
|
@@ -150,6 +169,19 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
150
169
|
}
|
|
151
170
|
parseEnvelope(envelope) {
|
|
152
171
|
switch (true) {
|
|
172
|
+
case !!envelope.stepDefinition:
|
|
173
|
+
this.stepDefinitionMap.set(envelope.stepDefinition.id, envelope.stepDefinition);
|
|
174
|
+
break;
|
|
175
|
+
case !!envelope.hook:
|
|
176
|
+
this.testRunHookTypes.set(envelope.hook.id, envelope.hook.type);
|
|
177
|
+
break;
|
|
178
|
+
case !!envelope.testRunHookStarted:
|
|
179
|
+
this.testRunHookStartedMap.set(envelope.testRunHookStarted.id, envelope.testRunHookStarted.hookId);
|
|
180
|
+
this.runningTestRunHooks.set(envelope.testRunHookStarted.hookId, envelope.testRunHookStarted.id);
|
|
181
|
+
break;
|
|
182
|
+
case !!envelope.testRunHookFinished:
|
|
183
|
+
this.onTestRunHookFinished(envelope.testRunHookFinished);
|
|
184
|
+
break;
|
|
153
185
|
case !!envelope.gherkinDocument:
|
|
154
186
|
this.onGherkinDocument(envelope.gherkinDocument);
|
|
155
187
|
break;
|
|
@@ -214,9 +246,16 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
214
246
|
var matchedTags = tags.filter(tag => matcher.pattern.some(pattern => pattern.test(tag.name)));
|
|
215
247
|
var matchedLinks = matchedTags.map(tag => {
|
|
216
248
|
var tagValue = tag.name.replace(tagKeyRe, "");
|
|
249
|
+
if (isUrl(tagValue)) {
|
|
250
|
+
return {
|
|
251
|
+
url: tagValue,
|
|
252
|
+
type
|
|
253
|
+
};
|
|
254
|
+
}
|
|
217
255
|
return {
|
|
218
256
|
url: applyLinkTemplate(matcher.urlTemplate, tagValue) || tagValue,
|
|
219
|
-
type
|
|
257
|
+
type,
|
|
258
|
+
name: matcher.nameTemplate !== undefined ? applyLinkTemplate(matcher.nameTemplate, tagValue) : undefined
|
|
220
259
|
};
|
|
221
260
|
});
|
|
222
261
|
links.push(...matchedLinks);
|
|
@@ -231,8 +270,14 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
231
270
|
case TestStepResultStatus.PASSED:
|
|
232
271
|
return Status.PASSED;
|
|
233
272
|
case TestStepResultStatus.SKIPPED:
|
|
234
|
-
case TestStepResultStatus.PENDING:
|
|
235
273
|
return Status.SKIPPED;
|
|
274
|
+
// Cucumber's definition statuses fail strict runs. Since this reporter
|
|
275
|
+
// derives scenario status from steps, they must outrank passed steps.
|
|
276
|
+
case TestStepResultStatus.AMBIGUOUS:
|
|
277
|
+
case TestStepResultStatus.PENDING:
|
|
278
|
+
case TestStepResultStatus.UNDEFINED:
|
|
279
|
+
case TestStepResultStatus.UNKNOWN:
|
|
280
|
+
return Status.BROKEN;
|
|
236
281
|
default:
|
|
237
282
|
return undefined;
|
|
238
283
|
}
|
|
@@ -302,12 +347,6 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
302
347
|
};
|
|
303
348
|
result.labels.push(...getEnvironmentLabels());
|
|
304
349
|
result.labels.push(getLanguageLabel(), getFrameworkLabel("cucumberjs"), getPackageLabel(getPathRelativeToProjectRoot(pickle)), getFallbackTestCaseIdLabel(legacyTestCaseId), getHostLabel(), getThreadLabel(data.workerId));
|
|
305
|
-
if (doc !== null && doc !== void 0 && doc.feature) {
|
|
306
|
-
result.labels.push({
|
|
307
|
-
name: LabelName.FEATURE,
|
|
308
|
-
value: doc.feature.name
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
350
|
var pickleLabels = this.parsePickleTags(pickle.tags || []);
|
|
312
351
|
var featureLabels = this.parseTagsLabels((doc === null || doc === void 0 || (_doc$feature2 = doc.feature) === null || _doc$feature2 === void 0 ? void 0 : _doc$feature2.tags) || []);
|
|
313
352
|
var featureLinks = this.parseTagsLinks((doc === null || doc === void 0 || (_doc$feature3 = doc.feature) === null || _doc$feature3 === void 0 ? void 0 : _doc$feature3.tags) || []);
|
|
@@ -323,7 +362,9 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
323
362
|
this.scopeUuids.set(data.id, scopeUuid);
|
|
324
363
|
var testUuid = this.allureRuntime.startTest(result, [scopeUuid]);
|
|
325
364
|
this.testResultUuids.set(data.id, testUuid);
|
|
326
|
-
|
|
365
|
+
if (doc !== null && doc !== void 0 && doc.feature) {
|
|
366
|
+
this.featureNamesByTestCaseStartedId.set(data.id, doc.feature.name);
|
|
367
|
+
}
|
|
327
368
|
if (!(scenario !== null && scenario !== void 0 && scenario.examples)) {
|
|
328
369
|
return;
|
|
329
370
|
}
|
|
@@ -331,7 +372,7 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
331
372
|
var _example$tableHeader, _example$tableBody;
|
|
332
373
|
var exampleName = example !== null && example !== void 0 && example.name ? "Examples: ".concat(example.name) : "Examples";
|
|
333
374
|
var parameterNames = example === null || example === void 0 || (_example$tableHeader = example.tableHeader) === null || _example$tableHeader === void 0 ? void 0 : _example$tableHeader.cells.map(cell => cell.value);
|
|
334
|
-
var csvDataTableHeader =
|
|
375
|
+
var csvDataTableHeader = parameterNames ? serializeCsvRow(parameterNames) : "";
|
|
335
376
|
var currentRow = example === null || example === void 0 || (_example$tableBody = example.tableBody) === null || _example$tableBody === void 0 ? void 0 : _example$tableBody.find(tb => astIds.includes(tb.id));
|
|
336
377
|
if (currentRow) {
|
|
337
378
|
var parameters = currentRow.cells.map((cell, index) => {
|
|
@@ -344,7 +385,7 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
344
385
|
});
|
|
345
386
|
_this.allureRuntime.updateTest(testUuid, tr => tr.parameters = [...tr.parameters, ...parameters]);
|
|
346
387
|
}
|
|
347
|
-
var csvDataTableBody = (example === null || example === void 0 ? void 0 : example.tableBody.map(row => row.cells.map(cell => cell.value)
|
|
388
|
+
var csvDataTableBody = (example === null || example === void 0 ? void 0 : example.tableBody.map(row => serializeCsvRow(row.cells.map(cell => cell.value))).join("\n")) || "";
|
|
348
389
|
if (!csvDataTableHeader && !csvDataTableBody) {
|
|
349
390
|
return 1; // continue
|
|
350
391
|
}
|
|
@@ -369,9 +410,14 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
369
410
|
result.status = (_step$status = step === null || step === void 0 ? void 0 : step.status) !== null && _step$status !== void 0 ? _step$status : Status.PASSED;
|
|
370
411
|
result.stage = Stage.FINISHED;
|
|
371
412
|
if (step) {
|
|
372
|
-
|
|
413
|
+
var _step$statusDetails;
|
|
414
|
+
if (((_step$statusDetails = step.statusDetails) === null || _step$statusDetails === void 0 ? void 0 : _step$statusDetails.message) === UNDEFINED_STEP_MESSAGE) {
|
|
415
|
+
result.statusDetails = {
|
|
416
|
+
message: UNDEFINED_TEST_MESSAGE
|
|
417
|
+
};
|
|
418
|
+
} else if (step.status === undefined) {
|
|
373
419
|
result.statusDetails = {
|
|
374
|
-
message:
|
|
420
|
+
message: UNDEFINED_TEST_MESSAGE
|
|
375
421
|
};
|
|
376
422
|
} else {
|
|
377
423
|
result.statusDetails = _objectSpread(_objectSpread({}, result.statusDetails), step.statusDetails);
|
|
@@ -381,6 +427,19 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
381
427
|
this.allureRuntime.stopTest(testUuid, {
|
|
382
428
|
stop: TimeConversion.timestampToMillisecondsSinceEpoch(data.timestamp)
|
|
383
429
|
});
|
|
430
|
+
var featureName = this.featureNamesByTestCaseStartedId.get(data.testCaseStartedId);
|
|
431
|
+
if (featureName !== undefined) {
|
|
432
|
+
this.featureNamesByTestCaseStartedId.delete(data.testCaseStartedId);
|
|
433
|
+
// Runtime and global metadata can supply the feature before the result is written.
|
|
434
|
+
this.allureRuntime.updateTest(testUuid, result => {
|
|
435
|
+
if (!hasLabel(result, LabelName.FEATURE)) {
|
|
436
|
+
result.labels.push({
|
|
437
|
+
name: LabelName.FEATURE,
|
|
438
|
+
value: featureName
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
}
|
|
384
443
|
this.allureRuntime.writeTest(testUuid);
|
|
385
444
|
this.testResultUuids.delete(data.testCaseStartedId);
|
|
386
445
|
var scopeUuid = this.scopeUuids.get(data.testCaseStartedId);
|
|
@@ -433,7 +492,7 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
433
492
|
if (!((_stepPickle$argument = stepPickle.argument) !== null && _stepPickle$argument !== void 0 && _stepPickle$argument.dataTable)) {
|
|
434
493
|
return;
|
|
435
494
|
}
|
|
436
|
-
var csvDataTable = stepPickle.argument.dataTable.rows.reduce((acc, row) => "".concat(acc + row.cells.map(cell => cell.value)
|
|
495
|
+
var csvDataTable = stepPickle.argument.dataTable.rows.reduce((acc, row) => "".concat(acc + serializeCsvRow(row.cells.map(cell => cell.value)), "\n"), "");
|
|
437
496
|
this.allureRuntime.writeAttachment(testUuid, stepUuid, "Data table", Buffer.from(csvDataTable, "utf-8"), {
|
|
438
497
|
contentType: ContentType.CSV,
|
|
439
498
|
fileExtension: ".csv"
|
|
@@ -460,7 +519,11 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
460
519
|
}
|
|
461
520
|
});
|
|
462
521
|
if (error) {
|
|
463
|
-
this.allureRuntime.applyGlobalRuntimeMessages([toGlobalErrorMessage(
|
|
522
|
+
this.allureRuntime.applyGlobalRuntimeMessages([toGlobalErrorMessage({
|
|
523
|
+
name: this.getHookName(step.hookId),
|
|
524
|
+
details: getMessageAndTraceFromError(error),
|
|
525
|
+
status: status !== null && status !== void 0 ? status : getStatusFromError(error)
|
|
526
|
+
})]);
|
|
464
527
|
}
|
|
465
528
|
this.allureRuntime.stopFixture(fixtureUuid, {
|
|
466
529
|
stop: TimeConversion.timestampToMillisecondsSinceEpoch(data.timestamp)
|
|
@@ -476,9 +539,23 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
476
539
|
this.allureRuntime.updateStep(currentStep, r => {
|
|
477
540
|
r.status = status;
|
|
478
541
|
r.stage = stage;
|
|
479
|
-
if (status === undefined) {
|
|
542
|
+
if (data.testStepResult.status === TestStepResultStatus.UNDEFINED || status === undefined) {
|
|
543
|
+
r.statusDetails = {
|
|
544
|
+
message: UNDEFINED_STEP_MESSAGE
|
|
545
|
+
};
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
if (data.testStepResult.status === TestStepResultStatus.PENDING) {
|
|
549
|
+
var _data$testStepResult$;
|
|
480
550
|
r.statusDetails = {
|
|
481
|
-
message:
|
|
551
|
+
message: (_data$testStepResult$ = data.testStepResult.message) !== null && _data$testStepResult$ !== void 0 ? _data$testStepResult$ : PENDING_STEP_MESSAGE
|
|
552
|
+
};
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
if (data.testStepResult.status === TestStepResultStatus.AMBIGUOUS) {
|
|
556
|
+
var _data$testStepResult$2;
|
|
557
|
+
r.statusDetails = {
|
|
558
|
+
message: (_data$testStepResult$2 = data.testStepResult.message) !== null && _data$testStepResult$2 !== void 0 ? _data$testStepResult$2 : this.getAmbiguousStepMessage(step)
|
|
482
559
|
};
|
|
483
560
|
return;
|
|
484
561
|
}
|
|
@@ -546,10 +623,56 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
546
623
|
this.allureRuntime.applyGlobalRuntimeMessages(runtimeMessages);
|
|
547
624
|
}
|
|
548
625
|
}
|
|
626
|
+
|
|
627
|
+
// Cucumber 12.3+ reports test run hooks with messages. In parallel mode they run in workers,
|
|
628
|
+
// where the patched hook code isn't used, so the messages are the only source of their errors
|
|
629
|
+
onTestRunHookFinished(data) {
|
|
630
|
+
var _this$exceptionToErro, _data$result$exceptio, _data$result$message;
|
|
631
|
+
var hookId = this.testRunHookStartedMap.get(data.testRunHookStartedId);
|
|
632
|
+
if (hookId && this.runningTestRunHooks.get(hookId) === data.testRunHookStartedId) {
|
|
633
|
+
this.runningTestRunHooks.delete(hookId);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// dry runs report every test run hook as skipped
|
|
637
|
+
if (!hookId || data.result.status !== TestStepResultStatus.FAILED || this.reportedTestRunHookStartedIds.has(data.testRunHookStartedId)) {
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
var name = this.testRunHookTypes.get(hookId) === "AFTER_TEST_RUN" ? "AfterAll hook" : "BeforeAll hook";
|
|
641
|
+
var error = (_this$exceptionToErro = this.exceptionToError((_data$result$exceptio = data.result.exception) === null || _data$result$exceptio === void 0 ? void 0 : _data$result$exceptio.message, data.result.exception)) !== null && _this$exceptionToErro !== void 0 ? _this$exceptionToErro : {
|
|
642
|
+
name: "Error",
|
|
643
|
+
message: (_data$result$message = data.result.message) !== null && _data$result$message !== void 0 ? _data$result$message : ""
|
|
644
|
+
};
|
|
645
|
+
this.allureRuntime.applyGlobalRuntimeMessages([toGlobalErrorMessage({
|
|
646
|
+
name,
|
|
647
|
+
details: getMessageAndTraceFromError(error),
|
|
648
|
+
status: getStatusFromError(error)
|
|
649
|
+
})]);
|
|
650
|
+
}
|
|
549
651
|
onTestRunFinished() {
|
|
550
652
|
this.allureRuntime.writeCategoriesDefinitions();
|
|
551
653
|
this.allureRuntime.writeEnvironmentInfo();
|
|
552
654
|
}
|
|
655
|
+
|
|
656
|
+
// Cucumber 13+ no longer puts the matching step definitions into the ambiguous step result
|
|
657
|
+
getAmbiguousStepMessage(step) {
|
|
658
|
+
var _step$stepDefinitionI;
|
|
659
|
+
var stepDefinitions = ((_step$stepDefinitionI = step.stepDefinitionIds) !== null && _step$stepDefinitionI !== void 0 ? _step$stepDefinitionI : []).map(id => this.stepDefinitionMap.get(id)).filter(stepDefinition => stepDefinition !== undefined);
|
|
660
|
+
if (stepDefinitions.length === 0) {
|
|
661
|
+
return AMBIGUOUS_STEP_MESSAGE;
|
|
662
|
+
}
|
|
663
|
+
var matches = stepDefinitions.map(_ref6 => {
|
|
664
|
+
var _sourceReference$loca;
|
|
665
|
+
var {
|
|
666
|
+
pattern,
|
|
667
|
+
sourceReference
|
|
668
|
+
} = _ref6;
|
|
669
|
+
var patternText = pattern.type === StepDefinitionPatternType.REGULAR_EXPRESSION ? "/".concat(pattern.source, "/") : pattern.source;
|
|
670
|
+
var line = (_sourceReference$loca = sourceReference.location) === null || _sourceReference$loca === void 0 ? void 0 : _sourceReference$loca.line;
|
|
671
|
+
var location = sourceReference.uri ? "".concat(sourceReference.uri).concat(line !== undefined ? ":".concat(line) : "") : "";
|
|
672
|
+
return location ? " ".concat(patternText, " - ").concat(location) : " ".concat(patternText);
|
|
673
|
+
});
|
|
674
|
+
return ["Multiple step definitions match:", ...matches].join("\n");
|
|
675
|
+
}
|
|
553
676
|
exceptionToError(message, exception) {
|
|
554
677
|
if (!exception) {
|
|
555
678
|
return;
|
|
@@ -561,12 +684,6 @@ export default class AllureCucumberReporter extends Formatter {
|
|
|
561
684
|
};
|
|
562
685
|
}
|
|
563
686
|
}
|
|
564
|
-
var toGlobalErrorMessage = (name, details) => ({
|
|
565
|
-
type: "global_error",
|
|
566
|
-
data: _objectSpread(_objectSpread({}, details), {}, {
|
|
567
|
-
message: details.message ? "".concat(name, " failed: ").concat(details.message) : "".concat(name, " failed")
|
|
568
|
-
})
|
|
569
|
-
});
|
|
570
687
|
var isPromiseLike = value => Boolean(value) && typeof value.then === "function";
|
|
571
688
|
var deferReject = error => new Promise((_resolve, reject) => setImmediate(() => reject(error)));
|
|
572
689
|
//# sourceMappingURL=reporter.js.map
|