@testomatio/reporter 0.7.3-beta.1 → 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 CHANGED
@@ -1,6 +1,7 @@
1
1
  # 0.7.3
2
2
 
3
- * CodeceptJS: Upload all traces and videos from artifacts
3
+ * Fixed reporting skipped test in XML
4
+ * added `--timelimit` option to `report-xml` command line
4
5
 
5
6
  # 0.7.2
6
7
 
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
@@ -148,11 +148,7 @@ function CodeceptReporter(config) {
148
148
  const files = [];
149
149
  if (artifacts.screenshot) files.push({ path: artifacts.screenshot, type: 'image/png' });
150
150
  // todo: video must be uploaded later....
151
-
152
- for (const aid in artifacts) {
153
- if (aid.startsWith('video')) videos.push({ testId: id, title, path: artifacts[aid], type: 'video/webm' });
154
- if (aid.startsWith('trace')) files.push({ testId: id, title, path: artifacts[aid], type: 'application/zip' });
155
- }
151
+ if (artifacts.video) videos.push({ testId: id, title, path: artifacts.video, type: 'video/webm' });
156
152
 
157
153
  client.addTestRun(testId, TRConstants.FAILED, {
158
154
  ...stripExampleFromTitle(title),
@@ -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: (testCaseItem.failure || testCaseItem.error) ? 'failed' : 'passed',
430
+ status,
427
431
  title: testCaseItem.name,
428
432
  suite_title: reduceOptions.preferClassname ? testCaseItem.classname : (item.name || testCaseItem.classname),
429
433
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.7.3-beta.1",
3
+ "version": "0.7.3",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "repository": "git@github.com:testomatio/reporter.git",