@testomatio/reporter 1.6.7 → 1.6.9-beta.1-metadata-formatting

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/client.js CHANGED
@@ -171,13 +171,15 @@ class Client {
171
171
  if (typeof meta[key] === 'object') {
172
172
  meta[key] = JSON.stringify(meta[key]);
173
173
  }
174
+
174
175
  // cut values
175
- if (meta[key].length > 255) {
176
+ if (meta[key]?.length > 255) {
176
177
  meta[key] = meta[key].substring(0, 255);
177
178
  debug(APP_PREFIX, `Meta info value "${meta[key]}" is too long, trimmed to 255 characters`);
178
179
  }
180
+
179
181
  // cut keys
180
- if (key.length > 255) {
182
+ if (key?.length > 255) {
181
183
  const newKey = key.substring(0, 255);
182
184
  meta[newKey] = meta[key];
183
185
  delete meta[key];
@@ -332,9 +334,7 @@ class Client {
332
334
  console.log(
333
335
  '\n',
334
336
  APP_PREFIX,
335
- `🗄️ ${chalk.bold(this.uploader.skippedUploads.length)} artifacts uploading 🟡${chalk.bold(
336
- 'skipped',
337
- )} (due to large size)`,
337
+ `🗄️ ${chalk.bold(this.uploader.skippedUploads.length)} artifacts uploading 🟡${chalk.bold('skipped')}`,
338
338
  );
339
339
  const skippedUploads = this.uploader.skippedUploads.map(file => ({
340
340
  relativePath: file.path.replace(process.cwd(), ''),
@@ -371,7 +371,14 @@ class TestomatioPipe {
371
371
  if (!this.isEnabled) return;
372
372
 
373
373
  await this.#batchUpload();
374
- if (this.batch.intervalFunction) clearInterval(this.batch.intervalFunction);
374
+ if (this.batch.intervalFunction) {
375
+ clearInterval(this.batch.intervalFunction);
376
+ // this code is required in case test is added after run is finished
377
+ // (e.g. if test has artifacts, add test function will be invoked only after artifacts are uploaded)
378
+ // batch stops working after run is finished; thus, disable it to use single test uploading
379
+ this.batch.intervalFunction = null;
380
+ this.batch.isEnabled = false;
381
+ }
375
382
 
376
383
  debug('Finishing run...');
377
384
 
package/lib/uploader.js CHANGED
@@ -106,14 +106,14 @@ class S3Uploader {
106
106
 
107
107
  debug('Uploading to S3:', Key);
108
108
 
109
- const s3Config = this.#getS3Config()
109
+ const s3Config = this.#getS3Config();
110
110
  const s3 = new S3(s3Config);
111
111
 
112
112
  const params = {
113
113
  Bucket: S3_BUCKET,
114
114
  Key,
115
115
  Body,
116
- }
116
+ };
117
117
 
118
118
  // disable ACL for I AM roles
119
119
  if (!s3Config.credentials.sessionToken) {
@@ -206,6 +206,9 @@ class S3Uploader {
206
206
  * @returns
207
207
  */
208
208
  async uploadFileByPath(filePath, pathInS3) {
209
+ // sometimes artifacts uploading started before createRun function completion
210
+ this.isEnabled = this.isEnabled ?? this.checkEnabled();
211
+
209
212
  const [runId, rid] = pathInS3;
210
213
 
211
214
  if (!filePath) return;
@@ -248,7 +251,11 @@ class S3Uploader {
248
251
  this.storeUploadedFile(filePath, runId, rid, false);
249
252
  this.skippedUploads.push(skippedArtifact);
250
253
  debug(
251
- chalk.yellow(`Artifacts file ${JSON.stringify(skippedArtifact)} exceeds the maximum allowed size. Skipping.`),
254
+ chalk.yellow(
255
+ `Artifacts file ${JSON.stringify(skippedArtifact)} exceeds the maximum allowed size ${
256
+ TESTOMATIO_ARTIFACT_MAX_SIZE_MB
257
+ }MB. Skipping.`,
258
+ ),
252
259
  );
253
260
  return;
254
261
  }
@@ -15,8 +15,8 @@ function setS3Credentials(artifacts) {
15
15
  if (artifacts.BUCKET) process.env.S3_BUCKET = artifacts.BUCKET;
16
16
  if (artifacts.SESSION_TOKEN) process.env.S3_SESSION_TOKEN = artifacts.SESSION_TOKEN;
17
17
  if (artifacts.presign) process.env.TESTOMATIO_PRIVATE_ARTIFACTS = '1';
18
- // endpoint is not received from the server; and shuld be empty if IAM used (credentails obtained from the testomat)
19
- process.env.S3_ENDPOINT = artifacts.ENDPOINT || '';
18
+ // endpoint is not received from the server; and shuld be empty if IAM used (credentails obtained from the testomat)
19
+ process.env.S3_ENDPOINT = artifacts.ENDPOINT || '';
20
20
  }
21
21
  /**
22
22
  * Generates mode request parameters based on the input params.
package/lib/xmlReader.js CHANGED
@@ -21,8 +21,8 @@ const config = require('./config');
21
21
  const ridRunId = randomUUID();
22
22
 
23
23
  const TESTOMATIO_URL = process.env.TESTOMATIO_URL || 'https://app.testomat.io';
24
- const { TESTOMATIO_RUNGROUP_TITLE, TESTOMATIO_TITLE, TESTOMATIO_ENV, TESTOMATIO_RUN,
25
- TESTOMATIO_MARK_DETACHED } = process.env;
24
+ const { TESTOMATIO_RUNGROUP_TITLE, TESTOMATIO_TITLE, TESTOMATIO_ENV, TESTOMATIO_RUN, TESTOMATIO_MARK_DETACHED } =
25
+ process.env;
26
26
 
27
27
  const options = {
28
28
  ignoreDeclaration: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.6.7",
3
+ "version": "1.6.9-beta.1-metadata-formatting",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",