Skip to content

Commit 6aeaeff

Browse files
shetzelmshanemc
andauthored
fix: keep original error and fail the diagnostic test
* fix: keep original error and fail the diagnostic test * fix: update test for code changes * chore: dedupe lockfile --------- Co-authored-by: mshanemc <shane.mclaughlin@salesforce.com>
1 parent 78386df commit 6aeaeff

File tree

5 files changed

+14
-39
lines changed

5 files changed

+14
-39
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@inquirer/checkbox": "^1.5.2",
99
"@inquirer/select": "^1.3.3",
1010
"@oclif/core": "^3.26.5",
11-
"@salesforce/core": "^7.3.5",
11+
"@salesforce/core": "^7.3.8",
1212
"@salesforce/kit": "^3.1.1",
1313
"@salesforce/plugin-info": "^3.2.7",
1414
"@salesforce/sf-plugins-core": "^9.0.7",

src/commands/org/login/web.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ export default class LoginWeb extends SfCommand<AuthFields> {
102102
return fields;
103103
} catch (err) {
104104
Logger.childFromRoot('LoginWebCommand').debug(err);
105-
if (err instanceof Error && err.name === 'AuthCodeExchangeError') {
106-
throw new SfError(messages.getMessage('invalidClientId', [err.message]), undefined, undefined, err);
105+
if (err instanceof SfError && err.name === 'AuthCodeExchangeError') {
106+
err.message = messages.getMessage('invalidClientId', [err.message]);
107107
}
108108
throw err;
109109
}

src/hooks/diagnostics.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const cryptoVersionTest = async (doctor: SfDoctor): Promise<void> => {
100100
const testName1 = `[${pluginName}] CLI supports v2 crypto`;
101101
let status1 = 'pass';
102102
if (!sfCryptoV2Support) {
103-
status1 = 'warn';
103+
status1 = 'fail';
104104
doctor.addSuggestion(messages.getMessage('sfCryptoV2Support'));
105105
}
106106
void Lifecycle.getInstance().emit('Doctor:diagnostic', { testName: testName1, status: status1 });

test/hooks/diagnostics.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('Doctor diagnostics', () => {
6464
sandbox.restore();
6565
});
6666

67-
it('should warn when CLI does not support v2 crypto', async () => {
67+
it('should fail when CLI does not support v2 crypto', async () => {
6868
sandbox.stub(util, 'promisify').returns(() => ({ stdout: JSON.stringify([{ version: '6.5.0' }]) }));
6969
process.env.SF_USE_GENERIC_UNIX_KEYCHAIN = 'false';
7070

@@ -86,7 +86,7 @@ describe('Doctor diagnostics', () => {
8686
expect(lifecycleEmitStub.args[0][0]).to.equal('Doctor:diagnostic');
8787
expect(lifecycleEmitStub.args[0][1]).to.deep.equal({
8888
testName: `[${pluginName}] CLI supports v2 crypto`,
89-
status: 'warn',
89+
status: 'fail',
9090
});
9191
});
9292

@@ -135,7 +135,7 @@ describe('Doctor diagnostics', () => {
135135
expect(lifecycleEmitStub.args[0][0]).to.equal('Doctor:diagnostic');
136136
expect(lifecycleEmitStub.args[0][1]).to.deep.equal({
137137
testName: `[${pluginName}] CLI supports v2 crypto`,
138-
status: 'warn',
138+
status: 'fail',
139139
});
140140
expect(addSuggestionStub.args[1][0]).to.equal(messages.getMessage('sfCryptoV2Unstable'));
141141
expect(lifecycleEmitStub.args[1][0]).to.equal('Doctor:diagnostic');

yarn.lock

+7-32
Original file line numberDiff line numberDiff line change
@@ -1445,10 +1445,10 @@
14451445
strip-ansi "6.0.1"
14461446
ts-retry-promise "^0.8.0"
14471447

1448-
"@salesforce/core@^7.3.1", "@salesforce/core@^7.3.3", "@salesforce/core@^7.3.4", "@salesforce/core@^7.3.5":
1449-
version "7.3.6"
1450-
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.6.tgz#b2769abf3d8cee6fef26741dd9bdbe977a497023"
1451-
integrity sha512-LngaY4GxixZ7X5oPGa00NdRzpqTXC8jPOQ/H+oFNiZb8nhMfYTBsQob258z33sIBf+G/5RZOJgX10Z+teJzt6A==
1448+
"@salesforce/core@^7.3.1", "@salesforce/core@^7.3.3", "@salesforce/core@^7.3.4", "@salesforce/core@^7.3.8":
1449+
version "7.3.8"
1450+
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.8.tgz#8a646b5321f08c0fb4d22e2fa8b1d60b3a20df9b"
1451+
integrity sha512-VWhXHfjwjtC3pJWYp8wt5/fnNQ5tK61ovMG5eteXzVD2oFd7og1f6YjwuAzoYIZK7kYWWv7KJfGtCsPs7Zw+Ww==
14521452
dependencies:
14531453
"@jsforce/jsforce-node" "^3.2.0"
14541454
"@salesforce/kit" "^3.1.1"
@@ -6956,16 +6956,7 @@ srcset@^5.0.0:
69566956
resolved "https://registry.yarnpkg.com/srcset/-/srcset-5.0.1.tgz#e660a728f195419e4afa95121099bc9efb7a1e36"
69576957
integrity sha512-/P1UYbGfJVlxZag7aABNRrulEXAwCSDo7fklafOQrantuPTDmYgijJMks2zusPCVzgW9+4P69mq7w6pYuZpgxw==
69586958

6959-
"string-width-cjs@npm:string-width@^4.2.0":
6960-
version "4.2.3"
6961-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
6962-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
6963-
dependencies:
6964-
emoji-regex "^8.0.0"
6965-
is-fullwidth-code-point "^3.0.0"
6966-
strip-ansi "^6.0.1"
6967-
6968-
string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
6959+
"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:
69696960
version "4.2.3"
69706961
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
69716962
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -7024,14 +7015,7 @@ string_decoder@~1.1.1:
70247015
dependencies:
70257016
safe-buffer "~5.1.0"
70267017

7027-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
7028-
version "6.0.1"
7029-
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
7030-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
7031-
dependencies:
7032-
ansi-regex "^5.0.1"
7033-
7034-
strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
7018+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
70357019
version "6.0.1"
70367020
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
70377021
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -7579,7 +7563,7 @@ workerpool@6.2.1:
75797563
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
75807564
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
75817565

7582-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
7566+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
75837567
version "7.0.0"
75847568
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
75857569
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -7597,15 +7581,6 @@ wrap-ansi@^6.2.0:
75977581
string-width "^4.1.0"
75987582
strip-ansi "^6.0.0"
75997583

7600-
wrap-ansi@^7.0.0:
7601-
version "7.0.0"
7602-
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
7603-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
7604-
dependencies:
7605-
ansi-styles "^4.0.0"
7606-
string-width "^4.1.0"
7607-
strip-ansi "^6.0.0"
7608-
76097584
wrap-ansi@^8.1.0:
76107585
version "8.1.0"
76117586
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)