@testomatio/reporter 2.3.1-beta.1-dependency → 2.3.1
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/lib/data-storage.d.ts +1 -1
- package/lib/pipe/debug.js +1 -1
- package/lib/pipe/testomatio.js +14 -18
- package/lib/reporter.d.ts +12 -12
- package/lib/services/artifacts.d.ts +1 -1
- package/lib/services/key-values.d.ts +1 -1
- package/lib/services/links.d.ts +1 -1
- package/lib/services/logger.d.ts +1 -1
- package/lib/utils/utils.js +1 -1
- package/package.json +28 -37
- package/src/pipe/debug.js +3 -2
- package/src/pipe/testomatio.js +73 -74
- package/src/utils/utils.js +2 -2
package/lib/data-storage.d.ts
CHANGED
package/lib/pipe/debug.js
CHANGED
|
@@ -18,7 +18,7 @@ class DebugPipe {
|
|
|
18
18
|
this.isEnabled = !!process.env.TESTOMATIO_DEBUG || !!process.env.DEBUG;
|
|
19
19
|
if (this.isEnabled) {
|
|
20
20
|
this.batch = {
|
|
21
|
-
isEnabled: this.params.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD,
|
|
21
|
+
isEnabled: this.params.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD ?? true,
|
|
22
22
|
intervalFunction: null,
|
|
23
23
|
intervalTime: 5000,
|
|
24
24
|
tests: [],
|
package/lib/pipe/testomatio.js
CHANGED
|
@@ -23,7 +23,7 @@ if (process.env.TESTOMATIO_RUN)
|
|
|
23
23
|
class TestomatioPipe {
|
|
24
24
|
constructor(params, store) {
|
|
25
25
|
this.batch = {
|
|
26
|
-
isEnabled: params?.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD,
|
|
26
|
+
isEnabled: params?.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD ?? true,
|
|
27
27
|
intervalFunction: null, // will be created in createRun by setInterval function
|
|
28
28
|
intervalTime: 5000, // how often tests are sent
|
|
29
29
|
tests: [], // array of tests in batch
|
|
@@ -60,7 +60,7 @@ class TestomatioPipe {
|
|
|
60
60
|
retry: constants_js_1.REPORTER_REQUEST_RETRIES.retriesPerRequest,
|
|
61
61
|
retryDelay: constants_js_1.REPORTER_REQUEST_RETRIES.retryTimeout,
|
|
62
62
|
httpMethodsToRetry: ['GET', 'PUT', 'HEAD', 'OPTIONS', 'DELETE', 'POST'],
|
|
63
|
-
shouldRetry: error => {
|
|
63
|
+
shouldRetry: (error) => {
|
|
64
64
|
if (!error.response)
|
|
65
65
|
return false;
|
|
66
66
|
switch (error.response?.status) {
|
|
@@ -73,8 +73,8 @@ class TestomatioPipe {
|
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
return error.response?.status >= 401; // Retry on 401+ and 5xx
|
|
76
|
-
}
|
|
77
|
-
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
78
|
});
|
|
79
79
|
this.isEnabled = true;
|
|
80
80
|
// do not finish this run (for parallel testing)
|
|
@@ -171,7 +171,7 @@ class TestomatioPipe {
|
|
|
171
171
|
method: 'PUT',
|
|
172
172
|
url: `/api/reporter/${this.runId}`,
|
|
173
173
|
data: runParams,
|
|
174
|
-
responseType: 'json'
|
|
174
|
+
responseType: 'json'
|
|
175
175
|
});
|
|
176
176
|
if (resp.data.artifacts)
|
|
177
177
|
(0, pipe_utils_js_1.setS3Credentials)(resp.data.artifacts);
|
|
@@ -184,7 +184,7 @@ class TestomatioPipe {
|
|
|
184
184
|
url: '/api/reporter',
|
|
185
185
|
data: runParams,
|
|
186
186
|
maxContentLength: Infinity,
|
|
187
|
-
responseType: 'json'
|
|
187
|
+
responseType: 'json'
|
|
188
188
|
});
|
|
189
189
|
this.runId = resp.data.uid;
|
|
190
190
|
this.runUrl = `${this.url}/${resp.data.url.split('/').splice(3).join('/')}`;
|
|
@@ -241,17 +241,15 @@ class TestomatioPipe {
|
|
|
241
241
|
}
|
|
242
242
|
const json = json_cycle_1.default.stringify(data);
|
|
243
243
|
debug('Adding test', json);
|
|
244
|
-
return this.client
|
|
245
|
-
.request({
|
|
244
|
+
return this.client.request({
|
|
246
245
|
method: 'POST',
|
|
247
246
|
url: `/api/reporter/${this.runId}/testrun`,
|
|
248
247
|
data: json,
|
|
249
248
|
headers: {
|
|
250
249
|
'Content-Type': 'application/json',
|
|
251
250
|
},
|
|
252
|
-
maxContentLength: Infinity
|
|
253
|
-
})
|
|
254
|
-
.catch(err => {
|
|
251
|
+
maxContentLength: Infinity
|
|
252
|
+
}).catch(err => {
|
|
255
253
|
this.requestFailures++;
|
|
256
254
|
this.notReportedTestsCount++;
|
|
257
255
|
if (err.response) {
|
|
@@ -296,21 +294,19 @@ class TestomatioPipe {
|
|
|
296
294
|
// get tests from batch and clear batch
|
|
297
295
|
const testsToSend = this.batch.tests.splice(0);
|
|
298
296
|
debug('📨 Batch upload', testsToSend.length, 'tests');
|
|
299
|
-
return this.client
|
|
300
|
-
.request({
|
|
297
|
+
return this.client.request({
|
|
301
298
|
method: 'POST',
|
|
302
299
|
url: `/api/reporter/${this.runId}/testrun`,
|
|
303
300
|
data: {
|
|
304
301
|
api_key: this.apiKey,
|
|
305
302
|
tests: testsToSend,
|
|
306
|
-
batch_index: this.batch.batchIndex
|
|
303
|
+
batch_index: this.batch.batchIndex
|
|
307
304
|
},
|
|
308
305
|
headers: {
|
|
309
306
|
'Content-Type': 'application/json',
|
|
310
307
|
},
|
|
311
|
-
maxContentLength: Infinity
|
|
312
|
-
})
|
|
313
|
-
.catch(err => {
|
|
308
|
+
maxContentLength: Infinity
|
|
309
|
+
}).catch(err => {
|
|
314
310
|
this.requestFailures++;
|
|
315
311
|
this.notReportedTestsCount += testsToSend.length;
|
|
316
312
|
if (err.response) {
|
|
@@ -398,7 +394,7 @@ class TestomatioPipe {
|
|
|
398
394
|
status_event,
|
|
399
395
|
detach: params.detach,
|
|
400
396
|
tests: params.tests,
|
|
401
|
-
}
|
|
397
|
+
}
|
|
402
398
|
});
|
|
403
399
|
if (this.runUrl) {
|
|
404
400
|
console.log(constants_js_1.APP_PREFIX, '📊 Report Saved. Report URL:', picocolors_1.default.magenta(this.runUrl));
|
package/lib/reporter.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export const artifact: (data: string | {
|
|
|
5
5
|
}, context?: any) => void;
|
|
6
6
|
export const log: (...args: any[]) => void;
|
|
7
7
|
export const logger: {
|
|
8
|
-
#originalUserLogger: {
|
|
8
|
+
"__#13@#originalUserLogger": {
|
|
9
9
|
assert(condition?: boolean, ...data: any[]): void;
|
|
10
10
|
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
11
11
|
clear(): void;
|
|
@@ -50,13 +50,13 @@ export const logger: {
|
|
|
50
50
|
profile(label?: string): void;
|
|
51
51
|
profileEnd(label?: string): void;
|
|
52
52
|
};
|
|
53
|
-
#userLoggerWithOverridenMethods: any;
|
|
53
|
+
"__#13@#userLoggerWithOverridenMethods": any;
|
|
54
54
|
logLevel: string;
|
|
55
55
|
step(strings: any, ...values: any[]): void;
|
|
56
56
|
getLogs(context: string): string[];
|
|
57
|
-
#stringifyLogs(...args: any[]): string;
|
|
57
|
+
"__#13@#stringifyLogs"(...args: any[]): string;
|
|
58
58
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
59
|
-
#logWrapper(argsArray: any, level: any): void;
|
|
59
|
+
"__#13@#logWrapper"(argsArray: any, level: any): void;
|
|
60
60
|
assert(...args: any[]): void;
|
|
61
61
|
debug(...args: any[]): void;
|
|
62
62
|
error(...args: any[]): void;
|
|
@@ -81,7 +81,7 @@ export const linkTest: (...testIds: string[]) => void;
|
|
|
81
81
|
export const linkJira: (...jiraIds: string[]) => void;
|
|
82
82
|
declare namespace _default {
|
|
83
83
|
let testomatioLogger: {
|
|
84
|
-
#originalUserLogger: {
|
|
84
|
+
"__#13@#originalUserLogger": {
|
|
85
85
|
assert(condition?: boolean, ...data: any[]): void;
|
|
86
86
|
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
87
87
|
clear(): void;
|
|
@@ -126,13 +126,13 @@ declare namespace _default {
|
|
|
126
126
|
profile(label?: string): void;
|
|
127
127
|
profileEnd(label?: string): void;
|
|
128
128
|
};
|
|
129
|
-
#userLoggerWithOverridenMethods: any;
|
|
129
|
+
"__#13@#userLoggerWithOverridenMethods": any;
|
|
130
130
|
logLevel: string;
|
|
131
131
|
step(strings: any, ...values: any[]): void;
|
|
132
132
|
getLogs(context: string): string[];
|
|
133
|
-
#stringifyLogs(...args: any[]): string;
|
|
133
|
+
"__#13@#stringifyLogs"(...args: any[]): string;
|
|
134
134
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
135
|
-
#logWrapper(argsArray: any, level: any): void;
|
|
135
|
+
"__#13@#logWrapper"(argsArray: any, level: any): void;
|
|
136
136
|
assert(...args: any[]): void;
|
|
137
137
|
debug(...args: any[]): void;
|
|
138
138
|
error(...args: any[]): void;
|
|
@@ -155,7 +155,7 @@ declare namespace _default {
|
|
|
155
155
|
}, context?: any) => void;
|
|
156
156
|
let log: (...args: any[]) => void;
|
|
157
157
|
let logger: {
|
|
158
|
-
#originalUserLogger: {
|
|
158
|
+
"__#13@#originalUserLogger": {
|
|
159
159
|
assert(condition?: boolean, ...data: any[]): void;
|
|
160
160
|
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
161
161
|
clear(): void;
|
|
@@ -200,13 +200,13 @@ declare namespace _default {
|
|
|
200
200
|
profile(label?: string): void;
|
|
201
201
|
profileEnd(label?: string): void;
|
|
202
202
|
};
|
|
203
|
-
#userLoggerWithOverridenMethods: any;
|
|
203
|
+
"__#13@#userLoggerWithOverridenMethods": any;
|
|
204
204
|
logLevel: string;
|
|
205
205
|
step(strings: any, ...values: any[]): void;
|
|
206
206
|
getLogs(context: string): string[];
|
|
207
|
-
#stringifyLogs(...args: any[]): string;
|
|
207
|
+
"__#13@#stringifyLogs"(...args: any[]): string;
|
|
208
208
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
209
|
-
#logWrapper(argsArray: any, level: any): void;
|
|
209
|
+
"__#13@#logWrapper"(argsArray: any, level: any): void;
|
|
210
210
|
assert(...args: any[]): void;
|
|
211
211
|
debug(...args: any[]): void;
|
|
212
212
|
error(...args: any[]): void;
|
package/lib/services/links.d.ts
CHANGED
package/lib/services/logger.d.ts
CHANGED
package/lib/utils/utils.js
CHANGED
|
@@ -409,7 +409,7 @@ function readLatestRunId() {
|
|
|
409
409
|
return fs_1.default.readFileSync(filePath)?.toString()?.trim() ?? null;
|
|
410
410
|
}
|
|
411
411
|
catch (e) {
|
|
412
|
-
|
|
412
|
+
debug('Could not read latest run ID from file: ', e);
|
|
413
413
|
return null;
|
|
414
414
|
}
|
|
415
415
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testomatio/reporter",
|
|
3
|
-
"version": "2.3.1
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Testomatio Reporter Client",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18"
|
|
@@ -10,20 +10,13 @@
|
|
|
10
10
|
"author": "Michael Bodnarchuk <davert@testomat.io>,Koushik Mohan <koushikmohan1996@gmail.com>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"type": "module",
|
|
13
|
-
"overrides": {
|
|
14
|
-
"tmp": "0.2.4",
|
|
15
|
-
"external-editor": {
|
|
16
|
-
"tmp": "0.2.4"
|
|
17
|
-
},
|
|
18
|
-
"follow-redirects": "1.15.6",
|
|
19
|
-
"axios": "^1.7.0"
|
|
20
|
-
},
|
|
21
13
|
"dependencies": {
|
|
22
14
|
"@aws-sdk/client-s3": "^3.279.0",
|
|
23
15
|
"@aws-sdk/lib-storage": "^3.279.0",
|
|
24
|
-
"@cucumber/cucumber": "^
|
|
16
|
+
"@cucumber/cucumber": "^10.9.0",
|
|
25
17
|
"@octokit/rest": "^21.1.1",
|
|
26
18
|
"aws-sdk": "^2.1072.0",
|
|
19
|
+
"gaxios": ">=6.0 || >=7.0.0-rc.4 || <8",
|
|
27
20
|
"callsite-record": "^4.1.4",
|
|
28
21
|
"commander": "^12",
|
|
29
22
|
"cross-spawn": "^7.0.3",
|
|
@@ -33,7 +26,6 @@
|
|
|
33
26
|
"fast-xml-parser": "^4.4.1",
|
|
34
27
|
"file-url": "3.0.0",
|
|
35
28
|
"filesize": "^10.1.6",
|
|
36
|
-
"gaxios": ">=6.0 || >=7.0.0-rc.4 || <8",
|
|
37
29
|
"glob": "^10.3",
|
|
38
30
|
"handlebars": "^4.7.8",
|
|
39
31
|
"has-flag": "^5.0.1",
|
|
@@ -93,7 +85,7 @@
|
|
|
93
85
|
"@types/mocha": "^10.0.7",
|
|
94
86
|
"@wdio/reporter": "^7.16.13",
|
|
95
87
|
"chai": "^4.3.6",
|
|
96
|
-
"codeceptjs": "^3.
|
|
88
|
+
"codeceptjs": "^3.6.5",
|
|
97
89
|
"cucumber": "^6.0.7",
|
|
98
90
|
"eslint": "^9.24.0",
|
|
99
91
|
"eslint-config-prettier": "^8.3.0",
|
|
@@ -101,13 +93,13 @@
|
|
|
101
93
|
"jasmine": "^5.2.0",
|
|
102
94
|
"jest": "^27.4.7",
|
|
103
95
|
"jsdom": "^22.1.0",
|
|
104
|
-
"mocha": "^
|
|
96
|
+
"mocha": "^9.2.0",
|
|
105
97
|
"mock-http-server": "^1.4.5",
|
|
106
98
|
"pino": "^8.15.0",
|
|
107
99
|
"prettier": "^3.2.5",
|
|
108
100
|
"puppeteer": "^22.15.0",
|
|
109
101
|
"typescript": "^5.5.4",
|
|
110
|
-
"vitest": "^
|
|
102
|
+
"vitest": "^1.6.0"
|
|
111
103
|
},
|
|
112
104
|
"bin": {
|
|
113
105
|
"@testomatio/reporter": "./lib/bin/cli.js",
|
|
@@ -121,28 +113,27 @@
|
|
|
121
113
|
"require": "./lib/reporter.js",
|
|
122
114
|
"types": "./types/types.d.ts"
|
|
123
115
|
},
|
|
124
|
-
"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
116
|
+
"./lib/adapter/codecept/codecept.js": "./lib/adapter/codecept.js",
|
|
117
|
+
"./lib/adapter/codecept": "./lib/adapter/codecept.js",
|
|
118
|
+
"./codecept": "./lib/adapter/codecept.js",
|
|
119
|
+
"./lib/adapter/cucumber/cucumber.js": "./lib/adapter/cucumber/current.js",
|
|
120
|
+
"./cucumber": "./lib/adapter/cucumber/current.js",
|
|
121
|
+
"./lib/adapter/cypress-plugin": "./lib/adapter/cypress-plugin/index.js",
|
|
122
|
+
"./cypress-plugin": "./lib/adapter/cypress-plugin/index.js",
|
|
123
|
+
"./cypress": "./lib/adapter/cypress-plugin/index.js",
|
|
124
|
+
"./lib/adapter/jasmine.js": "./lib/adapter/jasmine.js",
|
|
125
|
+
"./jasmine": "./lib/adapter/jasmine.js",
|
|
126
|
+
"./lib/adapter/jest.js": "./lib/adapter/jest.js",
|
|
127
|
+
"./jest": "./lib/adapter/jest.js",
|
|
128
|
+
"./lib/adapter/mocha/mocha.js": "./lib/adapter/mocha.js",
|
|
129
|
+
"./mocha": "./lib/adapter/mocha.js",
|
|
130
|
+
"./lib/adapter/playwright.js": "./lib/adapter/playwright.js",
|
|
131
|
+
"./nightwatch": "./lib/adapter/nightwatch.js",
|
|
132
|
+
"./playwright": "./lib/adapter/playwright.js",
|
|
133
|
+
"./vitest": "./lib/adapter/vitest.js",
|
|
134
|
+
"./lib/adapter/webdriver.js": "./lib/adapter/webdriver.js",
|
|
135
|
+
"./lib/adapter/webdriver": "./lib/adapter/webdriver.js",
|
|
136
|
+
"./webdriver": "./lib/adapter/webdriver.js",
|
|
137
|
+
"./wdio": "./lib/adapter/webdriver.js"
|
|
147
138
|
}
|
|
148
139
|
}
|
package/src/pipe/debug.js
CHANGED
|
@@ -15,7 +15,7 @@ export class DebugPipe {
|
|
|
15
15
|
this.isEnabled = !!process.env.TESTOMATIO_DEBUG || !!process.env.DEBUG;
|
|
16
16
|
if (this.isEnabled) {
|
|
17
17
|
this.batch = {
|
|
18
|
-
isEnabled: this.params.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD,
|
|
18
|
+
isEnabled: this.params.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD ?? true,
|
|
19
19
|
intervalFunction: null,
|
|
20
20
|
intervalTime: 5000,
|
|
21
21
|
tests: [],
|
|
@@ -93,7 +93,8 @@ export class DebugPipe {
|
|
|
93
93
|
const logData = { action: 'addTest', testId: data };
|
|
94
94
|
if (this.store.runId) logData.runId = this.store.runId;
|
|
95
95
|
this.logToFile(logData);
|
|
96
|
-
}
|
|
96
|
+
}
|
|
97
|
+
else this.batch.tests.push(data);
|
|
97
98
|
|
|
98
99
|
if (!this.batch.intervalFunction) await this.batchUpload();
|
|
99
100
|
}
|
package/src/pipe/testomatio.js
CHANGED
|
@@ -20,7 +20,7 @@ if (process.env.TESTOMATIO_RUN) process.env.runId = process.env.TESTOMATIO_RUN;
|
|
|
20
20
|
class TestomatioPipe {
|
|
21
21
|
constructor(params, store) {
|
|
22
22
|
this.batch = {
|
|
23
|
-
isEnabled: params?.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD,
|
|
23
|
+
isEnabled: params?.isBatchEnabled ?? !process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD ?? true,
|
|
24
24
|
intervalFunction: null, // will be created in createRun by setInterval function
|
|
25
25
|
intervalTime: 5000, // how often tests are sent
|
|
26
26
|
tests: [], // array of tests in batch
|
|
@@ -60,8 +60,8 @@ class TestomatioPipe {
|
|
|
60
60
|
retryConfig: {
|
|
61
61
|
retry: REPORTER_REQUEST_RETRIES.retriesPerRequest,
|
|
62
62
|
retryDelay: REPORTER_REQUEST_RETRIES.retryTimeout,
|
|
63
|
-
httpMethodsToRetry: ['GET',
|
|
64
|
-
shouldRetry: error => {
|
|
63
|
+
httpMethodsToRetry: ['GET','PUT','HEAD','OPTIONS','DELETE','POST'],
|
|
64
|
+
shouldRetry: (error) => {
|
|
65
65
|
if (!error.response) return false;
|
|
66
66
|
switch (error.response?.status) {
|
|
67
67
|
case 400: // Bad request (probably wrong API key)
|
|
@@ -73,8 +73,8 @@ class TestomatioPipe {
|
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
return error.response?.status >= 401; // Retry on 401+ and 5xx
|
|
76
|
-
}
|
|
77
|
-
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
this.isEnabled = true;
|
|
@@ -186,7 +186,7 @@ class TestomatioPipe {
|
|
|
186
186
|
method: 'PUT',
|
|
187
187
|
url: `/api/reporter/${this.runId}`,
|
|
188
188
|
data: runParams,
|
|
189
|
-
responseType: 'json'
|
|
189
|
+
responseType: 'json'
|
|
190
190
|
});
|
|
191
191
|
if (resp.data.artifacts) setS3Credentials(resp.data.artifacts);
|
|
192
192
|
return;
|
|
@@ -199,7 +199,7 @@ class TestomatioPipe {
|
|
|
199
199
|
url: '/api/reporter',
|
|
200
200
|
data: runParams,
|
|
201
201
|
maxContentLength: Infinity,
|
|
202
|
-
responseType: 'json'
|
|
202
|
+
responseType: 'json'
|
|
203
203
|
});
|
|
204
204
|
|
|
205
205
|
this.runId = resp.data.uid;
|
|
@@ -263,42 +263,40 @@ class TestomatioPipe {
|
|
|
263
263
|
|
|
264
264
|
debug('Adding test', json);
|
|
265
265
|
|
|
266
|
-
return this.client
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
if (err.response.status >= 400) {
|
|
281
|
-
const responseData = err.response.data || { message: '' };
|
|
282
|
-
console.log(
|
|
283
|
-
APP_PREFIX,
|
|
284
|
-
pc.yellow(`Warning: ${responseData.message} (${err.response.status})`),
|
|
285
|
-
pc.gray(data?.title || ''),
|
|
286
|
-
);
|
|
287
|
-
if (err.response?.data?.message?.includes('could not be matched')) {
|
|
288
|
-
this.hasUnmatchedTests = true;
|
|
289
|
-
}
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
266
|
+
return this.client.request({
|
|
267
|
+
method: 'POST',
|
|
268
|
+
url: `/api/reporter/${this.runId}/testrun`,
|
|
269
|
+
data: json,
|
|
270
|
+
headers: {
|
|
271
|
+
'Content-Type': 'application/json',
|
|
272
|
+
},
|
|
273
|
+
maxContentLength: Infinity
|
|
274
|
+
}).catch(err => {
|
|
275
|
+
this.requestFailures++;
|
|
276
|
+
this.notReportedTestsCount++;
|
|
277
|
+
if (err.response) {
|
|
278
|
+
if (err.response.status >= 400) {
|
|
279
|
+
const responseData = err.response.data || { message: '' };
|
|
292
280
|
console.log(
|
|
293
281
|
APP_PREFIX,
|
|
294
|
-
pc.yellow(`Warning: ${
|
|
295
|
-
|
|
282
|
+
pc.yellow(`Warning: ${responseData.message} (${err.response.status})`),
|
|
283
|
+
pc.gray(data?.title || ''),
|
|
296
284
|
);
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
285
|
+
if (err.response?.data?.message?.includes('could not be matched')) {
|
|
286
|
+
this.hasUnmatchedTests = true;
|
|
287
|
+
}
|
|
288
|
+
return;
|
|
300
289
|
}
|
|
301
|
-
|
|
290
|
+
console.log(
|
|
291
|
+
APP_PREFIX,
|
|
292
|
+
pc.yellow(`Warning: ${data?.title || ''} (${err.response?.status})`),
|
|
293
|
+
`Report couldn't be processed: ${err?.response?.data?.message}`,
|
|
294
|
+
);
|
|
295
|
+
printCreateIssue(err);
|
|
296
|
+
} else {
|
|
297
|
+
console.log(APP_PREFIX, pc.blue(data?.title || ''), "Report couldn't be processed", err);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
302
300
|
};
|
|
303
301
|
|
|
304
302
|
/**
|
|
@@ -325,42 +323,43 @@ class TestomatioPipe {
|
|
|
325
323
|
const testsToSend = this.batch.tests.splice(0);
|
|
326
324
|
debug('📨 Batch upload', testsToSend.length, 'tests');
|
|
327
325
|
|
|
328
|
-
return this.client
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
if (err.response.status >= 400) {
|
|
347
|
-
const responseData = err.response.data || { message: '' };
|
|
348
|
-
console.log(APP_PREFIX, pc.yellow(`Warning: ${responseData.message} (${err.response.status})`));
|
|
349
|
-
if (err.response?.data?.message?.includes('could not be matched')) {
|
|
350
|
-
this.hasUnmatchedTests = true;
|
|
351
|
-
}
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
326
|
+
return this.client.request({
|
|
327
|
+
method: 'POST',
|
|
328
|
+
url: `/api/reporter/${this.runId}/testrun`,
|
|
329
|
+
data: {
|
|
330
|
+
api_key: this.apiKey,
|
|
331
|
+
tests: testsToSend,
|
|
332
|
+
batch_index: this.batch.batchIndex
|
|
333
|
+
},
|
|
334
|
+
headers: {
|
|
335
|
+
'Content-Type': 'application/json',
|
|
336
|
+
},
|
|
337
|
+
maxContentLength: Infinity
|
|
338
|
+
}).catch(err => {
|
|
339
|
+
this.requestFailures++;
|
|
340
|
+
this.notReportedTestsCount += testsToSend.length;
|
|
341
|
+
if (err.response) {
|
|
342
|
+
if (err.response.status >= 400) {
|
|
343
|
+
const responseData = err.response.data || { message: '' };
|
|
354
344
|
console.log(
|
|
355
345
|
APP_PREFIX,
|
|
356
|
-
pc.yellow(`Warning: (${err.response
|
|
357
|
-
`Report couldn't be processed: ${err?.response?.data?.message}`,
|
|
346
|
+
pc.yellow(`Warning: ${responseData.message} (${err.response.status})`),
|
|
358
347
|
);
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
348
|
+
if (err.response?.data?.message?.includes('could not be matched')) {
|
|
349
|
+
this.hasUnmatchedTests = true;
|
|
350
|
+
}
|
|
351
|
+
return;
|
|
362
352
|
}
|
|
363
|
-
|
|
353
|
+
console.log(
|
|
354
|
+
APP_PREFIX,
|
|
355
|
+
pc.yellow(`Warning: (${err.response?.status})`),
|
|
356
|
+
`Report couldn't be processed: ${err?.response?.data?.message}`,
|
|
357
|
+
);
|
|
358
|
+
printCreateIssue(err);
|
|
359
|
+
} else {
|
|
360
|
+
console.log(APP_PREFIX, "Report couldn't be processed", err);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
364
363
|
};
|
|
365
364
|
|
|
366
365
|
/**
|
|
@@ -386,9 +385,9 @@ class TestomatioPipe {
|
|
|
386
385
|
else this.batch.tests.push(data);
|
|
387
386
|
|
|
388
387
|
// if test is added after run which is already finished
|
|
389
|
-
|
|
388
|
+
if (!this.batch.intervalFunction) uploading = this.#batchUpload();
|
|
390
389
|
|
|
391
|
-
|
|
390
|
+
// return promise to be able to wait for it
|
|
392
391
|
return uploading;
|
|
393
392
|
}
|
|
394
393
|
|
|
@@ -437,7 +436,7 @@ class TestomatioPipe {
|
|
|
437
436
|
status_event,
|
|
438
437
|
detach: params.detach,
|
|
439
438
|
tests: params.tests,
|
|
440
|
-
}
|
|
439
|
+
}
|
|
441
440
|
});
|
|
442
441
|
if (this.runUrl) {
|
|
443
442
|
console.log(APP_PREFIX, '📊 Report Saved. Report URL:', pc.magenta(this.runUrl));
|
package/src/utils/utils.js
CHANGED
|
@@ -361,7 +361,7 @@ function readLatestRunId() {
|
|
|
361
361
|
try {
|
|
362
362
|
const filePath = path.join(os.tmpdir(), `testomatio.latest.run`);
|
|
363
363
|
if (!fs.existsSync(filePath)) return null;
|
|
364
|
-
|
|
364
|
+
|
|
365
365
|
const stats = fs.statSync(filePath);
|
|
366
366
|
const diff = +new Date() - +stats.mtime;
|
|
367
367
|
const diffHours = diff / 1000 / 60 / 60;
|
|
@@ -369,7 +369,7 @@ function readLatestRunId() {
|
|
|
369
369
|
|
|
370
370
|
return fs.readFileSync(filePath)?.toString()?.trim() ?? null;
|
|
371
371
|
} catch (e) {
|
|
372
|
-
|
|
372
|
+
debug('Could not read latest run ID from file: ', e);
|
|
373
373
|
return null;
|
|
374
374
|
}
|
|
375
375
|
}
|