@testrevolution/bugbug-cli 6.30.2 → 6.31.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@testrevolution/bugbug-cli",
3
3
  "description": "BugBug CLI",
4
- "version": "6.30.2",
4
+ "version": "6.31.1",
5
5
  "keywords": [
6
6
  "automation",
7
7
  "cli",
@@ -18,14 +18,14 @@
18
18
  "bugbug": "bin/bugbug"
19
19
  },
20
20
  "dependencies": {
21
- "@sentry/node": "^7.43.0",
22
- "axios": "^0.27.2",
23
- "console-table-printer": "^2.11.1",
24
- "dotenv": "^16.0.3",
21
+ "@sentry/node": "^7.80.1",
22
+ "axios": "^1.6.2",
23
+ "console-table-printer": "^2.11.2",
24
+ "dotenv": "^16.3.1",
25
25
  "minimist": "^1.2.8",
26
26
  "ora": "^5.4.1",
27
27
  "path": "^0.12.7",
28
- "validator": "^13.9.0"
28
+ "validator": "^13.11.0"
29
29
  },
30
30
  "scripts": {
31
31
  "start": "NODE_ENV=development node ./bin/bugbug",
@@ -39,15 +39,15 @@
39
39
  "node": ">= 14.10"
40
40
  },
41
41
  "devDependencies": {
42
- "@babel/eslint-parser": "^7.21.3",
43
- "@babel/plugin-proposal-throw-expressions": "^7.14.5",
42
+ "@babel/eslint-parser": "^7.23.3",
43
+ "@babel/plugin-proposal-throw-expressions": "^7.23.3",
44
44
  "babel-plugin-rewire": "^1.2.0",
45
- "eslint": "^7.32.0",
45
+ "eslint": "^8.53.0",
46
46
  "eslint-config-airbnb-base": "^15.0.0",
47
- "eslint-plugin-import": "^2.27.5",
48
- "eslint-plugin-jest": "^27.2.1",
47
+ "eslint-plugin-import": "^2.29.0",
48
+ "eslint-plugin-jest": "^27.6.0",
49
49
  "eslint-plugin-node": "^11.1.0",
50
- "jest": "^28.1.3"
50
+ "jest": "^29.7.0"
51
51
  },
52
52
  "author": "TestRevolution sp. z o.o."
53
53
  }
@@ -496,7 +496,7 @@ describe('commands module', () => {
496
496
  url: `https://bugbug.io/test-api/v1/testruns/${id}/`,
497
497
  data: {},
498
498
  params: {},
499
- headers: { Authorization: `Token ${configValue.token}` },
499
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
500
500
  });
501
501
  });
502
502
 
@@ -523,7 +523,7 @@ describe('commands module', () => {
523
523
  url: `https://bugbug.io/test-api/v1/testruns/${id}/`,
524
524
  data: {},
525
525
  params: {},
526
- headers: { Authorization: `Token ${configValue.token}` },
526
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
527
527
  });
528
528
  });
529
529
 
@@ -551,7 +551,7 @@ describe('commands module', () => {
551
551
  url: `https://bugbug.io/test-api/v1/testruns/${id}/`,
552
552
  data: {},
553
553
  params: {},
554
- headers: { Authorization: `Token ${configValue.token}` },
554
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
555
555
  });
556
556
  });
557
557
 
@@ -572,7 +572,7 @@ describe('commands module', () => {
572
572
  url: `https://bugbug.io/test-api/v1/testruns/${id}/status/`,
573
573
  data: {},
574
574
  params: {},
575
- headers: { Authorization: `Token ${configValue.token}` },
575
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
576
576
  });
577
577
  });
578
578
 
@@ -596,7 +596,7 @@ describe('commands module', () => {
596
596
  variables: [],
597
597
  },
598
598
  params: {},
599
- headers: { Authorization: `Token ${configValue.token}` },
599
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
600
600
  });
601
601
  });
602
602
 
@@ -622,7 +622,7 @@ describe('commands module', () => {
622
622
  variables: [],
623
623
  },
624
624
  params: {},
625
- headers: { Authorization: `Token ${configValue.token}` },
625
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
626
626
  });
627
627
  });
628
628
 
@@ -676,7 +676,7 @@ describe('commands module', () => {
676
676
  test_id: id, profile_name: undefined, variables: [],
677
677
  },
678
678
  params: {},
679
- headers: { Authorization: `Token ${configValue.token}` },
679
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
680
680
  });
681
681
  });
682
682
 
@@ -701,7 +701,7 @@ describe('commands module', () => {
701
701
  test_id: id, profile_name: profileName, variables: [],
702
702
  },
703
703
  params: {},
704
- headers: { Authorization: `Token ${configValue.token}` },
704
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
705
705
  });
706
706
  });
707
707
 
@@ -727,21 +727,21 @@ describe('commands module', () => {
727
727
  test_id: id, profile_name: undefined, variables: [],
728
728
  },
729
729
  params: {},
730
- headers: { Authorization: `Token ${configValue.token}` },
730
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
731
731
  });
