From 9d0b0b83054c7b1d59becfb74432b9a129819ec9 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Thu, 30 May 2024 13:03:56 -0600 Subject: [PATCH 1/3] chore: fix salesforcedx/linked plugins test name/output --- src/diagnostics.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/diagnostics.ts b/src/diagnostics.ts index 68f5807f..44faf351 100644 --- a/src/diagnostics.ts +++ b/src/diagnostics.ts @@ -110,7 +110,6 @@ export class Diagnostics { * to uninstall it if there. */ public async salesforceDxPluginCheck(): Promise { - const testName = 'salesforcedx plugin not installed'; let status: DiagnosticStatus['status'] = 'pass'; const plugins = Object.keys(this.config.versionDetails.pluginVersions ?? {}); @@ -119,7 +118,10 @@ export class Diagnostics { const bin = this.diagnosis.cliConfig.bin; this.doctor.addSuggestion(messages.getMessage('salesforceDxPluginDetected', [bin])); } - await Lifecycle.getInstance().emit('Doctor:diagnostic', { testName, status }); + await Lifecycle.getInstance().emit('Doctor:diagnostic', { + testName: status === 'pass' ? 'salesforcedx plugin isn’t installed' : 'salesforcedx plugin is installed', + status, + }); } public async networkCheck(): Promise { @@ -165,7 +167,6 @@ export class Diagnostics { * Checks and warns if any plugins are linked. */ public async linkedPluginCheck(): Promise { - const testName = 'no linked plugins'; let status: DiagnosticStatus['status'] = 'pass'; const plugins = this.config.getPluginsList(); @@ -174,6 +175,9 @@ export class Diagnostics { status = 'fail'; this.doctor.addSuggestion(messages.getMessage('linkedPluginWarning', [lp.name])); }); - await Lifecycle.getInstance().emit('Doctor:diagnostic', { testName, status }); + await Lifecycle.getInstance().emit('Doctor:diagnostic', { + testName: status === 'pass' ? "you don't have any linked plugins" : 'you have at least one linked plugin', + status, + }); } } From c1e32f2fb14e523741a4af3bd12be2130fe2499d Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Thu, 30 May 2024 14:16:28 -0600 Subject: [PATCH 2/3] fix: add plugin version keyword to satisfy issue validator --- src/commands/doctor.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/commands/doctor.ts b/src/commands/doctor.ts index 66fca6cd..b4f150ff 100644 --- a/src/commands/doctor.ts +++ b/src/commands/doctor.ts @@ -155,7 +155,10 @@ export default class Doctor extends SfCommand { private generateIssueMarkdown(body: string, diagnosis: SfDoctorDiagnosis): string { const info = ` \`\`\` +CLI: ${diagnosis.cliConfig.userAgent} + +Plugin Version: ${diagnosis.versionDetail.pluginVersions.join(EOL)} \`\`\` ${ From 81a1948d51e8a430ba99fd5ed7ba827e049a6f7a Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Thu, 30 May 2024 14:19:59 -0600 Subject: [PATCH 3/3] test: update UT assertions --- test/diagnostics.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/diagnostics.test.ts b/test/diagnostics.test.ts index 57560209..5654ccd8 100644 --- a/test/diagnostics.test.ts +++ b/test/diagnostics.test.ts @@ -239,7 +239,7 @@ describe('Diagnostics', () => { expect(drAddSuggestionSpy.called).to.be.false; expect(lifecycleEmitSpy.called).to.be.true; expect(lifecycleEmitSpy.args[0][1]).to.deep.equal({ - testName: 'salesforcedx plugin not installed', + testName: 'salesforcedx plugin isn’t installed', status: 'pass', }); }); @@ -257,7 +257,7 @@ describe('Diagnostics', () => { expect(drAddSuggestionSpy.called).to.be.true; expect(lifecycleEmitSpy.called).to.be.true; expect(lifecycleEmitSpy.args[0][1]).to.deep.equal({ - testName: 'salesforcedx plugin not installed', + testName: 'salesforcedx plugin is installed', status: 'fail', }); }); @@ -312,7 +312,7 @@ describe('Diagnostics', () => { expect(drAddSuggestionSpy.called).to.be.false; expect(lifecycleEmitSpy.called).to.be.true; expect(lifecycleEmitSpy.args[0][1]).to.deep.equal({ - testName: 'no linked plugins', + testName: "you don't have any linked plugins", status: 'pass', }); }); @@ -344,7 +344,7 @@ describe('Diagnostics', () => { expect(drAddSuggestionSpy.called).to.be.true; expect(lifecycleEmitSpy.called).to.be.true; expect(lifecycleEmitSpy.args[0][1]).to.deep.equal({ - testName: 'no linked plugins', + testName: 'you have at least one linked plugin', status: 'fail', }); });