Skip to content

Commit

Permalink
fix: keep original error and fail the diagnostic test
Browse files Browse the repository at this point in the history
* fix: keep original error and fail the diagnostic test

* fix: update test for code changes

* chore: dedupe lockfile

---------

Co-authored-by: mshanemc <[email protected]>
  • Loading branch information
shetzel and mshanemc authored May 17, 2024
1 parent 78386df commit 6aeaeff
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 39 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/org/login/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ export default class LoginWeb extends SfCommand<AuthFields> {
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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const cryptoVersionTest = async (doctor: SfDoctor): Promise<void> => {
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 });
Expand Down
6 changes: 3 additions & 3 deletions test/hooks/diagnostics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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',
});
});

Expand Down Expand Up @@ -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');
Expand Down
39 changes: 7 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1445,10 +1445,10 @@
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":
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==
"@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==
dependencies:
"@jsforce/jsforce-node" "^3.2.0"
"@salesforce/kit" "^3.1.1"
Expand Down Expand Up @@ -6956,16 +6956,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==
Expand Down Expand Up @@ -7024,14 +7015,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"

[email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", [email protected], 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==
Expand Down Expand Up @@ -7579,7 +7563,7 @@ [email protected]:
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==
Expand All @@ -7597,15 +7581,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"
Expand Down

0 comments on commit 6aeaeff

Please sign in to comment.