testbeats 2.2.2 → 2.2.3
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 +9 -4
- package/package.json +2 -2
- package/src/beats/beats.js +4 -0
- package/src/commands/publish.command.js +2 -0
- package/src/helpers/extension.helper.js +21 -1
- package/src/index.d.ts +1 -0
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
> This npm package has been renamed from [test-results-reporter](https://www.npmjs.com/package/test-results-reporter) to [testbeats](https://www.npmjs.com/package/testbeats). test-results-reporter will soon be phased out, and users are encouraged to transition to testbeats.
|
|
2
|
-
|
|
3
1
|
<span align="center">
|
|
4
2
|
|
|
5
3
|

|
|
@@ -37,10 +35,12 @@ Read more about the project at [https://testbeats.com](https://testbeats.com)
|
|
|
37
35
|
|
|
38
36
|
#### Results in Portal
|
|
39
37
|
|
|
40
|
-

|
|
41
39
|
|
|
42
40
|
<br />
|
|
43
41
|
|
|
42
|
+
> Read more about the project at [https://testbeats.com](https://testbeats.com)
|
|
43
|
+
|
|
44
44
|
## Need Help
|
|
45
45
|
|
|
46
46
|
We use [Github Discussions](https://github.com/test-results-reporter/testbeats/discussions) to receive feedback, discuss ideas & answer questions. Head over to it and feel free to start a discussion. We are always happy to help 😊.
|
|
@@ -51,4 +51,9 @@ Like this project! Star it on [Github](https://github.com/test-results-reporter/
|
|
|
51
51
|
|
|
52
52
|
<br />
|
|
53
53
|
|
|
54
|
-
> Read more about the project at [https://testbeats.com](https://testbeats.com)
|
|
54
|
+
> Read more about the project at [https://testbeats.com](https://testbeats.com)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Notes
|
|
58
|
+
|
|
59
|
+
This npm package has been renamed from [test-results-reporter](https://www.npmjs.com/package/test-results-reporter) to [testbeats](https://www.npmjs.com/package/testbeats). test-results-reporter will soon be phased out, and users are encouraged to transition to testbeats.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testbeats",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Publish test results to Microsoft Teams, Google Chat, Slack and InfluxDB",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"prompts": "^2.4.2",
|
|
57
57
|
"rosters": "0.0.1",
|
|
58
58
|
"sade": "^1.8.1",
|
|
59
|
-
"test-results-parser": "0.2.
|
|
59
|
+
"test-results-parser": "0.2.8"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"c8": "^10.1.2",
|
package/src/beats/beats.js
CHANGED
|
@@ -128,6 +128,7 @@ class Beats {
|
|
|
128
128
|
this.config.extensions.push({
|
|
129
129
|
name: 'ai-failure-summary',
|
|
130
130
|
hook: HOOK.AFTER_SUMMARY,
|
|
131
|
+
order: 100,
|
|
131
132
|
inputs: {
|
|
132
133
|
data: this.test_run
|
|
133
134
|
}
|
|
@@ -151,6 +152,7 @@ class Beats {
|
|
|
151
152
|
this.config.extensions.push({
|
|
152
153
|
name: 'failure-analysis',
|
|
153
154
|
hook: HOOK.AFTER_SUMMARY,
|
|
155
|
+
order: 200,
|
|
154
156
|
inputs: {
|
|
155
157
|
data: metrics
|
|
156
158
|
}
|
|
@@ -170,6 +172,7 @@ class Beats {
|
|
|
170
172
|
this.config.extensions.push({
|
|
171
173
|
name: 'smart-analysis',
|
|
172
174
|
hook: HOOK.AFTER_SUMMARY,
|
|
175
|
+
order: 300,
|
|
173
176
|
inputs: {
|
|
174
177
|
data: this.test_run
|
|
175
178
|
}
|
|
@@ -225,6 +228,7 @@ class Beats {
|
|
|
225
228
|
this.config.extensions.push({
|
|
226
229
|
name: 'error-clusters',
|
|
227
230
|
hook: HOOK.AFTER_SUMMARY,
|
|
231
|
+
order: 400,
|
|
228
232
|
inputs: {
|
|
229
233
|
data: res.values
|
|
230
234
|
}
|
|
@@ -11,6 +11,7 @@ const { processData } = require('../helpers/helper');
|
|
|
11
11
|
const { ExtensionsSetup } = require('../setups/extensions.setup');
|
|
12
12
|
const pkg = require('../../package.json');
|
|
13
13
|
const { MIN_NODE_VERSION } = require('../helpers/constants');
|
|
14
|
+
const { sortExtensionsByOrder } = require('../helpers/extension.helper');
|
|
14
15
|
|
|
15
16
|
class PublishCommand {
|
|
16
17
|
|
|
@@ -242,6 +243,7 @@ class PublishCommand {
|
|
|
242
243
|
}
|
|
243
244
|
target.extensions = target.extensions || [];
|
|
244
245
|
target.extensions = config.extensions.concat(target.extensions);
|
|
246
|
+
target.extensions = sortExtensionsByOrder(target.extensions);
|
|
245
247
|
await target_manager.run(target, result);
|
|
246
248
|
}
|
|
247
249
|
} else {
|
|
@@ -100,8 +100,28 @@ function addChatExtension({ payload, extension, text }) {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Sort extensions by their order property.
|
|
105
|
+
* Extensions without order will appear last, maintaining their original relative order.
|
|
106
|
+
*
|
|
107
|
+
* @param {import("..").IExtension[]} extensions - the extensions array to sort
|
|
108
|
+
* @return {import("..").IExtension[]} sorted extensions array
|
|
109
|
+
*/
|
|
110
|
+
function sortExtensionsByOrder(extensions) {
|
|
111
|
+
if (!extensions || !Array.isArray(extensions)) {
|
|
112
|
+
return extensions;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return extensions.slice().sort((a, b) => {
|
|
116
|
+
const orderA = typeof a.order === 'number' ? a.order : 1000;
|
|
117
|
+
const orderB = typeof b.order === 'number' ? b.order : 1000;
|
|
118
|
+
return orderA - orderB;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
103
122
|
module.exports = {
|
|
104
123
|
addSlackExtension,
|
|
105
124
|
addTeamsExtension,
|
|
106
|
-
addChatExtension
|
|
125
|
+
addChatExtension,
|
|
126
|
+
sortExtensionsByOrder
|
|
107
127
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface IExtension {
|
|
|
19
19
|
enable?: string | boolean;
|
|
20
20
|
condition?: Condition;
|
|
21
21
|
hook?: Hook;
|
|
22
|
+
order?: number;
|
|
22
23
|
inputs?: ReportPortalAnalysisInputs | ReportPortalHistoryInputs | HyperlinkInputs | MentionInputs | QuickChartTestSummaryInputs | PercyAnalysisInputs | CustomExtensionInputs | MetadataInputs | CIInfoInputs | AIFailureSummaryInputs | BrowserstackInputs;
|
|
23
24
|
}
|
|
24
25
|
|