@testomatio/reporter 0.7.2 → 0.7.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/Changelog.md +5 -0
- package/README.md +1 -0
- package/lib/bin/reportXml.js +12 -1
- package/lib/xmlReader.js +5 -1
- package/package.json +1 -1
package/Changelog.md
CHANGED
package/README.md
CHANGED
|
@@ -253,6 +253,7 @@ TESTOMATIO={API_KEY} npx report-xml "{pattern}" --lang={lang}
|
|
|
253
253
|
* `php`
|
|
254
254
|
* `--java-tests` option is avaiable for Java projects, and can be set if path to tests is different then `src/test/java`. When this option is enable, `lang` option is automatically set to `java`
|
|
255
255
|
* `--env-file <envfile>` option to load environment variables from .env file. Inside env file TESTOMATIO credentials like `TESTOMATIO` api key or [S3 config](#attaching-test-artifacts) can be stored.
|
|
256
|
+
* `--timelimit <time>` set a timer to silently kill a long-running reporter process due to network or other issues. For instance, use `--set-timeout=3` to stop process after 3 secs.
|
|
256
257
|
|
|
257
258
|
|
|
258
259
|
> *Notice:* All options from [Advanced Usage](#advanced-usage) are also available for JUnit reporter
|
package/lib/bin/reportXml.js
CHANGED
|
@@ -15,6 +15,7 @@ program
|
|
|
15
15
|
.option("-d, --dir <dir>", "Project directory")
|
|
16
16
|
.option("--java-tests [java-path]", "Load Java tests from path, by default: src/test/java")
|
|
17
17
|
.option("--lang <lang>", "Language used (python, ruby, java)")
|
|
18
|
+
.option("--timelimit <time>", "default time limit in seconds to kill a stuck process")
|
|
18
19
|
.option("--env-file <envfile>", "Load environment variables from env file")
|
|
19
20
|
.action(async (pattern, opts) => {
|
|
20
21
|
if (!pattern.endsWith('.xml')) {
|
|
@@ -36,13 +37,23 @@ program
|
|
|
36
37
|
console.log(APP_PREFIX,`Parsed ${file}`);
|
|
37
38
|
runReader.parse(file);
|
|
38
39
|
}
|
|
40
|
+
|
|
41
|
+
let timeoutTimer;
|
|
42
|
+
if (opts.timelimit) {
|
|
43
|
+
timeoutTimer = setTimeout(() => {
|
|
44
|
+
console.log(`⚠️ Reached timeout of ${opts.timelimit}s. Exiting... (Exit code is 0 to not fail the pipeline)`);
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}, parseInt(opts.timelimit, 10) * 1000)
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
try {
|
|
40
50
|
await runReader.createRun();
|
|
41
51
|
await runReader.uploadData();
|
|
42
52
|
} catch (err) {
|
|
43
53
|
console.log(APP_PREFIX, 'Error updating status, skipping...', err);
|
|
44
|
-
process.exitCode = 1;
|
|
45
54
|
}
|
|
55
|
+
|
|
56
|
+
if (timeoutTimer) clearTimeout(timeoutTimer)
|
|
46
57
|
});
|
|
47
58
|
|
|
48
59
|
if (process.argv.length < 3) {
|
package/lib/xmlReader.js
CHANGED
|
@@ -416,6 +416,10 @@ function reduceTestCases(prev, item) {
|
|
|
416
416
|
// prepend system output
|
|
417
417
|
stack = `${testCaseItem['system-out'] || testCaseItem.output || testCaseItem.log || ''}\n\n${stack}`.trim()
|
|
418
418
|
|
|
419
|
+
let status = PASSED;
|
|
420
|
+
if ('failure' in testCaseItem || 'error' in testCaseItem) status = FAILED;
|
|
421
|
+
if ('skipped' in testCaseItem) status = SKIPPED;
|
|
422
|
+
|
|
419
423
|
prev.push({
|
|
420
424
|
create: true,
|
|
421
425
|
file,
|
|
@@ -423,7 +427,7 @@ function reduceTestCases(prev, item) {
|
|
|
423
427
|
message,
|
|
424
428
|
line: testCaseItem.lineno,
|
|
425
429
|
run_time: testCaseItem.time || testCaseItem.duration,
|
|
426
|
-
status
|
|
430
|
+
status,
|
|
427
431
|
title: testCaseItem.name,
|
|
428
432
|
suite_title: reduceOptions.preferClassname ? testCaseItem.classname : (item.name || testCaseItem.classname),
|
|
429
433
|
})
|