@testomatio/reporter 0.5.0-beta.2 → 0.5.0-beta.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.
@@ -2,10 +2,10 @@ const AWS = require('aws-sdk');
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
  const chalk = require('chalk');
5
+ const memoize = require('lodash.memoize');
5
6
  const { APP_PREFIX } = require('./constants');
6
7
 
7
8
  const isPrivate = process.env.TESTOMATIO_PRIVATE_ARTIFACTS;
8
-
9
9
  const isEnabled = () => process.env.S3_BUCKET && !process.env.TESTOMATIO_DISABLE_ARTIFACTS;
10
10
 
11
11
  const uploadUsingS3 = async (filePath, runId) => {
@@ -14,6 +14,7 @@ const uploadUsingS3 = async (filePath, runId) => {
14
14
  const accessKeyId = process.env.S3_ACCESS_KEY_ID;
15
15
  const secretAccessKey = process.env.S3_SECRET_ACCESS_KEY;
16
16
  const isDisabled = process.env.TESTOMATIO_DISABLE_ARTIFACTS;
17
+ const s3ForcePathStyle = process.env.S3_FORCE_PATH_STYLE;
17
18
 
18
19
  if (isDisabled) return;
19
20
 
@@ -26,7 +27,7 @@ const uploadUsingS3 = async (filePath, runId) => {
26
27
  fileName = filePath.name;
27
28
  }
28
29
 
29
- const config = { region, accessKeyId, secretAccessKey };
30
+ const config = { region, accessKeyId, secretAccessKey, s3ForcePathStyle };
30
31
  if (process.env.S3_ENDPOINT) {
31
32
  config.endpoint = new AWS.Endpoint(process.env.S3_ENDPOINT);
32
33
  }
@@ -47,6 +48,7 @@ const uploadUsingS3 = async (filePath, runId) => {
47
48
  ACL: acl,
48
49
  })
49
50
  .promise();
51
+
50
52
  return out.Location;
51
53
  } catch (e) {
52
54
  console.log(APP_PREFIX, chalk.bold.red(`Failed uploading '${fileName}'. Please check S3 credentials`), {
@@ -84,7 +86,7 @@ const uploadFile = async (filePath, runId) => {
84
86
  };
85
87
 
86
88
  module.exports = {
87
- uploadFile,
89
+ uploadFile: memoize(uploadFile),
88
90
  isPrivate,
89
91
  isEnabled,
90
92
  };
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.5.0-beta.2",
3
+ "version": "0.5.0-beta.3",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "repository": "git@github.com:testomatio/reporter.git",
7
7
  "author": "Koushik Mohan <koushikmohan1996@gmail.com>",
8
8
  "license": "MIT",
9
9
  "dependencies": {
10
- "aws-sdk": "^2.1064.0",
10
+ "aws-sdk": "^2.1072.0",
11
11
  "axios": "^0.25.0",
12
12
  "callsite-record": "^4.1.4",
13
13
  "chalk": "^4.1.0",
14
14
  "commander": "^4.1.1",
15
15
  "has-flag": "^5.0.1",
16
- "json-cycle": "^1.3.0"
16
+ "json-cycle": "^1.3.0",
17
+ "lodash.memoize": "^4.1.2"
17
18
  },
18
19
  "scripts": {
19
20
  "pretty": "prettier --write .",