@wdio/allure-reporter 8.0.13 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addArgument = exports.addStep = exports.endStep = exports.startStep = exports.addAttachment = exports.addDescription = exports.addEnvironment = exports.addStory = exports.addTestId = exports.addIssue = exports.addSeverity = exports.addLabel = exports.addFeature = void 0;
4
+ const constants_js_1 = require("../constants.js");
5
+ /**
6
+ * Call reporter
7
+ * @param {string} event - event name
8
+ * @param {Object} msg - event payload
9
+ * @private
10
+ */
11
+ const tellReporter = (event, msg = {}) => {
12
+ process.emit(event, msg);
13
+ };
14
+ /**
15
+ * Assign feature to test
16
+ * @name addFeature
17
+ * @param {(string)} featureName - feature name or an array of names
18
+ */
19
+ function addFeature(featureName) {
20
+ tellReporter(constants_js_1.events.addFeature, { featureName });
21
+ }
22
+ exports.addFeature = addFeature;
23
+ /**
24
+ * Assign label to test
25
+ * @name addLabel
26
+ * @param {string} name - label name
27
+ * @param {string} value - label value
28
+ */
29
+ function addLabel(name, value) {
30
+ tellReporter(constants_js_1.events.addLabel, { name, value });
31
+ }
32
+ exports.addLabel = addLabel;
33
+ /**
34
+ * Assign severity to test
35
+ * @name addSeverity
36
+ * @param {string} severity - severity value
37
+ */
38
+ function addSeverity(severity) {
39
+ tellReporter(constants_js_1.events.addSeverity, { severity });
40
+ }
41
+ exports.addSeverity = addSeverity;
42
+ /**
43
+ * Assign issue id to test
44
+ * @name addIssue
45
+ * @param {string} issue - issue id value
46
+ */
47
+ function addIssue(issue) {
48
+ tellReporter(constants_js_1.events.addIssue, { issue });
49
+ }
50
+ exports.addIssue = addIssue;
51
+ /**
52
+ * Assign TMS test id to test
53
+ * @name addTestId
54
+ * @param {string} testId - test id value
55
+ */
56
+ function addTestId(testId) {
57
+ tellReporter(constants_js_1.events.addTestId, { testId });
58
+ }
59
+ exports.addTestId = addTestId;
60
+ /**
61
+ * Assign story to test
62
+ * @name addStory
63
+ * @param {string} storyName - story name for test
64
+ */
65
+ function addStory(storyName) {
66
+ tellReporter(constants_js_1.events.addStory, { storyName });
67
+ }
68
+ exports.addStory = addStory;
69
+ /**
70
+ * Add environment value
71
+ * @name addEnvironment
72
+ * @param {string} name - environment name
73
+ * @param {string} value - environment value
74
+ */
75
+ function addEnvironment(name, value) {
76
+ tellReporter(constants_js_1.events.addEnvironment, { name, value });
77
+ }
78
+ exports.addEnvironment = addEnvironment;
79
+ /**
80
+ * Assign test description to test
81
+ * @name addDescription
82
+ * @param {string} description - description for test
83
+ * @param {string} descriptionType - description type 'text'\'html'\'markdown'
84
+ */
85
+ function addDescription(description, descriptionType) {
86
+ tellReporter(constants_js_1.events.addDescription, { description, descriptionType });
87
+ }
88
+ exports.addDescription = addDescription;
89
+ /**
90
+ * Add attachment
91
+ * @name addAttachment
92
+ * @param {string} name - attachment file name
93
+ * @param {*} content - attachment content
94
+ * @param {string=} mimeType - attachment mime type
95
+ */
96
+ function addAttachment(name, content, type) {
97
+ if (!type) {
98
+ type = content instanceof Buffer ? 'image/png' : typeof content === 'string' ? 'text/plain' : 'application/json';
99
+ }
100
+ tellReporter(constants_js_1.events.addAttachment, { name, content, type });
101
+ }
102
+ exports.addAttachment = addAttachment;
103
+ /**
104
+ * Start allure step
105
+ * @name startStep
106
+ * @param {string} title - step name in report
107
+ */
108
+ function startStep(title) {
109
+ tellReporter(constants_js_1.events.startStep, title);
110
+ }
111
+ exports.startStep = startStep;
112
+ /**
113
+ * End current allure step
114
+ * @name endStep
115
+ * @param {StepStatus} [status='passed'] - step status
116
+ */
117
+ function endStep(status = 'passed') {
118
+ if (!Object.values(constants_js_1.stepStatuses).includes(status)) {
119
+ throw new Error(`Step status must be ${Object.values(constants_js_1.stepStatuses).join(' or ')}. You tried to set "${status}"`);
120
+ }
121
+ tellReporter(constants_js_1.events.endStep, status);
122
+ }
123
+ exports.endStep = endStep;
124
+ /**
125
+ * Create allure step
126
+ * @name addStep
127
+ * @param {string} title - step name in report
128
+ * @param {Object} [attachmentObject={}] - attachment for step
129
+ * @param {string} attachmentObject.content - attachment content
130
+ * @param {string} [attachmentObject.name='attachment'] - attachment name
131
+ * @param {string} [attachmentObject.type='text/plain'] - attachment type
132
+ * @param {string} [status='passed'] - step status
133
+ */
134
+ function addStep(title, { content, name = 'attachment', type = 'text/plain' } = {}, status = 'passed') {
135
+ if (!Object.values(constants_js_1.stepStatuses).includes(status)) {
136
+ throw new Error(`Step status must be ${Object.values(constants_js_1.stepStatuses).join(' or ')}. You tried to set "${status}"`);
137
+ }
138
+ const step = content ? { title, attachment: { content, name, type }, status } : { title, status };
139
+ tellReporter(constants_js_1.events.addStep, { step });
140
+ }
141
+ exports.addStep = addStep;
142
+ /**
143
+ * Add additional argument to test
144
+ * @name addArgument
145
+ * @param {string} name - argument name
146
+ * @param {string} value - argument value
147
+ */
148
+ function addArgument(name, value) {
149
+ tellReporter(constants_js_1.events.addArgument, { name, value });
150
+ }
151
+ exports.addArgument = addArgument;
152
+ exports.default = {
153
+ addFeature, addLabel, addSeverity, addIssue, addTestId, addStory, addEnvironment,
154
+ addDescription, addAttachment, startStep, endStep, addStep, addArgument
155
+ };
@@ -0,0 +1,40 @@
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';
10
+ exports.testStatuses = {
11
+ PASSED: exports.PASSED,
12
+ FAILED: exports.FAILED,
13
+ BROKEN: exports.BROKEN,
14
+ PENDING: exports.PENDING
15
+ };
16
+ exports.stepStatuses = {
17
+ PASSED: exports.PASSED,
18
+ FAILED: exports.FAILED,
19
+ BROKEN: exports.BROKEN,
20
+ CANCELED: exports.CANCELED,
21
+ SKIPPED: exports.SKIPPED
22
+ };
23
+ exports.events = {
24
+ addLabel: 'allure:addLabel',
25
+ addFeature: 'allure:addFeature',
26
+ addStory: 'allure:addStory',
27
+ addSeverity: 'allure:addSeverity',
28
+ addIssue: 'allure:addIssue',
29
+ addTestId: 'allure:addTestId',
30
+ addEnvironment: 'allure:addEnvironment',
31
+ addDescription: 'allure:addDescription',
32
+ addAttachment: 'allure:addAttachment',
33
+ startStep: 'allure:startStep',
34
+ endStep: 'allure:endStep',
35
+ addStep: 'allure:addStep',
36
+ addArgument: 'allure:addArgument'
37
+ };
38
+ exports.mochaEachHooks = ['"before each" hook', '"after each" hook'];
39
+ exports.mochaAllHooks = ['"before all" hook', '"after all" hook'];
40
+ exports.linkPlaceholder = '{}';
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
package/cjs/types.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TYPE = void 0;
4
+ var TYPE;
5
+ (function (TYPE) {
6
+ TYPE["TEXT"] = "text";
7
+ TYPE["HTML"] = "html";
8
+ TYPE["MARKDOWN"] = "markdown";
9
+ })(TYPE = exports.TYPE || (exports.TYPE = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/allure-reporter",
3
- "version": "8.0.13",
3
+ "version": "8.1.0",
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",
@@ -20,24 +20,33 @@
20
20
  "url": "https://github.com/webdriverio/webdriverio/issues"
21
21
  },
22
22
  "type": "module",
23
- "exports": "./build/index.js",
23
+ "main": "./cjs/common/api.js",
24
+ "module": "./build/index.js",
24
25
  "types": "./build/index.d.ts",
26
+ "exports": {
27
+ ".": [
28
+ {
29
+ "types": "./build/index.d.ts",
30
+ "import": "./build/index.js",
31
+ "require": "./cjs/common/api.js"
32
+ },
33
+ "./cjs/common/api.js"
34
+ ]
35
+ },
25
36
  "typeScriptVersion": "3.8.3",
26
37
  "engines": {
27
38
  "node": "^16.13 || >=18"
28
39
  },
29
40
  "dependencies": {
30
- "@wdio/reporter": "8.0.13",
31
- "@wdio/types": "8.0.11",
41
+ "@types/node": "^18.0.0",
42
+ "@wdio/reporter": "8.1.0",
43
+ "@wdio/types": "8.1.0",
32
44
  "allure-js-commons": "^1.3.2",
33
45
  "csv-stringify": "^6.0.4",
34
46
  "strip-ansi": "^6.0.0"
35
47
  },
36
- "devDependencies": {
37
- "@types/node": "^18.0.0"
38
- },
39
48
  "publishConfig": {
40
49
  "access": "public"
41
50
  },
42
- "gitHead": "912db21d2cd4552a02b776ba74cae05440b076de"
51
+ "gitHead": "f505134606f99129c816acb00f22e39032e60820"
43
52
  }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "./tsconfig.prod.json",
3
+ "compilerOptions": {
4
+ "module": "CommonJS",
5
+ "outDir": "./cjs",
6
+ "declaration": false,
7
+ "declarationMap": false
8
+ },
9
+ "include": [
10
+ "src/common"
11
+ ]
12
+ }