@sasjs/cli 4.4.2 → 4.5.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.
@@ -70,7 +70,6 @@ var path_1 = __importDefault(require("path"));
70
70
  var utils_1 = require("@sasjs/utils");
71
71
  var test_1 = require("../test");
72
72
  var setConstants_1 = require("../setConstants");
73
- jest.mock('@sasjs/adapter/node');
74
73
  describe('getAccessToken', function () {
75
74
  beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
76
75
  return __generator(this, function (_a) {
@@ -726,3 +725,75 @@ describe('removeFromLocalConfig', function () {
726
725
  });
727
726
  }); });
728
727
  });
728
+ describe('getSASjs', function () {
729
+ it('should set sasjsConfig according to target', function () {
730
+ var target = {
731
+ serverUrl: 'test_serverUrl',
732
+ appLoc: 'test_appLoc',
733
+ serverType: utils_1.ServerType.SasViya,
734
+ contextName: 'test_contextName',
735
+ httpsAgentOptions: {
736
+ caPath: 'test_caPath',
737
+ keyPath: 'test_keyPath',
738
+ certPath: 'test_certPath',
739
+ allowInsecureRequests: false
740
+ }
741
+ };
742
+ var sasjs = (0, config_1.getSASjs)(target);
743
+ var sasjsConfig = sasjs.getSasjsConfig();
744
+ var serverUrl = sasjsConfig.serverUrl, appLoc = sasjsConfig.appLoc, serverType = sasjsConfig.serverType, contextName = sasjsConfig.contextName, httpsAgentOptions = sasjsConfig.httpsAgentOptions;
745
+ expect(serverUrl).toEqual(target.serverUrl);
746
+ expect(appLoc).toEqual(target.appLoc);
747
+ expect(serverType).toEqual(target.serverType);
748
+ expect(contextName).toEqual(target.contextName);
749
+ expect(httpsAgentOptions).toEqual(target.httpsAgentOptions);
750
+ });
751
+ it('should set debug to true by default', function () {
752
+ var sasjs = (0, config_1.getSASjs)({});
753
+ var sasjsConfig = sasjs.getSasjsConfig();
754
+ var debug = sasjsConfig.debug;
755
+ expect(debug).toEqual(true);
756
+ });
757
+ it('should set useComputeApi to true if server type is Viya', function () {
758
+ var sasjs = (0, config_1.getSASjs)({ serverType: utils_1.ServerType.SasViya });
759
+ var sasjsConfig = sasjs.getSasjsConfig();
760
+ var useComputeApi = sasjsConfig.useComputeApi;
761
+ expect(useComputeApi).toEqual(true);
762
+ });
763
+ it('should set useComputeApi to false if server type is not Viya', function () {
764
+ var sasjs = (0, config_1.getSASjs)({ serverType: utils_1.ServerType.Sas9 });
765
+ var sasjsConfig = sasjs.getSasjsConfig();
766
+ var useComputeApi = sasjsConfig.useComputeApi;
767
+ expect(useComputeApi).toEqual(false);
768
+ sasjs = (0, config_1.getSASjs)({ serverType: utils_1.ServerType.Sasjs });
769
+ sasjsConfig = sasjs.getSasjsConfig();
770
+ useComputeApi = sasjsConfig.useComputeApi;
771
+ expect(useComputeApi).toEqual(false);
772
+ });
773
+ it("should enable verbose mode if VERBOSE env is present and is equal to 'on'(case insensitive)", function () {
774
+ process.env.VERBOSE = 'on';
775
+ var sasjs = (0, config_1.getSASjs)({});
776
+ var sasjsConfig = sasjs.getSasjsConfig();
777
+ var verbose = sasjsConfig.verbose;
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 disable verbose mode if VERBOSE env is not present', function () {
786
+ process.env.VERBOSE = '';
787
+ var sasjs = (0, config_1.getSASjs)({});
788
+ var sasjsConfig = sasjs.getSasjsConfig();
789
+ var verbose = sasjsConfig.verbose;
790
+ expect(verbose).toEqual(false);
791
+ });
792
+ it("should disable verbose mode if VERBOSE env is present and is not equal to 'on'(case insensitive)", function () {
793
+ process.env.VERBOSE = 'start';
794
+ var sasjs = (0, config_1.getSASjs)({});
795
+ var sasjsConfig = sasjs.getSasjsConfig();
796
+ var verbose = sasjsConfig.verbose;
797
+ expect(verbose).toEqual(false);
798
+ });
799
+ });
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"
@@ -50,7 +51,7 @@
50
51
  "access": "public"
51
52
  },
52
53
  "dependencies": {
53
- "@sasjs/adapter": "4.5.1",
54
+ "@sasjs/adapter": "4.8.0",
54
55
  "@sasjs/core": "4.46.3",
55
56
  "@sasjs/lint": "2.3.1",
56
57
  "@sasjs/utils": "3.3.0",
@@ -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.4.2"
107
+ "version": "4.5.1"
106
108
  }