From d7e951f007e211ff8b14371d12091dd87655de08 Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Thu, 16 May 2024 16:04:48 -0600 Subject: [PATCH 1/3] fix: keep original error and fail the diagnostic test --- package.json | 2 +- src/commands/org/login/web.ts | 4 +-- src/hooks/diagnostics.ts | 2 +- yarn.lock | 56 +++++++++++++++++------------------ 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 38dfb099..6c29c4a5 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "@inquirer/checkbox": "^1.5.2", "@inquirer/select": "^1.3.3", "@oclif/core": "^3.26.5", - "@salesforce/core": "^7.3.5", + "@salesforce/core": "^7.3.8", "@salesforce/kit": "^3.1.1", "@salesforce/plugin-info": "^3.2.7", "@salesforce/sf-plugins-core": "^9.0.7", diff --git a/src/commands/org/login/web.ts b/src/commands/org/login/web.ts index 0a0b203a..509fdc24 100644 --- a/src/commands/org/login/web.ts +++ b/src/commands/org/login/web.ts @@ -102,8 +102,8 @@ export default class LoginWeb extends SfCommand { return fields; } catch (err) { Logger.childFromRoot('LoginWebCommand').debug(err); - if (err instanceof Error && err.name === 'AuthCodeExchangeError') { - throw new SfError(messages.getMessage('invalidClientId', [err.message]), undefined, undefined, err); + if (err instanceof SfError && err.name === 'AuthCodeExchangeError') { + err.message = messages.getMessage('invalidClientId', [err.message]); } throw err; } diff --git a/src/hooks/diagnostics.ts b/src/hooks/diagnostics.ts index b63d5172..95879d39 100644 --- a/src/hooks/diagnostics.ts +++ b/src/hooks/diagnostics.ts @@ -100,7 +100,7 @@ const cryptoVersionTest = async (doctor: SfDoctor): Promise => { const testName1 = `[${pluginName}] CLI supports v2 crypto`; let status1 = 'pass'; if (!sfCryptoV2Support) { - status1 = 'warn'; + status1 = 'fail'; doctor.addSuggestion(messages.getMessage('sfCryptoV2Support')); } void Lifecycle.getInstance().emit('Doctor:diagnostic', { testName: testName1, status: status1 }); diff --git a/yarn.lock b/yarn.lock index af3b8313..eab2baf1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1445,7 +1445,7 @@ strip-ansi "6.0.1" ts-retry-promise "^0.8.0" -"@salesforce/core@^7.3.1", "@salesforce/core@^7.3.3", "@salesforce/core@^7.3.4", "@salesforce/core@^7.3.5": +"@salesforce/core@^7.3.1", "@salesforce/core@^7.3.3", "@salesforce/core@^7.3.4": version "7.3.6" resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.6.tgz#b2769abf3d8cee6fef26741dd9bdbe977a497023" integrity sha512-LngaY4GxixZ7X5oPGa00NdRzpqTXC8jPOQ/H+oFNiZb8nhMfYTBsQob258z33sIBf+G/5RZOJgX10Z+teJzt6A== @@ -1468,6 +1468,29 @@ semver "^7.6.2" ts-retry-promise "^0.7.1" +"@salesforce/core@^7.3.8": + version "7.3.8" + resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.8.tgz#8a646b5321f08c0fb4d22e2fa8b1d60b3a20df9b" + integrity sha512-VWhXHfjwjtC3pJWYp8wt5/fnNQ5tK61ovMG5eteXzVD2oFd7og1f6YjwuAzoYIZK7kYWWv7KJfGtCsPs7Zw+Ww== + dependencies: + "@jsforce/jsforce-node" "^3.2.0" + "@salesforce/kit" "^3.1.1" + "@salesforce/schemas" "^1.7.0" + "@salesforce/ts-types" "^2.0.9" + ajv "^8.13.0" + change-case "^4.1.2" + faye "^1.4.0" + form-data "^4.0.0" + js2xmlparser "^4.0.1" + jsonwebtoken "9.0.2" + jszip "3.10.1" + pino "^8.21.0" + pino-abstract-transport "^1.1.0" + pino-pretty "^10.3.1" + proper-lockfile "^4.1.2" + semver "^7.6.2" + ts-retry-promise "^0.7.1" + "@salesforce/dev-config@^4.1.0": version "4.1.0" resolved "https://registry.yarnpkg.com/@salesforce/dev-config/-/dev-config-4.1.0.tgz#e529576466d074e7a5f1441236510fef123da01e" @@ -6956,16 +6979,7 @@ srcset@^5.0.0: resolved "https://registry.yarnpkg.com/srcset/-/srcset-5.0.1.tgz#e660a728f195419e4afa95121099bc9efb7a1e36" integrity sha512-/P1UYbGfJVlxZag7aABNRrulEXAwCSDo7fklafOQrantuPTDmYgijJMks2zusPCVzgW9+4P69mq7w6pYuZpgxw== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -7024,14 +7038,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -7579,7 +7586,7 @@ workerpool@6.2.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -7597,15 +7604,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From 98218e5234ba44b70600f1014949895047e0f41f Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Fri, 17 May 2024 09:28:15 -0600 Subject: [PATCH 2/3] fix: update test for code changes --- test/hooks/diagnostics.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/hooks/diagnostics.test.ts b/test/hooks/diagnostics.test.ts index be8a97cb..bddbeefe 100644 --- a/test/hooks/diagnostics.test.ts +++ b/test/hooks/diagnostics.test.ts @@ -64,7 +64,7 @@ describe('Doctor diagnostics', () => { sandbox.restore(); }); - it('should warn when CLI does not support v2 crypto', async () => { + it('should fail when CLI does not support v2 crypto', async () => { sandbox.stub(util, 'promisify').returns(() => ({ stdout: JSON.stringify([{ version: '6.5.0' }]) })); process.env.SF_USE_GENERIC_UNIX_KEYCHAIN = 'false'; @@ -86,7 +86,7 @@ describe('Doctor diagnostics', () => { expect(lifecycleEmitStub.args[0][0]).to.equal('Doctor:diagnostic'); expect(lifecycleEmitStub.args[0][1]).to.deep.equal({ testName: `[${pluginName}] CLI supports v2 crypto`, - status: 'warn', + status: 'fail', }); }); @@ -135,7 +135,7 @@ describe('Doctor diagnostics', () => { expect(lifecycleEmitStub.args[0][0]).to.equal('Doctor:diagnostic'); expect(lifecycleEmitStub.args[0][1]).to.deep.equal({ testName: `[${pluginName}] CLI supports v2 crypto`, - status: 'warn', + status: 'fail', }); expect(addSuggestionStub.args[1][0]).to.equal(messages.getMessage('sfCryptoV2Unstable')); expect(lifecycleEmitStub.args[1][0]).to.equal('Doctor:diagnostic'); From 5a950a6ee6a5ce8bad1998031b2664c2ad0c4316 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Fri, 17 May 2024 10:46:44 -0500 Subject: [PATCH 3/3] chore: dedupe lockfile --- yarn.lock | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/yarn.lock b/yarn.lock index eab2baf1..ff178595 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1445,30 +1445,7 @@ strip-ansi "6.0.1" ts-retry-promise "^0.8.0" -"@salesforce/core@^7.3.1", "@salesforce/core@^7.3.3", "@salesforce/core@^7.3.4": - version "7.3.6" - resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.6.tgz#b2769abf3d8cee6fef26741dd9bdbe977a497023" - integrity sha512-LngaY4GxixZ7X5oPGa00NdRzpqTXC8jPOQ/H+oFNiZb8nhMfYTBsQob258z33sIBf+G/5RZOJgX10Z+teJzt6A== - dependencies: - "@jsforce/jsforce-node" "^3.2.0" - "@salesforce/kit" "^3.1.1" - "@salesforce/schemas" "^1.7.0" - "@salesforce/ts-types" "^2.0.9" - ajv "^8.13.0" - change-case "^4.1.2" - faye "^1.4.0" - form-data "^4.0.0" - js2xmlparser "^4.0.1" - jsonwebtoken "9.0.2" - jszip "3.10.1" - pino "^8.21.0" - pino-abstract-transport "^1.1.0" - pino-pretty "^10.3.1" - proper-lockfile "^4.1.2" - semver "^7.6.2" - ts-retry-promise "^0.7.1" - -"@salesforce/core@^7.3.8": +"@salesforce/core@^7.3.1", "@salesforce/core@^7.3.3", "@salesforce/core@^7.3.4", "@salesforce/core@^7.3.8": version "7.3.8" resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.8.tgz#8a646b5321f08c0fb4d22e2fa8b1d60b3a20df9b" integrity sha512-VWhXHfjwjtC3pJWYp8wt5/fnNQ5tK61ovMG5eteXzVD2oFd7og1f6YjwuAzoYIZK7kYWWv7KJfGtCsPs7Zw+Ww==