@sasjs/cli 4.5.1 → 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,7 +1148,16 @@ exports.getTestTearDown = getTestTearDown;
1148
1148
  * @returns - instance of @sasjs/adapter.
1149
1149
  */
1150
1150
  function getSASjs(target) {
1151
- var verbose = process.env.VERBOSE;
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
+ }
1152
1161
  return new node_1.default({
1153
1162
  serverUrl: target.serverUrl,
1154
1163
  appLoc: target.appLoc,
@@ -1157,7 +1166,7 @@ function getSASjs(target) {
1157
1166
  httpsAgentOptions: target.httpsAgentOptions,
1158
1167
  debug: true,
1159
1168
  useComputeApi: target.serverType === utils_1.ServerType.SasViya,
1160
- verbose: typeof verbose === 'string' ? /on/i.test(verbose) : false // only string equal to 'on'(case insensitive) will enable verbose mode
1169
+ verbose: verbose
1161
1170
  });
1162
1171
  }
1163
1172
  exports.getSASjs = getSASjs;
@@ -782,15 +782,29 @@ describe('getSASjs', function () {
782
782
  verbose = sasjsConfig.verbose;
783
783
  expect(verbose).toEqual(true);
784
784
  });
785
- it('should disable verbose mode if VERBOSE env is not present', function () {
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);
796
+ });
797
+ it('should disable verbose mode if VERBOSE and LOG_LEVEL env are not present', function () {
786
798
  process.env.VERBOSE = '';
799
+ process.env.LOG_LEVEL = '';
787
800
  var sasjs = (0, config_1.getSASjs)({});
788
801
  var sasjsConfig = sasjs.getSasjsConfig();
789
802
  var verbose = sasjsConfig.verbose;
790
803
  expect(verbose).toEqual(false);
791
804
  });
792
- it("should disable verbose mode if VERBOSE env is present and is not equal to 'on'(case insensitive)", function () {
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 () {
793
806
  process.env.VERBOSE = 'start';
807
+ process.env.LOG_LEVEL = 'Info';
794
808
  var sasjs = (0, config_1.getSASjs)({});
795
809
  var sasjsConfig = sasjs.getSasjsConfig();
796
810
  var verbose = sasjsConfig.verbose;
package/package.json CHANGED
@@ -104,5 +104,5 @@
104
104
  "typescript": "4.9.5",
105
105
  "util": "0.12.4"
106
106
  },
107
- "version": "4.5.1"
107
+ "version": "4.6.0"
108
108
  }