@testomatio/reporter 2.3.6 → 2.3.7-beta.2-xml-import
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/lib/bin/cli.js +1 -1
- package/lib/bin/reportXml.js +5 -2
- package/lib/bin/startTest.js +3 -3
- package/lib/client.js +7 -3
- package/lib/junit-adapter/csharp.d.ts +0 -1
- package/lib/junit-adapter/csharp.js +40 -7
- package/lib/junit-adapter/nunit-parser.d.ts +82 -0
- package/lib/junit-adapter/nunit-parser.js +369 -0
- package/lib/pipe/debug.js +1 -1
- package/lib/pipe/testomatio.js +19 -15
- package/lib/template/testomatio.hbs +1366 -1026
- package/lib/uploader.js +4 -0
- package/lib/utils/utils.js +90 -11
- package/lib/xmlReader.d.ts +32 -26
- package/lib/xmlReader.js +106 -50
- package/package.json +1 -1
- package/src/bin/cli.js +1 -1
- package/src/bin/reportXml.js +5 -2
- package/src/bin/startTest.js +5 -5
- package/src/client.js +7 -4
- package/src/junit-adapter/csharp.js +45 -6
- package/src/junit-adapter/nunit-parser.js +404 -0
- package/src/pipe/debug.js +2 -3
- package/src/pipe/testomatio.js +75 -81
- package/src/template/testomatio.hbs +1366 -1026
- package/src/uploader.js +5 -0
- package/src/utils/utils.js +96 -9
- package/src/xmlReader.js +128 -45
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 ??
|
|
26
|
+
isEnabled: params?.isBatchEnabled ?? (process.env.TESTOMATIO_DISABLE_BATCH_UPLOAD ? false : 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:
|
|
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)
|
|
@@ -193,7 +193,7 @@ class TestomatioPipe {
|
|
|
193
193
|
method: 'PUT',
|
|
194
194
|
url: `/api/reporter/${this.runId}`,
|
|
195
195
|
data: runParams,
|
|
196
|
-
responseType: 'json'
|
|
196
|
+
responseType: 'json',
|
|
197
197
|
});
|
|
198
198
|
if (resp.data.artifacts)
|
|
199
199
|
(0, pipe_utils_js_1.setS3Credentials)(resp.data.artifacts);
|
|
@@ -206,7 +206,7 @@ class TestomatioPipe {
|
|
|
206
206
|
url: '/api/reporter',
|
|
207
207
|
data: runParams,
|
|
208
208
|
maxContentLength: Infinity,
|
|
209
|
-
responseType: 'json'
|
|
209
|
+
responseType: 'json',
|
|
210
210
|
});
|
|
211
211
|
this.runId = resp.data.uid;
|
|
212
212
|
this.runUrl = `${this.url}/${resp.data.url.split('/').splice(3).join('/')}`;
|
|
@@ -259,15 +259,17 @@ class TestomatioPipe {
|
|
|
259
259
|
this.#formatData(data);
|
|
260
260
|
const json = json_cycle_1.default.stringify(data);
|
|
261
261
|
debug('Adding test', json);
|
|
262
|
-
return this.client
|
|
262
|
+
return this.client
|
|
263
|
+
.request({
|
|
263
264
|
method: 'POST',
|
|
264
265
|
url: `/api/reporter/${this.runId}/testrun`,
|
|
265
266
|
data: json,
|
|
266
267
|
headers: {
|
|
267
268
|
'Content-Type': 'application/json',
|
|
268
269
|
},
|
|
269
|
-
maxContentLength: Infinity
|
|
270
|
-
})
|
|
270
|
+
maxContentLength: Infinity,
|
|
271
|
+
})
|
|
272
|
+
.catch(err => {
|
|
271
273
|
this.requestFailures++;
|
|
272
274
|
this.notReportedTestsCount++;
|
|
273
275
|
if (err.response) {
|
|
@@ -312,19 +314,21 @@ class TestomatioPipe {
|
|
|
312
314
|
// get tests from batch and clear batch
|
|
313
315
|
const testsToSend = this.batch.tests.splice(0);
|
|
314
316
|
debug('📨 Batch upload', testsToSend.length, 'tests');
|
|
315
|
-
return this.client
|
|
317
|
+
return this.client
|
|
318
|
+
.request({
|
|
316
319
|
method: 'POST',
|
|
317
320
|
url: `/api/reporter/${this.runId}/testrun`,
|
|
318
321
|
data: {
|
|
319
322
|
api_key: this.apiKey,
|
|
320
323
|
tests: testsToSend,
|
|
321
|
-
batch_index: this.batch.batchIndex
|
|
324
|
+
batch_index: this.batch.batchIndex,
|
|
322
325
|
},
|
|
323
326
|
headers: {
|
|
324
327
|
'Content-Type': 'application/json',
|
|
325
328
|
},
|
|
326
|
-
maxContentLength: Infinity
|
|
327
|
-
})
|
|
329
|
+
maxContentLength: Infinity,
|
|
330
|
+
})
|
|
331
|
+
.catch(err => {
|
|
328
332
|
this.requestFailures++;
|
|
329
333
|
this.notReportedTestsCount += testsToSend.length;
|
|
330
334
|
if (err.response) {
|
|
@@ -408,7 +412,7 @@ class TestomatioPipe {
|
|
|
408
412
|
status_event,
|
|
409
413
|
detach: params.detach,
|
|
410
414
|
tests: params.tests,
|
|
411
|
-
}
|
|
415
|
+
},
|
|
412
416
|
});
|
|
413
417
|
if (this.runUrl) {
|
|
414
418
|
console.log(constants_js_1.APP_PREFIX, '📊 Report Saved. Report URL:', picocolors_1.default.magenta(this.runUrl));
|
|
@@ -420,7 +424,7 @@ class TestomatioPipe {
|
|
|
420
424
|
if (this.runUrl && this.proceed) {
|
|
421
425
|
const notFinishedMessage = picocolors_1.default.yellow(picocolors_1.default.bold('Run was not finished because of $TESTOMATIO_PROCEED'));
|
|
422
426
|
console.log(constants_js_1.APP_PREFIX, `📊 ${notFinishedMessage}. Report URL: ${picocolors_1.default.magenta(this.runUrl)}`);
|
|
423
|
-
console.log(constants_js_1.APP_PREFIX, `🛬 Run to finish it: TESTOMATIO_RUN=${this.runId} npx
|
|
427
|
+
console.log(constants_js_1.APP_PREFIX, `🛬 Run to finish it: TESTOMATIO_RUN=${this.runId} npx @testomatio/reporter finish`);
|
|
424
428
|
}
|
|
425
429
|
if (this.hasUnmatchedTests) {
|
|
426
430
|
console.log('');
|