732
732
  expect(axios).toHaveBeenNthCalledWith(2, {
733
733
  method: 'GET',
734
734
  url: `https://bugbug.io/test-api/v1/testruns/${apiMocks.runTestSuccess.data.id}/status/`,
735
735
  data: {},
736
736
  params: {},
737
- headers: { Authorization: `Token ${configValue.token}` },
737
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
738
738
  });
739
739
  expect(axios).toHaveBeenNthCalledWith(3, {
740
740
  method: 'GET',
741
741
  url: `https://bugbug.io/test-api/v1/testruns/${apiMocks.runTestSuccess.data.id}/`,
742
742
  data: {},
743
743
  params: {},
744
- headers: { Authorization: `Token ${configValue.token}` },
744
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
745
745
  });
746
746
  });
747
747
 
@@ -762,7 +762,7 @@ describe('commands module', () => {
762
762
  url: 'https://bugbug.io/test-api/v1/profiles/',
763
763
  data: {},
764
764
  params: {},
765
- headers: { Authorization: `Token ${configValue.token}` },
765
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
766
766
  });
767
767
  });
768
768
 
@@ -783,7 +783,7 @@ describe('commands module', () => {
783
783
  url: 'https://bugbug.io/test-api/v1/tests/',
784
784
  data: {},
785
785
  params: {},
786
- headers: { Authorization: `Token ${configValue.token}` },
786
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
787
787
  });
788
788
  });
789
789
 
@@ -804,7 +804,7 @@ describe('commands module', () => {
804
804
  url: 'https://bugbug.io/test-api/v1/suites/',
805
805
  data: {},
806
806
  params: {},
807
- headers: { Authorization: `Token ${configValue.token}` },
807
+ headers: { Authorization: `Token ${configValue.token}`, 'User-Agent': settings.USER_AGENT },
808
808
  });
809
809
  });
810
810
  });
@@ -222,7 +222,7 @@ describe('utils module', () => {
222
222
  url: 'https://bugbug.io/test-api/test-path',
223
223
  data: { test: true },
224
224
  params: { query: 'search' },
225
- headers: { Authorization: 'Token 1337' },
225
+ headers: { Authorization: 'Token 1337', 'User-Agent': settings.USER_AGENT },
226
226
  });
227
227
  });
228
228
 
package/src/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  const path = require('path');
2
2
  const minimist = require('minimist');
3
- const { version } = require('../package.json');
4
3
  const api = require('./utils/api');
5
4
  const sentry = require('./utils/sentry');
6
5
  const commands = require('./commands');
6
+ const settings = require('./settings');
7
7
  const config = require('./utils/config');
8
8
  const helper = require('./utils/helper');
9
9
 
10
10
  require('dotenv').config();
11
11
  require('dotenv').config({
12
- path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV}`),
12
+ path: path.resolve(process.cwd(), `.env.${settings.NODE_ENV}`),
13
13
  });
14
14
 
15
15
  sentry.init();
@@ -33,7 +33,7 @@ module.exports = async () => {
33
33
  exitCode = helper.getExitCode(true);
34
34
  break;
35
35
  case 'version':
36
- console.log(version);
36
+ console.log(settings.VERSION);
37
37
  exitCode = helper.getExitCode(true);
38
38
  break;
39
39
  default:
package/src/settings.js CHANGED
@@ -2,11 +2,13 @@ const path = require('path');
2
2
  const os = require('os');
3
3
  const dotenv = require('dotenv');
4
4
  const util = require('util');
5
+ const VERSION = require('../package.json').version;
5
6
 
6
7
  util.inspect.styles.string = 'white';
7
8
 
8
9
  const NODE_ENV = process.env.NODE_ENV || 'production';
9
10
  const ENV_FILE_PATH = path.resolve(__dirname, '..', `.env.${NODE_ENV}`);
11
+ const USER_AGENT = `BugBug CLI ${VERSION}`;
10
12
  dotenv.config({ path: ENV_FILE_PATH });
11
13
 
12
14
  const CONFIG_DIR_PATH = path.join(os.homedir(), '.bugbug');
@@ -91,4 +93,6 @@ module.exports = {
91
93
  TYPE_PROFILE,
92
94
  TYPE_SUITE,
93
95
  TYPE_TEST,
96
+ USER_AGENT,
97
+ VERSION,
94
98
  };
package/src/utils/api.js CHANGED
@@ -68,6 +68,7 @@ const interceptResponseError = (spinner, isDebugEnabled) => (error) => {
68
68
 
69
69
  const mountAxiosInterceptors = (printRawResponse) => {
70
70
  const spinner = getSpinner(false);
71
+ axios.defaults.headers.common['Content-Type'] = 'application/json';
71
72
  axios.interceptors.request.use(interceptRequest(printRawResponse));
72
73
  axios.interceptors.response.use(
73
74
  interceptResponseSuccess(printRawResponse),
@@ -93,6 +94,7 @@ const apiCall = async (path, method, data, params) => {
93
94
  params,
94
95
  headers: {
95
96
  Authorization: `Token ${token}`,
97
+ 'User-Agent': settings.USER_AGENT,
96
98
  },
97
99
  });
98
100