From 3392940dcd4b43837ac87e6502d3a4491ad8ee4b Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 13 Feb 2020 09:55:22 -0500 Subject: [PATCH 1/3] Don't require ~/.zowe folder to exist Signed-off-by: Timothy Johnson --- src/Profiles.ts | 4 ++++ src/extension.ts | 29 ++++++++++++++--------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/Profiles.ts b/src/Profiles.ts index 5c3cfbc6cb..775e9aa613 100644 --- a/src/Profiles.ts +++ b/src/Profiles.ts @@ -40,6 +40,10 @@ let IConnection: { export class Profiles { // Processing stops if there are no profiles detected public static async createInstance(log: Logger): Promise { + await CliProfileManager.initialize({ + configuration: zowe.getImperativeConfig().profiles, + profileRootDirectory: path.join(getZoweDir(), "profiles"), + }); Profiles.loader = new Profiles(log); await Profiles.loader.refresh(); return Profiles.loader; diff --git a/src/extension.ts b/src/extension.ts index db194871e7..8dff8493fb 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -364,34 +364,33 @@ export function defineGlobals(tempPath: string | undefined) { * Imports the neccesary security modules */ export function getSecurityModules(moduleName): NodeRequire | undefined { - let imperativeIsSsecure: boolean = false; + let imperativeIsSecure: boolean = false; try { const fileName = path.join(getZoweDir(), "settings", "imperative.json"); - const settings = JSON.parse(fs.readFileSync(fileName).toString()); - const value1 = settings.overrides.CredentialManager; - const value2 = settings.overrides["credential-manager"]; - imperativeIsSsecure = ((typeof value1 === "string") && (value1.length > 0)) || + let settings: any; + if (fs.existsSync(fileName)) { + settings = JSON.parse(fs.readFileSync(fileName).toString()); + } + const value1 = settings?.overrides.CredentialManager; + const value2 = settings?.overrides["credential-manager"]; + imperativeIsSecure = ((typeof value1 === "string") && (value1.length > 0)) || ((typeof value2 === "string") && (value2.length > 0)); } catch (error) { log.warn(localize("profile.init.read.imperative", "Unable to read imperative file. ") + error.message); - vscode.window.showInformationMessage(error.message); + vscode.window.showWarningMessage(error.message); return undefined; } - if (imperativeIsSsecure) { + if (imperativeIsSecure) { // Workaround for Theia issue (https://github.com/eclipse-theia/theia/issues/4935) const appRoot = ISTHEIA ? process.cwd() : vscode.env.appRoot; try { return require(`${appRoot}/node_modules/${moduleName}`); - } catch (err) { - vscode.window.showWarningMessage(localize("initialize.module.load", - "Credentials not managed, unable to load security file: ") + moduleName); - } + } catch (err) { /* Do nothing */ } try { return require(`${appRoot}/node_modules.asar/${moduleName}`); - } catch (err) { - vscode.window.showWarningMessage(localize("initialize.module.load", - "Credentials not managed, unable to load security file: ") + moduleName); - } + } catch (err) { /* Do nothing */ } + vscode.window.showWarningMessage(localize("initialize.module.load", + "Credentials not managed, unable to load security file: ") + moduleName); } return undefined; } From e21eef872f39a5c53ecd69b5957cd5215d9771cb Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 18 Feb 2020 07:09:06 -0500 Subject: [PATCH 2/3] Update to latest version of @brightside/core Signed-off-by: Timothy Johnson --- package-lock.json | 347 +++++++++++++++++++++++----------------------- 1 file changed, 170 insertions(+), 177 deletions(-) diff --git a/package-lock.json b/package-lock.json index c882ce3af2..fc95de9971 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,17 +14,17 @@ } }, "@babel/core": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.3.tgz", - "integrity": "sha512-4XFkf8AwyrEG7Ziu3L2L0Cv+WyY47Tcsp70JFmpftbAA1K7YL/sgE9jh9HyNj08Y/U50ItUchpN0w6HxAoX1rA==", + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.4.tgz", + "integrity": "sha512-0LiLrB2PwrVI+a2/IEskBopDYSd8BCb3rOvH7D5tzoWd696TBEduBvuLVm4Nx6rltrLZqvI3MCalB2K2aVzQjA==", "dev": true, "requires": { "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.8.3", - "@babel/helpers": "^7.8.3", - "@babel/parser": "^7.8.3", + "@babel/generator": "^7.8.4", + "@babel/helpers": "^7.8.4", + "@babel/parser": "^7.8.4", "@babel/template": "^7.8.3", - "@babel/traverse": "^7.8.3", + "@babel/traverse": "^7.8.4", "@babel/types": "^7.8.3", "convert-source-map": "^1.7.0", "debug": "^4.1.0", @@ -54,9 +54,9 @@ } }, "@babel/generator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.3.tgz", - "integrity": "sha512-WjoPk8hRpDRqqzRpvaR8/gDUPkrnOOeuT2m8cNICJtZH6mwaCo3v0OKMI7Y6SM1pBtyijnLtAL0HDi41pf41ug==", + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.4.tgz", + "integrity": "sha512-PwhclGdRpNAf3IxZb0YVuITPZmmrXz9zf6fH8lT4XbrmfQKr6ryBzhv593P5C6poJRciFCL/eHGW2NuGrgEyxA==", "dev": true, "requires": { "@babel/types": "^7.8.3", @@ -109,13 +109,13 @@ } }, "@babel/helpers": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.8.3.tgz", - "integrity": "sha512-LmU3q9Pah/XyZU89QvBgGt+BCsTPoQa+73RxAQh8fb8qkDyIfeQnmgs+hvzhTCKTzqOyk7JTkS3MS1S8Mq5yrQ==", + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.8.4.tgz", + "integrity": "sha512-VPbe7wcQ4chu4TDQjimHv/5tj73qz88o12EPkO2ValS2QiQS/1F2SsjyIGNnAD0vF/nZS6Cf9i+vW6HIlnaR8w==", "dev": true, "requires": { "@babel/template": "^7.8.3", - "@babel/traverse": "^7.8.3", + "@babel/traverse": "^7.8.4", "@babel/types": "^7.8.3" } }, @@ -131,9 +131,9 @@ } }, "@babel/parser": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.3.tgz", - "integrity": "sha512-/V72F4Yp/qmHaTALizEm9Gf2eQHV3QyTL3K0cNfijwnMnb1L+LDlAubb/ZnSdGAVzVSWakujHYs1I26x66sMeQ==", + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.4.tgz", + "integrity": "sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw==", "dev": true }, "@babel/plugin-syntax-object-rest-spread": { @@ -157,16 +157,16 @@ } }, "@babel/traverse": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.8.3.tgz", - "integrity": "sha512-we+a2lti+eEImHmEXp7bM9cTxGzxPmBiVJlLVD+FuuQMeeO7RaDbutbgeheDkw+Xe3mCfJHnGOWLswT74m2IPg==", + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.8.4.tgz", + "integrity": "sha512-NGLJPZwnVEyBPLI+bl9y9aSnxMhsKz42so7ApAv9D+b4vAFPpY013FTS9LdKxcABoIYFU52HcYga1pPlx454mg==", "dev": true, "requires": { "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.8.3", + "@babel/generator": "^7.8.4", "@babel/helper-function-name": "^7.8.3", "@babel/helper-split-export-declaration": "^7.8.3", - "@babel/parser": "^7.8.3", + "@babel/parser": "^7.8.4", "@babel/types": "^7.8.3", "debug": "^4.1.0", "globals": "^11.1.0", @@ -196,9 +196,9 @@ } }, "@brightside/core": { - "version": "2.36.1", - "resolved": "https://dl.bintray.com//ca/brightside/@brightside/core/-/@brightside/core-2.36.1.tgz", - "integrity": "sha1-Pn9m4gFSTkGeuOI005cVqiPwcF8=", + "version": "2.36.4", + "resolved": "https://dl.bintray.com//ca/brightside/@brightside/core/-/@brightside/core-2.36.4.tgz", + "integrity": "sha1-HUPcvPOjUuX9Ty9KbqW2IHHXgTM=", "requires": { "@brightside/imperative": "2.7.5", "get-stdin": "7.0.0", @@ -251,9 +251,9 @@ } }, "@cnakazawa/watch": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.3.tgz", - "integrity": "sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", + "integrity": "sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ==", "dev": true, "requires": { "exec-sh": "^0.3.2", @@ -477,9 +477,9 @@ }, "dependencies": { "@types/yargs": { - "version": "13.0.5", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.5.tgz", - "integrity": "sha512-CF/+sxTO7FOwbIRL4wMv0ZYLCRfMid2HQpzDRyViH7kSpfoAFiMdGqKIxb1PxWfjtQXQhnQuD33lvRHNwr809Q==", + "version": "13.0.8", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.8.tgz", + "integrity": "sha512-XAvHLwG7UQ+8M4caKIH0ZozIOYay5fQkAgyIXegXT9jPtdIGdhga+sUEdAr1CiG46aB+c64xQEYyEzlwWVTNzA==", "dev": true, "requires": { "@types/yargs-parser": "*" @@ -532,9 +532,9 @@ "dev": true }, "@types/babel__core": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.3.tgz", - "integrity": "sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.4.tgz", + "integrity": "sha512-c/5MuRz5HM4aizqL5ViYfW4iEnmfPcfbH4Xa6GgLT21dMc1NGeNnuS6egHheOmP+kCJ9CAzC4pv4SDCWTnRkbg==", "dev": true, "requires": { "@babel/parser": "^7.1.0", @@ -573,9 +573,9 @@ } }, "@types/chai": { - "version": "4.2.7", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.7.tgz", - "integrity": "sha512-luq8meHGYwvky0O7u0eQZdA7B4Wd9owUCqvbw2m3XCrCU8mplYOujMBbvyS547AxJkC+pGnd0Cm15eNxEUNU8g==", + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.9.tgz", + "integrity": "sha512-NeXgZj+MFL4izGqA4sapdYzkzQG+MtGra9vhQ58dnmDY++VgJaRUws+aLVV5zRJCYJl/8s9IjMmhiUw1WsKSmw==", "dev": true }, "@types/chai-as-promised": { @@ -631,9 +631,9 @@ "dev": true }, "@types/istanbul-lib-report": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz", - "integrity": "sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", "dev": true, "requires": { "@types/istanbul-lib-coverage": "*" @@ -693,9 +693,9 @@ "dev": true }, "@types/vscode": { - "version": "1.41.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.41.0.tgz", - "integrity": "sha512-7SfeY5u9jgiELwxyLB3z7l6l/GbN9CqpCQGkcRlB7tKRFBxzbz2PoBfGrLxI1vRfUCIq5+hg5vtDHExwq5j3+A==", + "version": "1.42.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.42.0.tgz", + "integrity": "sha512-ds6TceMsh77Fs0Mq0Vap6Y72JbGWB8Bay4DrnJlf5d9ui2RSe1wis13oQm+XhguOeH1HUfLGzaDAoupTUtgabw==", "dev": true }, "@types/yargs": { @@ -755,12 +755,12 @@ } }, "ajv": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", - "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", + "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", "dev": true, "requires": { - "fast-deep-equal": "^2.0.1", + "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" @@ -1340,9 +1340,9 @@ }, "dependencies": { "readable-stream": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", - "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -1618,9 +1618,9 @@ } }, "chownr": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", - "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true }, "ci-info": { @@ -2083,9 +2083,9 @@ } }, "deep-extend": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", - "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true }, "deep-is": { @@ -2353,9 +2353,9 @@ } }, "es-abstract": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.0.tgz", - "integrity": "sha512-yYkE07YF+6SIBmg1MsJ9dlub5L48Ek7X0qz+c/CPCHS9EBXfESorzng4cJQjJW5/pB6vDF41u7F8vUhLVDqIug==", + "version": "1.17.4", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz", + "integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", @@ -2447,24 +2447,16 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "escodegen": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.12.1.tgz", - "integrity": "sha512-Q8t2YZ+0e0pc7NRVj3B4tSQ9rim1oi4Fh46k2xhJ2qOiEwhQfdjyEQddWdj7ZFaKmU+5104vn1qrcjEPWq+bgQ==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.1.tgz", + "integrity": "sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==", "dev": true, "requires": { - "esprima": "^3.1.3", + "esprima": "^4.0.1", "estraverse": "^4.2.0", "esutils": "^2.0.2", "optionator": "^0.8.1", "source-map": "~0.6.1" - }, - "dependencies": { - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - } } }, "esprima": { @@ -2743,9 +2735,9 @@ } }, "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", "dev": true }, "fast-json-stable-stringify": { @@ -2956,7 +2948,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -2977,12 +2970,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2997,17 +2992,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3124,7 +3122,8 @@ "inherits": { "version": "2.0.4", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3136,6 +3135,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3150,6 +3150,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3157,12 +3158,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.9.0", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3181,6 +3184,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3270,7 +3274,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3282,6 +3287,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3367,7 +3373,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3403,6 +3410,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3422,6 +3430,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3465,12 +3474,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -4149,9 +4160,9 @@ }, "dependencies": { "readable-stream": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -5149,9 +5160,9 @@ }, "dependencies": { "@types/yargs": { - "version": "13.0.5", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.5.tgz", - "integrity": "sha512-CF/+sxTO7FOwbIRL4wMv0ZYLCRfMid2HQpzDRyViH7kSpfoAFiMdGqKIxb1PxWfjtQXQhnQuD33lvRHNwr809Q==", + "version": "13.0.8", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.8.tgz", + "integrity": "sha512-XAvHLwG7UQ+8M4caKIH0ZozIOYay5fQkAgyIXegXT9jPtdIGdhga+sUEdAr1CiG46aB+c64xQEYyEzlwWVTNzA==", "dev": true, "requires": { "@types/yargs-parser": "*" @@ -5375,9 +5386,9 @@ }, "dependencies": { "@types/yargs": { - "version": "13.0.5", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.5.tgz", - "integrity": "sha512-CF/+sxTO7FOwbIRL4wMv0ZYLCRfMid2HQpzDRyViH7kSpfoAFiMdGqKIxb1PxWfjtQXQhnQuD33lvRHNwr809Q==", + "version": "13.0.8", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.8.tgz", + "integrity": "sha512-XAvHLwG7UQ+8M4caKIH0ZozIOYay5fQkAgyIXegXT9jPtdIGdhga+sUEdAr1CiG46aB+c64xQEYyEzlwWVTNzA==", "dev": true, "requires": { "@types/yargs-parser": "*" @@ -5422,12 +5433,12 @@ } }, "js2xmlparser": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.0.tgz", - "integrity": "sha512-WuNgdZOXVmBk5kUPMcTcVUpbGRzLfNkv7+7APq7WiDihpXVKrgxo6wwRpRl9OQeEBgKCVk9mR7RbzrnNWC8oBw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.1.tgz", + "integrity": "sha512-KrPTolcw6RocpYjdC7pL7v62e55q7qOMHvLX1UCLc5AAS8qeJ6nukarEJAF2KL2PZxlbGueEbINqZR2bDe/gUw==", "dev": true, "requires": { - "xmlcreate": "^2.0.0" + "xmlcreate": "^2.0.3" } }, "jsbn": { @@ -5591,9 +5602,9 @@ "dev": true }, "keytar": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/keytar/-/keytar-5.1.0.tgz", - "integrity": "sha512-SptCrRDqLbTeOMB2Z9UmVOS+OKguIrMft+EUaCB8xJPiFMjy6Jnmjgv/LA0rg1ENgLelzwSsC5PSQXF0uoqNDQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/keytar/-/keytar-5.2.0.tgz", + "integrity": "sha512-vsIX6n2BgTwzbKOSPIiJ8YduwHlPEE/G5dkmZWXaQK9qiGZMQyhxlFA4O6vrvM5fsXTMgUOrODYAqgpfNSRLDw==", "dev": true, "requires": { "nan": "2.14.0", @@ -5601,9 +5612,9 @@ } }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, "klaw": { @@ -5929,6 +5940,12 @@ "rc": "~1.2.7" }, "dependencies": { + "deep-extend": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", + "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", + "dev": true + }, "get-stdin": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", @@ -6064,9 +6081,9 @@ "dev": true }, "mimic-response": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.0.0.tgz", - "integrity": "sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", + "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", "dev": true }, "minimatch": { @@ -6289,9 +6306,9 @@ } }, "node-abi": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.13.0.tgz", - "integrity": "sha512-9HrZGFVTR5SOu3PZAnAY2hLO36aW1wmA+FDsVkr85BTST32TLCA1H/AEcatVRAsWLyXS3bqUDYCAjq5/QGuSTA==", + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.15.0.tgz", + "integrity": "sha512-FeLpTS0F39U7hHZU1srAK4Vx+5AHNVOTP+hxBNQknR/54laTHSFIJkDWDqiquY1LeLUgTfPN7sLPhMubx0PLAg==", "dev": true, "requires": { "semver": "^5.4.1" @@ -7066,13 +7083,13 @@ "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=" }, "prompts": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.0.tgz", - "integrity": "sha512-NfbbPPg/74fT7wk2XYQ7hAIp9zJyZp5Fu19iRbORqqy1BhtrkZ0fPafBU+7bmn8ie69DpT0R6QpJIN2oisYjJg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.1.tgz", + "integrity": "sha512-qIP2lQyCwYbdzcqHIUi2HAxiWixhoM9OdLCWf8txXsapC/X9YdsCoeyRIXE/GP+Q0J37Q7+XN/MFqbUa7IzXNA==", "dev": true, "requires": { "kleur": "^3.0.3", - "sisteransi": "^1.0.3" + "sisteransi": "^1.0.4" } }, "psl": { @@ -7132,12 +7149,6 @@ "strip-json-comments": "~2.0.1" }, "dependencies": { - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true - }, "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", @@ -7319,9 +7330,9 @@ } }, "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "dev": true, "requires": { "aws-sign2": "~0.7.0", @@ -7331,7 +7342,7 @@ "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", - "har-validator": "~5.1.0", + "har-validator": "~5.1.3", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", @@ -7341,27 +7352,9 @@ "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", + "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "dev": true, - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - } - } } }, "request-promise-core": { @@ -7410,9 +7403,9 @@ } }, "resolve": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.2.tgz", - "integrity": "sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ==", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", + "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -8195,9 +8188,9 @@ }, "dependencies": { "readable-stream": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", - "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -8376,6 +8369,15 @@ "next-tick": "1" } }, + "tmp": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", + "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } + }, "tmpl": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", @@ -8640,9 +8642,9 @@ "dev": true }, "typescript": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", - "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", + "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", "dev": true }, "uc.micro": { @@ -8802,19 +8804,21 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", + "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", "dev": true, "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.2", + "has-symbols": "^1.0.1", + "object.getownpropertydescriptors": "^2.1.0" } }, "uuid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", - "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "dev": true }, "v8flags": { @@ -8908,9 +8912,9 @@ } }, "vsce": { - "version": "1.71.0", - "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.71.0.tgz", - "integrity": "sha512-7k+LPC4oJYPyyxs0a5nh4A8CleQ6+2EMPiAiX/bDyN+PmwJFm2FFPqLRxdIsIWfFnkW4ZMQBf10+W62dCRd9kQ==", + "version": "1.73.0", + "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.73.0.tgz", + "integrity": "sha512-6W37Ebbkj3uF3WhT+SCfRtsneRQEFcGvf/XYz+b6OAgDCj4gPurWyDVrqw/HLsbP1WflGIyUfVZ8t5M7kQp6Uw==", "dev": true, "requires": { "azure-devops-node-api": "^7.2.0", @@ -8933,17 +8937,6 @@ "url-join": "^1.1.0", "yauzl": "^2.3.1", "yazl": "^2.2.2" - }, - "dependencies": { - "tmp": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", - "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.1" - } - } } }, "vscode": { @@ -9301,9 +9294,9 @@ "dev": true }, "xmlcreate": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.1.tgz", - "integrity": "sha512-MjGsXhKG8YjTKrDCXseFo3ClbMGvUD4en29H2Cev1dv4P/chlpw6KdYmlCWDkhosBVKRDjM836+3e3pm1cBNJA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.3.tgz", + "integrity": "sha512-HgS+X6zAztGa9zIK3Y3LXuJes33Lz9x+YyTxgrkIdabu2vqcGOWwdfCpf1hWLRrd553wd4QCDf6BBO6FfdsRiQ==", "dev": true }, "xtend": { From 50af071d8e4ca4bf4769b796d31d5504a2a254f5 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 18 Feb 2020 10:48:30 -0500 Subject: [PATCH 3/3] Fix unit tests and add check that profiles folder gets initialized Signed-off-by: Timothy Johnson --- __tests__/__unit__/Profiles.unit.test.ts | 5 --- __tests__/__unit__/extension.unit.test.ts | 53 ++++++++++------------- src/Profiles.ts | 4 -- src/extension.ts | 9 +++- 4 files changed, 32 insertions(+), 39 deletions(-) diff --git a/__tests__/__unit__/Profiles.unit.test.ts b/__tests__/__unit__/Profiles.unit.test.ts index 6e63cd9f7c..db4039d189 100644 --- a/__tests__/__unit__/Profiles.unit.test.ts +++ b/__tests__/__unit__/Profiles.unit.test.ts @@ -55,17 +55,12 @@ describe("Profile class unit tests", () => { const createInputBox = jest.fn(); const showQuickPick = jest.fn(); const showErrorMessage = jest.fn(); -// const cliHome = jest.fn().mockReturnValue(homedir); -// const icInstance = jest.fn(); Object.defineProperty(vscode.window, "showInformationMessage", { value: showInformationMessage }); Object.defineProperty(vscode.window, "showErrorMessage", { value: showErrorMessage }); Object.defineProperty(vscode.window, "showInputBox", { value: showInputBox }); Object.defineProperty(vscode.window, "createInputBox", { value: createInputBox }); Object.defineProperty(vscode.window, "showQuickPick", { value: showQuickPick }); -// Object.defineProperty(brtimperative, "ImperativeConfig", { value: ImperativeConfig }); -// Object.defineProperty(ImperativeConfig, "instance", { value: icInstance }); -// Object.defineProperty(icInstance, "cliHome", { value: cliHome }); beforeEach(() => { mockJSONParse.mockReturnValue({ diff --git a/__tests__/__unit__/extension.unit.test.ts b/__tests__/__unit__/extension.unit.test.ts index 4b9799dc48..eb9a5bb4d7 100644 --- a/__tests__/__unit__/extension.unit.test.ts +++ b/__tests__/__unit__/extension.unit.test.ts @@ -94,7 +94,7 @@ describe("Extension Unit Tests", () => { const profileOne: brtimperative.IProfileLoaded = { name: "sestest", profile: { - user:undefined, + user: undefined, password: undefined }, type: "zosmf", @@ -104,9 +104,11 @@ describe("Extension Unit Tests", () => { let mockLoadNamedProfile = jest.fn(); mockLoadNamedProfile.mockReturnValue(profileOne); const profileOps = { - allProfiles: [profileOne, {name: "secondName"}], - defaultProfile: profileOne, - loadNamedProfile: mockLoadNamedProfile + allProfiles: [{name: "firstName"}, {name: "secondName"}], + defaultProfile: {name: "firstName"}, + getDefaultProfile: mockLoadNamedProfile, + loadNamedProfile: mockLoadNamedProfile, + usesSecurity: jest.fn().mockReturnValue(true) }; Object.defineProperty(profileLoader.Profiles, "createInstance", { value: jest.fn(() => { @@ -256,11 +258,13 @@ describe("Extension Unit Tests", () => { }; const cliHome = jest.fn().mockReturnValue(path.join(os.homedir(), ".zowe")); const icInstance = jest.fn(); - const ImperativeConfig =jest.fn(); + const ImperativeConfig = jest.fn(); const clipboard = { writeText: jest.fn().mockImplementation((value) => mockClipboardData = value), readText: jest.fn().mockImplementation(() => mockClipboardData), }; + const initialize = jest.fn(); + const getImperativeConfig = jest.fn().mockReturnValue({profiles: []}); const ProgressLocation = jest.fn().mockImplementation(() => { return { @@ -356,15 +360,6 @@ describe("Extension Unit Tests", () => { testJobsTree.mSessionNodes.push(jobNode); mockLoadNamedProfile = jest.fn(); - Object.defineProperty(profileLoader.Profiles, "createInstance", { - value: jest.fn(() => { - return { - allProfiles: [{name: "firstName"}, {name: "secondName"}], - defaultProfile: {name: "firstName"}, - usesSecurity: jest.fn().mockReturnValue(true) - }; - }) - }); Object.defineProperty(utils, "concatChildNodes", {value: concatChildNodes}); Object.defineProperty(fs, "mkdirSync", {value: mkdirSync}); Object.defineProperty(brtimperative, "CliProfileManager", {value: CliProfileManager}); @@ -443,21 +438,14 @@ describe("Extension Unit Tests", () => { Object.defineProperty(Copy, "dataSet", { value: copyDataSet }); Object.defineProperty(vscode.env, "clipboard", { value: clipboard }); Object.defineProperty(Rename, "dataSetMember", { value: renameDataSetMember }); + Object.defineProperty(CliProfileManager, "initialize", { value: initialize }); + Object.defineProperty(brightside, "getImperativeConfig", { value: getImperativeConfig }); + Object.defineProperty(brtimperative, "ImperativeConfig", { value: ImperativeConfig }); + Object.defineProperty(ImperativeConfig, "instance", { value: icInstance }); + Object.defineProperty(icInstance, "cliHome", { get: cliHome }); beforeEach(() => { mockLoadNamedProfile.mockReturnValue(profileOne); - Object.defineProperty(profileLoader.Profiles, "getInstance", { - value: jest.fn(() => { - return { - allProfiles: [{name: "firstName"}, {name: "secondName"}], - defaultProfile: {name: "firstName"}, - getDefaultProfile: mockLoadNamedProfile, - loadNamedProfile: mockLoadNamedProfile, - usesSecurity: true - - }; - }) - }); withProgress.mockImplementation((progLocation, callback) => { return callback(); }); @@ -473,6 +461,7 @@ describe("Extension Unit Tests", () => { existsSync.mockReturnValueOnce(true); existsSync.mockReturnValueOnce(true); existsSync.mockReturnValueOnce(false); + existsSync.mockReturnValueOnce(true); readdirSync.mockReturnValueOnce(["firstFile.txt", "secondFile.txt", "firstDir"]); isFile.mockReturnValueOnce(true); readdirSync.mockReturnValueOnce(["thirdFile.txt"]); @@ -570,7 +559,7 @@ describe("Extension Unit Tests", () => { }; }); Object.defineProperty(vscode, "ConfigurationTarget", {value: enums}); -// tslint:disable-next-line: no-object-literal-type-assertion + // tslint:disable-next-line: no-object-literal-type-assertion const extensionMock = jest.fn(() => ({ subscriptions: [], extensionPath: path.join(__dirname, "..") @@ -689,7 +678,7 @@ describe("Extension Unit Tests", () => { expect(actualCommands).toEqual(expectedCommands); expect(onDidSaveTextDocument.mock.calls.length).toBe(1); // tslint:disable-next-line: no-magic-numbers - expect(existsSync.mock.calls.length).toBe(3); + expect(existsSync.mock.calls.length).toBe(4); expect(existsSync.mock.calls[0][0]).toBe(extension.BRIGHTTEMPFOLDER); expect(readdirSync.mock.calls.length).toBe(1); expect(readdirSync.mock.calls[0][0]).toBe(extension.BRIGHTTEMPFOLDER); @@ -698,6 +687,11 @@ describe("Extension Unit Tests", () => { expect(unlinkSync.mock.calls[1][0]).toBe(path.join(extension.BRIGHTTEMPFOLDER + "/secondFile.txt")); expect(rmdirSync.mock.calls.length).toBe(1); expect(rmdirSync.mock.calls[0][0]).toBe(extension.BRIGHTTEMPFOLDER); + expect(initialize.mock.calls.length).toBe(1); + expect(initialize.mock.calls[0][0]).toStrictEqual({ + configuration: [], + profileRootDirectory: path.join(cliHome(), "profiles") + }); existsSync.mockReset(); readdirSync.mockReset(); @@ -741,10 +735,11 @@ describe("Extension Unit Tests", () => { }) }); existsSync.mockReturnValueOnce(true); + existsSync.mockReturnValueOnce(true); await extension.activate(mock); - expect(existsSync.mock.calls.length).toBe(1); + expect(existsSync.mock.calls.length).toBe(2); expect(readdirSync.mock.calls.length).toBe(0); existsSync.mockReset(); diff --git a/src/Profiles.ts b/src/Profiles.ts index 775e9aa613..5c3cfbc6cb 100644 --- a/src/Profiles.ts +++ b/src/Profiles.ts @@ -40,10 +40,6 @@ let IConnection: { export class Profiles { // Processing stops if there are no profiles detected public static async createInstance(log: Logger): Promise { - await CliProfileManager.initialize({ - configuration: zowe.getImperativeConfig().profiles, - profileRootDirectory: path.join(getZoweDir(), "profiles"), - }); Profiles.loader = new Profiles(log); await Profiles.loader.refresh(); return Profiles.loader; diff --git a/src/extension.ts b/src/extension.ts index 8dff8493fb..94d44ade87 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -18,7 +18,8 @@ import * as vscode from "vscode"; import { IZoweTreeNode, IZoweJobTreeNode, IZoweUSSTreeNode, IZoweDatasetTreeNode } from "./api/IZoweTreeNode"; import { ZoweDatasetNode } from "./ZoweDatasetNode"; import { IZoweTree } from "./api/IZoweTree"; -import { Logger, TextUtils, IProfileLoaded, ImperativeConfig, Session, CredentialManagerFactory, ImperativeError, DefaultCredentialManager } from "@brightside/imperative"; +import { Logger, TextUtils, IProfileLoaded, ImperativeConfig, Session, CredentialManagerFactory, + ImperativeError, DefaultCredentialManager, CliProfileManager } from "@brightside/imperative"; import { DatasetTree, createDatasetTree } from "./DatasetTree"; import { ZosJobsProvider, createJobsTree } from "./ZosJobsProvider"; import { Job } from "./ZoweJobNode"; @@ -143,6 +144,12 @@ export async function activate(context: vscode.ExtensionContext): Promise