@testomatio/reporter 1.6.0-beta-3-artifacts → 1.6.0-beta-4-artifacts

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/bin/cli.js CHANGED
@@ -172,15 +172,16 @@ program
172
172
  const apiKey = config.TESTOMATIO;
173
173
 
174
174
  process.env.TESTOMATIO_DISABLE_ARTIFACTS = '';
175
- process.env.TESTOMATIO_RUN ||= readLatestRunId();
175
+ const runId = process.env.TESTOMATIO_RUN || process.env.runId || readLatestRunId();
176
176
 
177
- if (!process.env.TESTOMATIO_RUN) {
177
+ if (!runId) {
178
178
  console.log('TESTOMATIO_RUN environment variable must be set or restored from a previous run.');
179
179
  return process.exit(1);
180
180
  }
181
181
 
182
182
  const client = new TestomatClient({
183
183
  apiKey,
184
+ runId,
184
185
  isBatchEnabled: false,
185
186
  });
186
187
 
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
- const program = require('commander');
2
+ const { program } = require('commander');
3
3
  const chalk = require('chalk');
4
4
  const debug = require('debug')('@testomatio/reporter:upload-cli');
5
5
  const TestomatClient = require('../client');
6
6
  const { APP_PREFIX } = require('../constants');
7
7
  const { version } = require('../../package.json');
8
8
  const config = require('../config');
9
+ const { readLatestRunId } = require('../utils/utils');
9
10
 
10
11
  console.log(chalk.cyan.bold(` 🤩 Testomat.io Reporter v${version}`));
11
12
 
@@ -21,15 +22,19 @@ program
21
22
  }
22
23
 
23
24
  const apiKey = config.TESTOMATIO;
24
-
25
25
  process.env.TESTOMATIO_DISABLE_ARTIFACTS = '';
26
- // process.env.TESTOMATIO_ARTIFACTS_SIZE = null;
26
+ const runId = process.env.TESTOMATIO_RUN || process.env.runId || readLatestRunId();
27
+
28
+ if (!runId) {
29
+ console.log('TESTOMATIO_RUN environment variable must be set or restored from a previous run.');
30
+ return process.exit(1);
31
+ }
27
32
 
28
33
  const client = new TestomatClient({
29
34
  apiKey,
35
+ runId,
30
36
  isBatchEnabled: false,
31
37
  });
32
-
33
38
  let testruns = client.uploader.readUploadedFiles(process.env.TESTOMATIO_RUN);
34
39
 
35
40
  const numTotalArtifacts = testruns.length;
package/lib/client.js CHANGED
@@ -263,7 +263,11 @@ class Client {
263
263
  }
264
264
 
265
265
  if (this.uploader.failedUploadsCount) {
266
- console.log(APP_PREFIX, `${this.uploader.failedUploadsCount} artifacts failed to upload`);
266
+ console.log(
267
+ APP_PREFIX,
268
+ chalk.gray('[CLIENT]'),
269
+ `${this.uploader.failedUploadsCount} artifacts failed to upload`,
270
+ );
267
271
  }
268
272
 
269
273
  if (this.uploader.isEnabled && this.uploader.skippedUploadsCount) {
@@ -271,7 +275,7 @@ class Client {
271
275
  }
272
276
 
273
277
  if (this.uploader.skippedUploadsCount || this.uploader.failedUploadsCount) {
274
- const command = `TESTOMATIO_RUN=${this.runId} npx upload-artifacts`;
278
+ const command = `TESTOMATIO_RUN=${this.runId} npx @testomatio/reporter upload-artifacts`;
275
279
  console.log(
276
280
  APP_PREFIX,
277
281
  `Run "${chalk.magenta(command)}" with valid S3 credentials to upload skipped & failed artifacts`,
package/lib/uploader.js CHANGED
@@ -170,6 +170,8 @@ class S3Uploader {
170
170
  async uploadFileByPath(filePath, pathInS3) {
171
171
  const [runId, rid] = pathInS3;
172
172
 
173
+ if (!filePath) return;
174
+
173
175
  if (!this.isEnabled) {
174
176
  this.storeUploadedFile(filePath, runId, rid, false);
175
177
  this.skippedUploadsCount++;
@@ -183,7 +185,6 @@ class S3Uploader {
183
185
  const isFileExist = await this.checkFileExists(filePath, 20, 500);
184
186
 
185
187
  if (!isFileExist) {
186
- this.failedUploadsCount++;
187
188
  console.error(chalk.yellow(`Artifacts file ${filePath} does not exist. Skipping...`));
188
189
  return;
189
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.6.0-beta-3-artifacts",
3
+ "version": "1.6.0-beta-4-artifacts",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",