@wdio/allure-reporter 7.21.0 → 8.0.0-alpha.239

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 CHANGED
@@ -76,13 +76,13 @@ exports.config = {
76
76
  ### Usage
77
77
  Allure Api can be accessed using:
78
78
 
79
- ES5
79
+ CJS
80
80
 
81
81
  ```js
82
82
  const allureReporter = require('@wdio/allure-reporter').default
83
83
  ```
84
84
 
85
- ES6
85
+ ESM
86
86
 
87
87
  ```js
88
88
  import allureReporter from '@wdio/allure-reporter'
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  function indentAll(lines) {
4
2
  return lines.split('\n').map(x => ' ' + x).join('\n');
5
3
  }
@@ -7,7 +5,7 @@ function indentAll(lines) {
7
5
  * An error that encapsulates more than one error, to support soft-assertions from Jasmine
8
6
  * even though Allure's API assumes one error-per test
9
7
  */
10
- class CompoundError extends Error {
8
+ export default class CompoundError extends Error {
11
9
  constructor(...innerErrors) {
12
10
  const message = ['CompoundError: One or more errors occurred. ---\n'].
13
11
  concat(innerErrors.map(x => {
@@ -19,4 +17,3 @@ class CompoundError extends Error {
19
17
  this.innerErrors = innerErrors;
20
18
  }
21
19
  }
22
- exports.default = CompoundError;
@@ -1,27 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.linkPlaceholder = exports.mochaAllHooks = exports.mochaEachHooks = exports.events = exports.stepStatuses = exports.testStatuses = exports.SKIPPED = exports.CANCELED = exports.PENDING = exports.BROKEN = exports.FAILED = exports.PASSED = void 0;
4
- exports.PASSED = 'passed';
5
- exports.FAILED = 'failed';
6
- exports.BROKEN = 'broken';
7
- exports.PENDING = 'pending';
8
- exports.CANCELED = 'canceled';
9
- exports.SKIPPED = 'skipped';
1
+ export const PASSED = 'passed';
2
+ export const FAILED = 'failed';
3
+ export const BROKEN = 'broken';
4
+ export const PENDING = 'pending';
5
+ export const CANCELED = 'canceled';
6
+ export const SKIPPED = 'skipped';
10
7
  const testStatuses = {
11
- PASSED: exports.PASSED,
12
- FAILED: exports.FAILED,
13
- BROKEN: exports.BROKEN,
14
- PENDING: exports.PENDING
8
+ PASSED,
9
+ FAILED,
10
+ BROKEN,
11
+ PENDING
15
12
  };
16
- exports.testStatuses = testStatuses;
17
13
  const stepStatuses = {
18
- PASSED: exports.PASSED,
19
- FAILED: exports.FAILED,
20
- BROKEN: exports.BROKEN,
21
- CANCELED: exports.CANCELED,
22
- SKIPPED: exports.SKIPPED
14
+ PASSED,
15
+ FAILED,
16
+ BROKEN,
17
+ CANCELED,
18
+ SKIPPED
23
19
  };
24
- exports.stepStatuses = stepStatuses;
25
20
  const events = {
26
21
  addLabel: 'allure:addLabel',
27
22
  addFeature: 'allure:addFeature',
@@ -37,10 +32,7 @@ const events = {
37
32
  addStep: 'allure:addStep',
38
33
  addArgument: 'allure:addArgument'
39
34
  };
40
- exports.events = events;
41
35
  const mochaEachHooks = ['"before each" hook', '"after each" hook'];
42
- exports.mochaEachHooks = mochaEachHooks;
43
36
  const mochaAllHooks = ['"before all" hook', '"after all" hook'];
44
- exports.mochaAllHooks = mochaAllHooks;
45
37
  const linkPlaceholder = '{}';
46
- exports.linkPlaceholder = linkPlaceholder;
38
+ export { testStatuses, stepStatuses, events, mochaEachHooks, mochaAllHooks, linkPlaceholder };
package/build/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import WDIOReporter, { SuiteStats, HookStats, RunnerStats, TestStats, BeforeCommandArgs, AfterCommandArgs, CommandArgs } from '@wdio/reporter';
3
- import { AddAttachmentEventArgs, AddDescriptionEventArgs, AddEnvironmentEventArgs, AddFeatureEventArgs, AddIssueEventArgs, AddLabelEventArgs, AddSeverityEventArgs, AddStoryEventArgs, AddTestIdEventArgs, AllureReporterOptions, Status } from './types';
3
+ import { AddAttachmentEventArgs, AddDescriptionEventArgs, AddEnvironmentEventArgs, AddFeatureEventArgs, AddIssueEventArgs, AddLabelEventArgs, AddSeverityEventArgs, AddStoryEventArgs, AddTestIdEventArgs, AllureReporterOptions, Status } from './types.js';
4
4
  declare class AllureReporter extends WDIOReporter {
5
5
  private _allure;
6
6
  private _capabilities;
@@ -138,7 +138,7 @@ declare class AllureReporter extends WDIOReporter {
138
138
  }
139
139
  export default AllureReporter;
140
140
  export { AllureReporterOptions };
141
- export * from './types';
141
+ export * from './types.js';
142
142
  declare global {
143
143
  namespace WebdriverIO {
144
144
  interface ReporterOption extends AllureReporterOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,EAAE,EACjB,UAAU,EAAO,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EACrE,gBAAgB,EAAE,WAAW,EAChC,MAAM,gBAAgB,CAAA;AAQvB,OAAO,EACH,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,EACxE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,oBAAoB,EAC/E,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,EACvE,MAAM,SAAS,CAAA;AAUhB,cAAM,cAAe,SAAQ,YAAY;IACrC,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,OAAO,CAAC,CAAoB;IACpC,OAAO,CAAC,eAAe,CAAC,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,oBAAoB,CAAU;IACtC,OAAO,CAAC,eAAe,CAAS;gBAEpB,OAAO,GAAE,qBAA0B;IA6B/C,iBAAiB;IAgBjB,aAAa,CAAC,MAAM,EAAE,WAAW;IAMjC,YAAY,CAAC,KAAK,EAAE,UAAU;IAwB9B,UAAU,CAAC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;IAED;;;;;OAKG;IACH,MAAM,CAAC,cAAc,gBAAiB,MAAM,mBAAmB,MAAM,UAEpE;IAED;;;;;;OAMG;IACH,MAAM,CAAC,aAAa,SAAU,MAAM,WAAW,MAAM,GAAG,MAAM,GAAG,MAAM,QAAQ,MAAM,UAKpF;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,UAAW,MAAM,UAEhC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAO,YAAY,MAAM,UAK/B;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,OAAO,UAAW,MAAM,4BAI5B,GAAG,WAAe,MAAM,UAO1B;IAED;;;;;OAKG;IACH,MAAM,CAAC,WAAW,SAAU,MAAM,SAAS,MAAM,UAEhD;CACJ;AAED,eAAe,cAAc,CAAA;AAE7B,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAChC,cAAc,YAAY,CAAA;AAE1B,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,cAAe,SAAQ,qBAAqB;SAAI;KAC7D;CACJ"}
package/build/index.js CHANGED
@@ -1,33 +1,16 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- const reporter_1 = __importDefault(require("@wdio/reporter"));
21
- const utils_1 = require("./utils");
22
- const constants_1 = require("./constants");
23
- const sync_1 = require("csv-stringify/sync");
1
+ import { createRequire } from 'node:module';
2
+ import { stringify } from 'csv-stringify/sync';
3
+ import WDIOReporter from '@wdio/reporter';
4
+ import { getTestStatus, isEmpty, tellReporter, isMochaEachHooks, getErrorFromFailedTest, isMochaAllHooks, getLinkByTemplate, attachConsoleLogs } from './utils.js';
5
+ import { events, PASSED, PENDING, SKIPPED, stepStatuses } from './constants.js';
6
+ const require = createRequire(import.meta.url);
24
7
  /**
25
8
  * Allure v1 has no proper TS support
26
9
  * ToDo(Christian): update to Allure v2 (https://github.com/webdriverio/webdriverio/issues/6313)
27
10
  */
28
11
  const Allure = require('allure-js-commons');
29
- const Step = require('allure-js-commons/beans/step');
30
- class AllureReporter extends reporter_1.default {
12
+ const Step = require('allure-js-commons/beans/step.js');
13
+ class AllureReporter extends WDIOReporter {
31
14
  constructor(options = {}) {
32
15
  const outputDir = options.outputDir || 'allure-results';
33
16
  super({
@@ -54,19 +37,19 @@ class AllureReporter extends reporter_1.default {
54
37
  }
55
38
  }
56
39
  registerListeners() {
57
- process.on(constants_1.events.addLabel, this.addLabel.bind(this));
58
- process.on(constants_1.events.addFeature, this.addFeature.bind(this));
59
- process.on(constants_1.events.addStory, this.addStory.bind(this));
60
- process.on(constants_1.events.addSeverity, this.addSeverity.bind(this));
61
- process.on(constants_1.events.addIssue, this.addIssue.bind(this));
62
- process.on(constants_1.events.addTestId, this.addTestId.bind(this));
63
- process.on(constants_1.events.addEnvironment, this.addEnvironment.bind(this));
64
- process.on(constants_1.events.addAttachment, this.addAttachment.bind(this));
65
- process.on(constants_1.events.addDescription, this.addDescription.bind(this));
66
- process.on(constants_1.events.startStep, this.startStep.bind(this));
67
- process.on(constants_1.events.endStep, this.endStep.bind(this));
68
- process.on(constants_1.events.addStep, this.addStep.bind(this));
69
- process.on(constants_1.events.addArgument, this.addArgument.bind(this));
40
+ process.on(events.addLabel, this.addLabel.bind(this));
41
+ process.on(events.addFeature, this.addFeature.bind(this));
42
+ process.on(events.addStory, this.addStory.bind(this));
43
+ process.on(events.addSeverity, this.addSeverity.bind(this));
44
+ process.on(events.addIssue, this.addIssue.bind(this));
45
+ process.on(events.addTestId, this.addTestId.bind(this));
46
+ process.on(events.addEnvironment, this.addEnvironment.bind(this));
47
+ process.on(events.addAttachment, this.addAttachment.bind(this));
48
+ process.on(events.addDescription, this.addDescription.bind(this));
49
+ process.on(events.startStep, this.startStep.bind(this));
50
+ process.on(events.endStep, this.endStep.bind(this));
51
+ process.on(events.addStep, this.addStep.bind(this));
52
+ process.on(events.addArgument, this.addArgument.bind(this));
70
53
  }
71
54
  onRunnerStart(runner) {
72
55
  this._config = runner.config;
@@ -107,12 +90,12 @@ class AllureReporter extends reporter_1.default {
107
90
  return this._allure.endCase('passed');
108
91
  }
109
92
  // A scenario is it skipped if every steps are skipped and hooks are passed or skipped
110
- const isSkipped = suite.tests.every(item => [constants_1.SKIPPED].indexOf(item.state) >= 0) && suite.hooks.every(item => [constants_1.PASSED, constants_1.SKIPPED].indexOf(item.state) >= 0);
93
+ const isSkipped = suite.tests.every(item => [SKIPPED].indexOf(item.state) >= 0) && suite.hooks.every(item => [PASSED, SKIPPED].indexOf(item.state) >= 0);
111
94
  if (isSkipped) {
112
- return this._allure.endCase(constants_1.PENDING);
95
+ return this._allure.endCase(PENDING);
113
96
  }
114
97
  // A scenario is it passed if certain steps are passed and all other are skipped and every hooks are passed or skipped
115
- const isPartiallySkipped = suiteChildren.every(item => [constants_1.PASSED, constants_1.SKIPPED].indexOf(item.state) >= 0);
98
+ const isPartiallySkipped = suiteChildren.every(item => [PASSED, SKIPPED].indexOf(item.state) >= 0);
116
99
  if (isPartiallySkipped) {
117
100
  return this._allure.endCase('passed');
118
101
  }
@@ -123,7 +106,6 @@ class AllureReporter extends reporter_1.default {
123
106
  this._allure.endSuite();
124
107
  }
125
108
  onTestStart(test) {
126
- var _a;
127
109
  this._consoleOutput = '';
128
110
  const testTitle = test.currentTest ? test.currentTest : test.title;
129
111
  if (this.isAnyTestRunning() && this._allure.getCurrentTest().name == testTitle) {
@@ -134,10 +116,10 @@ class AllureReporter extends reporter_1.default {
134
116
  if (this._options.useCucumberStepReporter) {
135
117
  const step = this._allure.startStep(testTitle);
136
118
  const testObj = test;
137
- const argument = testObj === null || testObj === void 0 ? void 0 : testObj.argument;
138
- const dataTable = (_a = argument === null || argument === void 0 ? void 0 : argument.rows) === null || _a === void 0 ? void 0 : _a.map((a) => a === null || a === void 0 ? void 0 : a.cells);
119
+ const argument = testObj?.argument;
120
+ const dataTable = argument?.rows?.map((a) => a?.cells);
139
121
  if (dataTable) {
140
- this._allure.addAttachment('Data Table', (0, sync_1.stringify)(dataTable), 'text/csv');
122
+ this._allure.addAttachment('Data Table', stringify(dataTable), 'text/csv');
141
123
  }
142
124
  return step;
143
125
  }
@@ -181,26 +163,26 @@ class AllureReporter extends reporter_1.default {
181
163
  return labels;
182
164
  }
183
165
  onTestPass() {
184
- (0, utils_1.attachConsoleLogs)(this._consoleOutput, this._allure);
166
+ attachConsoleLogs(this._consoleOutput, this._allure);
185
167
  if (this._options.useCucumberStepReporter) {
186
168
  const suite = this._allure.getCurrentSuite();
187
169
  if (suite && suite.currentStep instanceof Step) {
188
170
  return this._allure.endStep('passed');
189
171
  }
190
172
  }
191
- this._allure.endCase(constants_1.PASSED);
173
+ this._allure.endCase(PASSED);
192
174
  }
193
175
  onTestFail(test) {
194
176
  if (this._options.useCucumberStepReporter) {
195
- (0, utils_1.attachConsoleLogs)(this._consoleOutput, this._allure);
196
- const testStatus = (0, utils_1.getTestStatus)(test, this._config);
197
- const stepStatus = Object.values(constants_1.stepStatuses).indexOf(testStatus) >= 0 ?
177
+ attachConsoleLogs(this._consoleOutput, this._allure);
178
+ const testStatus = getTestStatus(test, this._config);
179
+ const stepStatus = Object.values(stepStatuses).indexOf(testStatus) >= 0 ?
198
180
  testStatus : 'failed';
199
181
  const suite = this._allure.getCurrentSuite();
200
182
  if (suite && suite.currentStep instanceof Step) {
201
183
  this._allure.endStep(stepStatus);
202
184
  }
203
- this._allure.endCase(testStatus, (0, utils_1.getErrorFromFailedTest)(test));
185
+ this._allure.endCase(testStatus, getErrorFromFailedTest(test));
204
186
  return;
205
187
  }
206
188
  if (!this.isAnyTestRunning()) { // is any CASE running
@@ -209,15 +191,15 @@ class AllureReporter extends reporter_1.default {
209
191
  else {
210
192
  this._allure.getCurrentTest().name = test.title;
211
193
  }
212
- (0, utils_1.attachConsoleLogs)(this._consoleOutput, this._allure);
213
- const status = (0, utils_1.getTestStatus)(test, this._config);
194
+ attachConsoleLogs(this._consoleOutput, this._allure);
195
+ const status = getTestStatus(test, this._config);
214
196
  while (this._allure.getCurrentSuite().currentStep instanceof Step) {
215
197
  this._allure.endStep(status);
216
198
  }
217
- this._allure.endCase(status, (0, utils_1.getErrorFromFailedTest)(test));
199
+ this._allure.endCase(status, getErrorFromFailedTest(test));
218
200
  }
219
201
  onTestSkip(test) {
220
- (0, utils_1.attachConsoleLogs)(this._consoleOutput, this._allure);
202
+ attachConsoleLogs(this._consoleOutput, this._allure);
221
203
  if (this._options.useCucumberStepReporter) {
222
204
  const suite = this._allure.getCurrentSuite();
223
205
  if (suite && suite.currentStep instanceof Step) {
@@ -243,7 +225,7 @@ class AllureReporter extends reporter_1.default {
243
225
  ? `${command.method} ${command.endpoint}`
244
226
  : command.command);
245
227
  const payload = command.body || command.params;
246
- if (!(0, utils_1.isEmpty)(payload)) {
228
+ if (!isEmpty(payload)) {
247
229
  this.dumpJSON('Request', payload);
248
230
  }
249
231
  }
@@ -278,14 +260,14 @@ class AllureReporter extends reporter_1.default {
278
260
  return false;
279
261
  }
280
262
  // add beforeEach / afterEach hook as step to test
281
- if (this._options.disableMochaHooks && (0, utils_1.isMochaEachHooks)(hook.title)) {
263
+ if (this._options.disableMochaHooks && isMochaEachHooks(hook.title)) {
282
264
  if (this._allure.getCurrentTest()) {
283
265
  this._allure.startStep(hook.title);
284
266
  }
285
267
  return;
286
268
  }
287
269
  // don't add hook as test to suite for mocha All hooks
288
- if (this._options.disableMochaHooks && (0, utils_1.isMochaAllHooks)(hook.title)) {
270
+ if (this._options.disableMochaHooks && isMochaAllHooks(hook.title)) {
289
271
  return;
290
272
  }
291
273
  // add hook as test to suite
@@ -293,11 +275,11 @@ class AllureReporter extends reporter_1.default {
293
275
  }
294
276
  onHookEnd(hook) {
295
277
  // ignore global hooks
296
- if (!hook.parent || !this._allure.getCurrentSuite() || (this._options.disableMochaHooks && !(0, utils_1.isMochaAllHooks)(hook.title) && !this._allure.getCurrentTest())) {
278
+ if (!hook.parent || !this._allure.getCurrentSuite() || (this._options.disableMochaHooks && !isMochaAllHooks(hook.title) && !this._allure.getCurrentTest())) {
297
279
  return false;
298
280
  }
299
281
  // set beforeEach / afterEach hook (step) status
300
- if (this._options.disableMochaHooks && (0, utils_1.isMochaEachHooks)(hook.title)) {
282
+ if (this._options.disableMochaHooks && isMochaEachHooks(hook.title)) {
301
283
  if (hook.error) {
302
284
  this._allure.endStep('failed');
303
285
  }
@@ -308,14 +290,14 @@ class AllureReporter extends reporter_1.default {
308
290
  }
309
291
  // set hook (test) status
310
292
  if (hook.error) {
311
- if (this._options.disableMochaHooks && (0, utils_1.isMochaAllHooks)(hook.title)) {
293
+ if (this._options.disableMochaHooks && isMochaAllHooks(hook.title)) {
312
294
  this.onTestStart(hook);
313
295
  this.attachScreenshot();
314
296
  }
315
297
  this.onTestFail(hook);
316
298
  }
317
299
  else if (this._options.disableMochaHooks || this._options.useCucumberStepReporter) {
318
- if (!(0, utils_1.isMochaAllHooks)(hook.title)) {
300
+ if (!isMochaAllHooks(hook.title)) {
319
301
  this.onTestPass();
320
302
  // remove hook from suite if it has no steps
321
303
  if (this._allure.getCurrentTest().steps.length === 0 && !this._options.useCucumberStepReporter) {
@@ -369,7 +351,7 @@ class AllureReporter extends reporter_1.default {
369
351
  return false;
370
352
  }
371
353
  const test = this._allure.getCurrentTest();
372
- const issueLink = (0, utils_1.getLinkByTemplate)(this._options.issueLinkTemplate, issue);
354
+ const issueLink = getLinkByTemplate(this._options.issueLinkTemplate, issue);
373
355
  test.addLabel('issue', issueLink);
374
356
  }
375
357
  addTestId({ testId }) {
@@ -377,7 +359,7 @@ class AllureReporter extends reporter_1.default {
377
359
  return false;
378
360
  }
379
361
  const test = this._allure.getCurrentTest();
380
- const tmsLink = (0, utils_1.getLinkByTemplate)(this._options.tmsLinkTemplate, testId);
362
+ const tmsLink = getLinkByTemplate(this._options.tmsLinkTemplate, testId);
381
363
  test.addLabel('testId', tmsLink);
382
364
  }
383
365
  addEnvironment({ name, value }) {
@@ -463,7 +445,7 @@ class AllureReporter extends reporter_1.default {
463
445
  * @param {(string)} featureName - feature name or an array of names
464
446
  */
465
447
  AllureReporter.addFeature = (featureName) => {
466
- (0, utils_1.tellReporter)(constants_1.events.addFeature, { featureName });
448
+ tellReporter(events.addFeature, { featureName });
467
449
  };
468
450
  /**
469
451
  * Assign label to test
@@ -472,7 +454,7 @@ AllureReporter.addFeature = (featureName) => {
472
454
  * @param {string} value - label value
473
455
  */
474
456
  AllureReporter.addLabel = (name, value) => {
475
- (0, utils_1.tellReporter)(constants_1.events.addLabel, { name, value });
457
+ tellReporter(events.addLabel, { name, value });
476
458
  };
477
459
  /**
478
460
  * Assign severity to test
@@ -480,7 +462,7 @@ AllureReporter.addLabel = (name, value) => {
480
462
  * @param {string} severity - severity value
481
463
  */
482
464
  AllureReporter.addSeverity = (severity) => {
483
- (0, utils_1.tellReporter)(constants_1.events.addSeverity, { severity });
465
+ tellReporter(events.addSeverity, { severity });
484
466
  };
485
467
  /**
486
468
  * Assign issue id to test
@@ -488,7 +470,7 @@ AllureReporter.addSeverity = (severity) => {
488
470
  * @param {string} issue - issue id value
489
471
  */
490
472
  AllureReporter.addIssue = (issue) => {
491
- (0, utils_1.tellReporter)(constants_1.events.addIssue, { issue });
473
+ tellReporter(events.addIssue, { issue });
492
474
  };
493
475
  /**
494
476
  * Assign TMS test id to test
@@ -496,7 +478,7 @@ AllureReporter.addIssue = (issue) => {
496
478
  * @param {string} testId - test id value
497
479
  */
498
480
  AllureReporter.addTestId = (testId) => {
499
- (0, utils_1.tellReporter)(constants_1.events.addTestId, { testId });
481
+ tellReporter(events.addTestId, { testId });
500
482
  };
501
483
  /**
502
484
  * Assign story to test
@@ -504,7 +486,7 @@ AllureReporter.addTestId = (testId) => {
504
486
  * @param {string} storyName - story name for test
505
487
  */
506
488
  AllureReporter.addStory = (storyName) => {
507
- (0, utils_1.tellReporter)(constants_1.events.addStory, { storyName });
489
+ tellReporter(events.addStory, { storyName });
508
490
  };
509
491
  /**
510
492
  * Add environment value
@@ -513,7 +495,7 @@ AllureReporter.addStory = (storyName) => {
513
495
  * @param {string} value - environment value
514
496
  */
515
497
  AllureReporter.addEnvironment = (name, value) => {
516
- (0, utils_1.tellReporter)(constants_1.events.addEnvironment, { name, value });
498
+ tellReporter(events.addEnvironment, { name, value });
517
499
  };
518
500
  /**
519
501
  * Assign test description to test
@@ -522,7 +504,7 @@ AllureReporter.addEnvironment = (name, value) => {
522
504
  * @param {string} descriptionType - description type 'text'\'html'\'markdown'
523
505
  */
524
506
  AllureReporter.addDescription = (description, descriptionType) => {
525
- (0, utils_1.tellReporter)(constants_1.events.addDescription, { description, descriptionType });
507
+ tellReporter(events.addDescription, { description, descriptionType });
526
508
  };
527
509
  /**
528
510
  * Add attachment
@@ -535,7 +517,7 @@ AllureReporter.addAttachment = (name, content, type) => {
535
517
  if (!type) {
536
518
  type = content instanceof Buffer ? 'image/png' : typeof content === 'string' ? 'text/plain' : 'application/json';
537
519
  }
538
- (0, utils_1.tellReporter)(constants_1.events.addAttachment, { name, content, type });
520
+ tellReporter(events.addAttachment, { name, content, type });
539
521
  };
540
522
  /**
541
523
  * Start allure step
@@ -543,7 +525,7 @@ AllureReporter.addAttachment = (name, content, type) => {
543
525
  * @param {string} title - step name in report
544
526
  */
545
527
  AllureReporter.startStep = (title) => {
546
- (0, utils_1.tellReporter)(constants_1.events.startStep, title);
528
+ tellReporter(events.startStep, title);
547
529
  };
548
530
  /**
549
531
  * End current allure step
@@ -551,10 +533,10 @@ AllureReporter.startStep = (title) => {
551
533
  * @param {StepStatus} [status='passed'] - step status
552
534
  */
553
535
  AllureReporter.endStep = (status = 'passed') => {
554
- if (!Object.values(constants_1.stepStatuses).includes(status)) {
555
- throw new Error(`Step status must be ${Object.values(constants_1.stepStatuses).join(' or ')}. You tried to set "${status}"`);
536
+ if (!Object.values(stepStatuses).includes(status)) {
537
+ throw new Error(`Step status must be ${Object.values(stepStatuses).join(' or ')}. You tried to set "${status}"`);
556
538
  }
557
- (0, utils_1.tellReporter)(constants_1.events.endStep, status);
539
+ tellReporter(events.endStep, status);
558
540
  };
559
541
  /**
560
542
  * Create allure step
@@ -567,11 +549,11 @@ AllureReporter.endStep = (status = 'passed') => {
567
549
  * @param {string} [status='passed'] - step status
568
550
  */
569
551
  AllureReporter.addStep = (title, { content, name = 'attachment', type = 'text/plain' } = {}, status = 'passed') => {
570
- if (!Object.values(constants_1.stepStatuses).includes(status)) {
571
- throw new Error(`Step status must be ${Object.values(constants_1.stepStatuses).join(' or ')}. You tried to set "${status}"`);
552
+ if (!Object.values(stepStatuses).includes(status)) {
553
+ throw new Error(`Step status must be ${Object.values(stepStatuses).join(' or ')}. You tried to set "${status}"`);
572
554
  }
573
555
  const step = content ? { title, attachment: { content, name, type }, status } : { title, status };
574
- (0, utils_1.tellReporter)(constants_1.events.addStep, { step });
556
+ tellReporter(events.addStep, { step });
575
557
  };
576
558
  /**
577
559
  * Add additional argument to test
@@ -580,7 +562,7 @@ AllureReporter.addStep = (title, { content, name = 'attachment', type = 'text/pl
580
562
  * @param {string} value - argument value
581
563
  */
582
564
  AllureReporter.addArgument = (name, value) => {
583
- (0, utils_1.tellReporter)(constants_1.events.addArgument, { name, value });
565
+ tellReporter(events.addArgument, { name, value });
584
566
  };
585
- exports.default = AllureReporter;
586
- __exportStar(require("./types"), exports);
567
+ export default AllureReporter;
568
+ export * from './types.js';
package/build/types.js CHANGED
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TYPE = void 0;
4
- var TYPE;
1
+ export var TYPE;
5
2
  (function (TYPE) {
6
3
  TYPE["TEXT"] = "text";
7
4
  TYPE["HTML"] = "html";
8
5
  TYPE["MARKDOWN"] = "markdown";
9
- })(TYPE = exports.TYPE || (exports.TYPE = {}));
6
+ })(TYPE || (TYPE = {}));
package/build/utils.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { HookStats, TestStats } from '@wdio/reporter';
2
2
  import type { Options } from '@wdio/types';
3
- import CompoundError from './compoundError';
4
- import type { Status } from './types';
3
+ import CompoundError from './compoundError.js';
5
4
  import AllureReporter from './index.js';
5
+ import type { Status } from './types';
6
6
  /**
7
7
  * Get allure test status by TestStat object
8
8
  * @param test {Object} - TestStat object
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,cAAc,MAAM,YAAY,CAAA;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAAU,SAAS,GAAG,SAAS,WAAW,QAAQ,UAAU,KAAI,MAiBzF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,WAAY,GAAG,YAAgD,CAAA;AAEnF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,YAAsD,CAAA;AAEpG;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UAAW,MAAM,YAAqD,CAAA;AAElG;;;;;GAK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G,SAAS,MAAM,MAAM,WAQzE,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SAAU,MAAM,GAAG,SAAS,UAAU,cAAc,CAAC,SAAS,CAAC,SAS5F,CAAA"}
package/build/utils.js CHANGED
@@ -1,20 +1,14 @@
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.attachConsoleLogs = exports.getLinkByTemplate = exports.getErrorFromFailedTest = exports.tellReporter = exports.isMochaAllHooks = exports.isMochaEachHooks = exports.isEmpty = exports.getTestStatus = void 0;
7
- const process_1 = __importDefault(require("process"));
8
- const strip_ansi_1 = __importDefault(require("strip-ansi"));
9
- const compoundError_1 = __importDefault(require("./compoundError"));
10
- const constants_1 = require("./constants");
1
+ import process from 'node:process';
2
+ import stripAnsi from 'strip-ansi';
3
+ import CompoundError from './compoundError.js';
4
+ import { mochaEachHooks, mochaAllHooks, linkPlaceholder } from './constants.js';
11
5
  /**
12
6
  * Get allure test status by TestStat object
13
7
  * @param test {Object} - TestStat object
14
8
  * @param config {Object} - wdio config object
15
9
  * @private
16
10
  */
17
- const getTestStatus = (test, config) => {
11
+ export const getTestStatus = (test, config) => {
18
12
  if (config && config.framework === 'jasmine') {
19
13
  return 'failed';
20
14
  }
@@ -30,66 +24,60 @@ const getTestStatus = (test, config) => {
30
24
  }
31
25
  return 'broken';
32
26
  };
33
- exports.getTestStatus = getTestStatus;
34
27
  /**
35
28
  * Check is object is empty
36
29
  * @param object {Object}
37
30
  * @private
38
31
  */
39
- const isEmpty = (object) => !object || Object.keys(object).length === 0;
40
- exports.isEmpty = isEmpty;
32
+ export const isEmpty = (object) => !object || Object.keys(object).length === 0;
41
33
  /**
42
34
  * Is mocha beforeEach / afterEach hook
43
35
  * @param title {String} - hook title
44
36
  * @returns {boolean}
45
37
  * @private
46
38
  */
47
- const isMochaEachHooks = (title) => constants_1.mochaEachHooks.some(hook => title.includes(hook));
48
- exports.isMochaEachHooks = isMochaEachHooks;
39
+ export const isMochaEachHooks = (title) => mochaEachHooks.some(hook => title.includes(hook));
49
40
  /**
50
41
  * Is mocha beforeAll / afterAll hook
51
42
  * @param title {String} - hook title
52
43
  * @returns {boolean}
53
44
  * @private
54
45
  */
55
- const isMochaAllHooks = (title) => constants_1.mochaAllHooks.some(hook => title.includes(hook));
56
- exports.isMochaAllHooks = isMochaAllHooks;
46
+ export const isMochaAllHooks = (title) => mochaAllHooks.some(hook => title.includes(hook));
57
47
  /**
58
48
  * Call reporter
59
49
  * @param {string} event - event name
60
50
  * @param {Object} msg - event payload
61
51
  * @private
62
52
  */
63
- const tellReporter = (event, msg = {}) => {
53
+ export const tellReporter = (event, msg = {}) => {
64
54
  // Node 14 typings does not accept string in process.emit, but allow string in process.on
65
- process_1.default.emit(event, msg);
55
+ process.emit(event, msg);
66
56
  };
67
- exports.tellReporter = tellReporter;
68
57
  /**
69
58
  * Properly format error from different test runners
70
59
  * @param {Object} test - TestStat object
71
60
  * @returns {Object} - error object
72
61
  * @private
73
62
  */
74
- const getErrorFromFailedTest = (test) => {
63
+ export const getErrorFromFailedTest = (test) => {
75
64
  if (test.errors && Array.isArray(test.errors)) {
76
65
  for (let i = 0; i < test.errors.length; i += 1) {
77
66
  if (test.errors[i].message)
78
- test.errors[i].message = (0, strip_ansi_1.default)(test.errors[i].message);
67
+ test.errors[i].message = stripAnsi(test.errors[i].message);
79
68
  if (test.errors[i].stack)
80
- test.errors[i].stack = (0, strip_ansi_1.default)(test.errors[i].stack);
69
+ test.errors[i].stack = stripAnsi(test.errors[i].stack);
81
70
  }
82
- return test.errors.length === 1 ? test.errors[0] : new compoundError_1.default(...test.errors);
71
+ return test.errors.length === 1 ? test.errors[0] : new CompoundError(...test.errors);
83
72
  }
84
73
  if (test.error) {
85
74
  if (test.error.message)
86
- test.error.message = (0, strip_ansi_1.default)(test.error.message);
75
+ test.error.message = stripAnsi(test.error.message);
87
76
  if (test.error.stack)
88
- test.error.stack = (0, strip_ansi_1.default)(test.error.stack);
77
+ test.error.stack = stripAnsi(test.error.stack);
89
78
  }
90
79
  return test.error;
91
80
  };
92
- exports.getErrorFromFailedTest = getErrorFromFailedTest;
93
81
  /**
94
82
  * Substitute task id to link template
95
83
  * @param {string} template - link template
@@ -97,26 +85,24 @@ exports.getErrorFromFailedTest = getErrorFromFailedTest;
97
85
  * @returns {string} - link after substitution
98
86
  * @private
99
87
  */
100
- const getLinkByTemplate = (template, id) => {
88
+ export const getLinkByTemplate = (template, id) => {
101
89
  if (typeof template !== 'string') {
102
90
  return id;
103
91
  }
104
- if (!template.includes(constants_1.linkPlaceholder)) {
105
- throw Error(`The link template "${template}" must contain ${constants_1.linkPlaceholder} substring.`);
92
+ if (!template.includes(linkPlaceholder)) {
93
+ throw Error(`The link template "${template}" must contain ${linkPlaceholder} substring.`);
106
94
  }
107
- return template.replace(constants_1.linkPlaceholder, id);
95
+ return template.replace(linkPlaceholder, id);
108
96
  };
109
- exports.getLinkByTemplate = getLinkByTemplate;
110
97
  /**
111
98
  *
112
99
  * @param {string} logs - logs to be attached
113
100
  * @param {string} allure - allure report object
114
101
  * @private
115
102
  */
116
- const attachConsoleLogs = (logs, allure) => {
103
+ export const attachConsoleLogs = (logs, allure) => {
117
104
  if (logs) {
118
- allure === null || allure === void 0 ? void 0 : allure.addAttachment('Console Logs', '<pre style="display: inline-block; background-color: #4d4d4d; color: white; padding: 20px; text-shadow: 1px 1px 0 #444; min-width: 100%; height: auto; min-height: 100%;">'
105
+ allure?.addAttachment('Console Logs', '<pre style="display: inline-block; background-color: #4d4d4d; color: white; padding: 20px; text-shadow: 1px 1px 0 #444; min-width: 100%; height: auto; min-height: 100%;">'
119
106
  + '.........Console Logs.........\n\n' + logs + '</pre>', 'text/html');
120
107
  }
121
108
  };
122
- exports.attachConsoleLogs = attachConsoleLogs;
package/package.json CHANGED
@@ -1,15 +1,10 @@
1
1
  {
2
2
  "name": "@wdio/allure-reporter",
3
- "version": "7.21.0",
3
+ "version": "8.0.0-alpha.239+00a68ded0",
4
4
  "description": "A WebdriverIO reporter plugin to create Allure Test Reports",
5
5
  "author": "Boris Osipov <osipov.boris@gmail.com>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-allure-reporter",
7
7
  "license": "MIT",
8
- "main": "./build/index",
9
- "engines": {
10
- "node": ">=12.0.0"
11
- },
12
- "types": "./build/index.d.ts",
13
8
  "repository": {
14
9
  "type": "git",
15
10
  "url": "git://github.com/webdriverio/webdriverio.git"
@@ -23,19 +18,28 @@
23
18
  "bugs": {
24
19
  "url": "https://github.com/webdriverio/webdriverio/issues"
25
20
  },
21
+ "type": "module",
22
+ "exports": "./build/index.js",
23
+ "types": "./build/index.d.ts",
24
+ "typeScriptVersion": "3.8.3",
25
+ "engines": {
26
+ "node": "^16.13 || >=18"
27
+ },
26
28
  "dependencies": {
27
- "@types/node": "^18.0.0",
28
- "@wdio/reporter": "7.21.0",
29
- "@wdio/types": "7.21.0",
29
+ "@wdio/reporter": "8.0.0-alpha.239+00a68ded0",
30
+ "@wdio/types": "8.0.0-alpha.239+00a68ded0",
30
31
  "allure-js-commons": "^1.3.2",
31
32
  "csv-stringify": "^6.0.4",
32
33
  "strip-ansi": "^6.0.0"
33
34
  },
35
+ "devDependencies": {
36
+ "@types/node": "^18.0.0"
37
+ },
34
38
  "peerDependencies": {
35
- "@wdio/cli": "^7.0.0"
39
+ "@wdio/cli": "next"
36
40
  },
37
41
  "publishConfig": {
38
42
  "access": "public"
39
43
  },
40
- "gitHead": "808149cc5875529a2c0b3592dc5e255796e8ece4"
44
+ "gitHead": "00a68ded03fea7b5f348eff0ca1d9b771f90fa75"
41
45
  }