@sasjs/cli 4.5.0 → 4.6.0

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.
@@ -1148,6 +1148,16 @@ exports.getTestTearDown = getTestTearDown;
1148
1148
  * @returns - instance of @sasjs/adapter.
1149
1149
  */
1150
1150
  function getSASjs(target) {
1151
+ var _a = process.env, VERBOSE = _a.VERBOSE, LOG_LEVEL = _a.LOG_LEVEL;
1152
+ var verbose = false;
1153
+ // verbose mode should be enabled if VERBOSE environment variable present and is equal to 'on'(case insensitive)
1154
+ if (typeof VERBOSE === 'string' && /on/i.test(VERBOSE)) {
1155
+ verbose = true;
1156
+ }
1157
+ // verbose mode should be enabled if LOG_LEVEL environment variable present and is equal to 'trace'(case insensitive)
1158
+ else if (typeof LOG_LEVEL === 'string' && /trace/i.test(LOG_LEVEL)) {
1159
+ verbose = true;
1160
+ }
1151
1161
  return new node_1.default({
1152
1162
  serverUrl: target.serverUrl,
1153
1163
  appLoc: target.appLoc,
@@ -1156,7 +1166,7 @@ function getSASjs(target) {
1156
1166
  httpsAgentOptions: target.httpsAgentOptions,
1157
1167
  debug: true,
1158
1168
  useComputeApi: target.serverType === utils_1.ServerType.SasViya,
1159
- verbose: !!process.env.VERBOSE // any not empty string should be considered as true
1169
+ verbose: verbose
1160
1170
  });
1161
1171
  }
1162
1172
  exports.getSASjs = getSASjs;
@@ -770,15 +770,41 @@ describe('getSASjs', function () {
770
770
  useComputeApi = sasjsConfig.useComputeApi;
771
771
  expect(useComputeApi).toEqual(false);
772
772
  });
773
- it('should enable verbose mode if VERBOSE env is present', function () {
773
+ it("should enable verbose mode if VERBOSE env is present and is equal to 'on'(case insensitive)", function () {
774
774
  process.env.VERBOSE = 'on';
775
775
  var sasjs = (0, config_1.getSASjs)({});
776
776
  var sasjsConfig = sasjs.getSasjsConfig();
777
777
  var verbose = sasjsConfig.verbose;
778
778
  expect(verbose).toEqual(true);
779
+ process.env.VERBOSE = 'ON';
780
+ sasjs = (0, config_1.getSASjs)({});
781
+ sasjsConfig = sasjs.getSasjsConfig();
782
+ verbose = sasjsConfig.verbose;
783
+ expect(verbose).toEqual(true);
784
+ });
785
+ it("should enable verbose mode if LOG_LEVEL env is present and is equal to 'trace'(case insensitive)", function () {
786
+ process.env.LOG_LEVEL = 'trace';
787
+ var sasjs = (0, config_1.getSASjs)({});
788
+ var sasjsConfig = sasjs.getSasjsConfig();
789
+ var verbose = sasjsConfig.verbose;
790
+ expect(verbose).toEqual(true);
791
+ process.env.LOG_LEVEL = 'TRACE';
792
+ sasjs = (0, config_1.getSASjs)({});
793
+ sasjsConfig = sasjs.getSasjsConfig();
794
+ verbose = sasjsConfig.verbose;
795
+ expect(verbose).toEqual(true);
779
796
  });
780
- it('should disable verbose mode if VERBOSE env is not present', function () {
797
+ it('should disable verbose mode if VERBOSE and LOG_LEVEL env are not present', function () {
781
798
  process.env.VERBOSE = '';
799
+ process.env.LOG_LEVEL = '';
800
+ var sasjs = (0, config_1.getSASjs)({});
801
+ var sasjsConfig = sasjs.getSasjsConfig();
802
+ var verbose = sasjsConfig.verbose;
803
+ expect(verbose).toEqual(false);
804
+ });
805
+ it("should disable verbose mode if VERBOSE env is present and is not equal to 'on'(case insensitive) and LOG_LEVEL env is present and is not equal to 'trace'(case insensitive)", function () {
806
+ process.env.VERBOSE = 'start';
807
+ process.env.LOG_LEVEL = 'Info';
782
808
  var sasjs = (0, config_1.getSASjs)({});
783
809
  var sasjsConfig = sasjs.getSasjsConfig();
784
810
  var verbose = sasjsConfig.verbose;
package/package.json CHANGED
@@ -20,7 +20,8 @@
20
20
  "lint:fix": "npx prettier --write \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
21
21
  "lint": "npx prettier --check \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
22
22
  "preinstall": "npm run nodeVersionMessage",
23
- "prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true"
23
+ "prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true",
24
+ "doc": "npx compodoc -p tsconfig.doc.json --coverageTest 15 --coverageTestThresholdFail"
24
25
  },
25
26
  "testServerTypes": "sasjs",
26
27
  "release": {
@@ -40,7 +41,7 @@
40
41
  "Viya",
41
42
  "SASjs"
42
43
  ],
43
- "author": "",
44
+ "author": "4GL Apps",
44
45
  "license": "ISC",
45
46
  "bugs": {
46
47
  "url": "https://github.com/sasjs/cli/issues"
@@ -77,6 +78,7 @@
77
78
  "@babel/core": "7.21.0",
78
79
  "@babel/preset-env": "7.20.2",
79
80
  "@babel/preset-typescript": "7.21.0",
81
+ "@compodoc/compodoc": "1.1.21",
80
82
  "@types/adm-zip": "0.5.0",
81
83
  "@types/debug": "4.1.7",
82
84
  "@types/find": "0.2.1",
@@ -102,5 +104,5 @@
102
104
  "typescript": "4.9.5",
103
105
  "util": "0.12.4"
104
106
  },
105
- "version": "4.5.0"
107
+ "version": "4.6.0"
106
108
  }