From 8497accecc8c989a83e97eb7bd80d8cc64ab77c6 Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Fri, 27 Jan 2023 15:50:06 -0700 Subject: [PATCH 1/4] chore: lint fixes --- messages/package_version_create.md | 8 ++++++++ src/commands/package/version/create.ts | 27 +++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/messages/package_version_create.md b/messages/package_version_create.md index 68eb752d..8f782895 100644 --- a/messages/package_version_create.md +++ b/messages/package_version_create.md @@ -161,6 +161,14 @@ Language for the package. Specify the language using a language code listed under "Supported Languages" in Salesforce Help. If no language is specified, the language defaults to the language of the Dev Hub user who created the package. +# flags.verbose.summary + +Display verbose command output. + +# flags.verbose.description + +Display verbose command output. When polling for the status of the creation, this will output status and timeout data on a separate line for each poll request, which is useful in CI systems where timeouts can occur with long periods of no output from commands. + # InProgress Package version creation request status is '%s'. Run "%s package:version:create:report -i %s" to query for status. diff --git a/src/commands/package/version/create.ts b/src/commands/package/version/create.ts index 032848c7..9741e79c 100644 --- a/src/commands/package/version/create.ts +++ b/src/commands/package/version/create.ts @@ -172,6 +172,10 @@ export class PackageVersionCreateCommand extends SfCommand { @@ -193,10 +197,15 @@ export class PackageVersionCreateCommand extends SfCommand { if (data.Status !== Package2VersionStatus.success && data.Status !== Package2VersionStatus.error) { - this.spinner.status = messages.getMessage('packageVersionCreateWaitingStatus', [ + const status = messages.getMessage('packageVersionCreateWaitingStatus', [ data.remainingWaitTime.minutes, data.Status, ]); + if (flags.verbose) { + this.log(status); + } else { + this.spinner.status = status; + } } } ); @@ -208,7 +217,13 @@ export class PackageVersionCreateCommand extends SfCommand Date: Fri, 27 Jan 2023 16:33:45 -0700 Subject: [PATCH 2/4] chore: suppressing output in tests --- command-snapshot.json | 1 + test/commands/package/install.test.ts | 118 ++++++++++++------ test/commands/package/packageConvert.test.ts | 31 +++-- .../package/packageVersionCreate.test.ts | 21 ++-- 4 files changed, 109 insertions(+), 62 deletions(-) diff --git a/command-snapshot.json b/command-snapshot.json index 3f03a085..886ac847 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -168,6 +168,7 @@ "target-hub-org", "uninstall-script", "validate-schema", + "verbose", "version-description", "version-name", "version-number", diff --git a/test/commands/package/install.test.ts b/test/commands/package/install.test.ts index d745dcc6..e2a4b706 100644 --- a/test/commands/package/install.test.ts +++ b/test/commands/package/install.test.ts @@ -99,7 +99,11 @@ describe('package:install', () => { let getExternalSitesStub: sinon.SinonStub; let installStub: sinon.SinonStub; let installStatusStub: sinon.SinonStub; - const sandbox = sinon.createSandbox(); + + const stubSpinner = (cmd: Install) => { + $$.SANDBOX.stub(cmd.spinner, 'start'); + $$.SANDBOX.stub(cmd.spinner, 'stop'); + }; before(async () => { await $$.stubAuths(testOrg); @@ -107,13 +111,12 @@ describe('package:install', () => { }); beforeEach(async () => { - uxLogStub = sandbox.stub(SfCommand.prototype, 'log'); - uxWarnStub = sandbox.stub(SfCommand.prototype, 'warn'); + uxLogStub = $$.SANDBOX.stub(SfCommand.prototype, 'log'); + uxWarnStub = $$.SANDBOX.stub(SfCommand.prototype, 'warn'); }); afterEach(() => { $$.restore(); - sandbox.restore(); }); describe('package:install', () => { @@ -134,7 +137,9 @@ describe('package:install', () => { it('should error without required --package param', async () => { try { - await new Install(['-o', testOrg.username], config).run(); + const cmd = new Install(['-o', testOrg.username], config); + stubSpinner(cmd); + await cmd.run(); expect(false, 'Expected required flag error').to.be.true; } catch (err) { const error = err as Error; @@ -145,7 +150,9 @@ describe('package:install', () => { it('should error with org API Version < 36.0', async () => { try { - await new Install(['-p', myPackageVersion04t, '-o', testOrg.username, '--api-version', '33.0'], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-o', testOrg.username, '--api-version', '33.0'], config); + stubSpinner(cmd); + await cmd.run(); expect(false, 'Expected API version too low error').to.be.true; } catch (err) { const error = err as Error; @@ -158,7 +165,9 @@ describe('package:install', () => { installStub = stubMethod($$.SANDBOX, SubscriberPackageVersion.prototype, 'install').resolves(pkgInstallRequest); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const result = await new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxLogStub.calledOnce).to.be.true; const msg = `PackageInstallRequest is currently InProgress. You can continue to query the status using${EOL}sfdx package:install:report -i 0Hf1h0000006sh2CAA -o ${testOrg.username}`; @@ -172,7 +181,9 @@ describe('package:install', () => { error.setData(pkgInstallRequest); installStub = stubMethod($$.SANDBOX, SubscriberPackageVersion.prototype, 'install').throws(error); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const result = await new Install(['-p', myPackageVersion04t, '-u', testOrg.username], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-u', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxLogStub.callCount).to.equal(1); const msg = `PackageInstallRequest is currently InProgress. You can continue to query the status using${EOL}sfdx package:install:report -i 0Hf1h0000006sh2CAA -o ${testOrg.username}`; expect(uxLogStub.args[0][0]).to.equal(msg); @@ -187,7 +198,9 @@ describe('package:install', () => { error.setData(pkgInstallRequest); installStub = stubMethod($$.SANDBOX, SubscriberPackageVersion.prototype, 'install').throws(error); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const result = await new Install(['-p', myPackageVersion04t, '--json', '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '--json', '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(result).to.deep.equal(pkgInstallRequest); expect(installStub.args[0][0]).to.deep.equal(pkgInstallCreateRequest); }); @@ -197,7 +210,9 @@ describe('package:install', () => { installStub = stubMethod($$.SANDBOX, SubscriberPackageVersion.prototype, 'install').resolves(request); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const result = await new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxLogStub.calledOnce).to.be.true; const msg = 'Successfully installed package [04t6A000002zgKSQAY]'; @@ -211,7 +226,9 @@ describe('package:install', () => { installStub = stubMethod($$.SANDBOX, SubscriberPackageVersion.prototype, 'install').resolves(request); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); try { - await new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config); + stubSpinner(cmd); + await cmd.run(); expect.fail('Expected error to be thrown'); } catch (err) { const error = err as Error; @@ -228,7 +245,9 @@ describe('package:install', () => { installStub = stubMethod($$.SANDBOX, SubscriberPackageVersion.prototype, 'install').resolves(request); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); try { - await new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config); + stubSpinner(cmd); + await cmd.run(); expect.fail('Expected error to be thrown'); } catch (err) { const error = err as Error; @@ -241,7 +260,9 @@ describe('package:install', () => { it('should throw PackageAliasNotFoundError', async () => { try { - await new Install(['-p', 'my_package_alias', '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', 'my_package_alias', '-o', testOrg.username], config); + stubSpinner(cmd); + await cmd.run(); expect.fail('Expected InvalidAliasOrIdError to be thrown'); } catch (err) { const error = err as Error; @@ -275,7 +296,9 @@ describe('package:install', () => { const request = Object.assign({}, pkgInstallRequest, { Status: 'SUCCESS' }); installStub = stubMethod($$.SANDBOX, SubscriberPackageVersion.prototype, 'install').resolves(request); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const result = await new Install(['-p', 'my_package_alias', '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', 'my_package_alias', '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxLogStub.calledOnce).to.be.true; const msg = 'Successfully installed package [my_package_alias]'; @@ -289,10 +312,9 @@ describe('package:install', () => { const expectedCreateRequest = Object.assign({}, pkgInstallCreateRequest, { Password: installationkey }); installStub = stubMethod($$.SANDBOX, SubscriberPackageVersion.prototype, 'install').resolves(pkgInstallRequest); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const result = await new Install( - ['-p', myPackageVersion04t, '-k', installationkey, '-o', testOrg.username], - config - ).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-k', installationkey, '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(result).to.deep.equal(pkgInstallRequest); expect(installStub.args[0][0]).to.deep.equal(expectedCreateRequest); }); @@ -307,7 +329,7 @@ describe('package:install', () => { installStub = stubMethod($$.SANDBOX, SubscriberPackageVersion.prototype, 'install').resolves(pkgInstallRequest); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const result = await new Install( + const cmd = new Install( [ '-p', myPackageVersion04t, @@ -321,7 +343,9 @@ describe('package:install', () => { testOrg.username, ], config - ).run(); + ); + stubSpinner(cmd); + const result = await cmd.run(); expect(result).to.deep.equal(pkgInstallRequest); expect(installStub.args[0][0]).to.deep.equal(expectedCreateRequest); @@ -335,7 +359,9 @@ describe('package:install', () => { }); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const result = await new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxLogStub.callCount).to.equal(1); expect(uxWarnStub.args[0][0]).to.equal(warningMsg); @@ -353,7 +379,9 @@ describe('package:install', () => { }); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const result = await new Install(['-p', myPackageVersion04t, '-w', '1', '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-w', '1', '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxLogStub.calledOnce).to.be.true; // expect(uxSetSpinnerStatusStub.args[0][0]).to.equal( @@ -380,8 +408,9 @@ describe('package:install', () => { }); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const command = new Install(['-p', myPackageVersion04t, '-w', '1', '-b', '1', '-o', testOrg.username], config); - const result = await command.run(); + const cmd = new Install(['-p', myPackageVersion04t, '-w', '1', '-b', '1', '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxLogStub.calledOnce).to.be.true; // expect(uxSetSpinnerStatusStub.callCount).to.equal(4); @@ -406,10 +435,12 @@ describe('package:install', () => { Package2ContainerOptions: 'Unlocked', }); - const result = await new Install( + const cmd = new Install( ['-p', myPackageVersion04t, '-t', 'Delete', '--no-prompt', '-o', testOrg.username], config - ).run(); + ); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxConfirmStub.calledOnce).to.be.false; expect(result).to.deep.equal(pkgInstallRequest); @@ -423,10 +454,9 @@ describe('package:install', () => { }); uxConfirmStub.resolves(true); - const result = await new Install( - ['-p', myPackageVersion04t, '-t', 'Delete', '-o', testOrg.username], - config - ).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-t', 'Delete', '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxConfirmStub.calledOnce).to.be.true; expect(result).to.deep.equal(pkgInstallRequest); @@ -457,11 +487,12 @@ describe('package:install', () => { Package2ContainerOptions: 'Managed', }); - const result = await new Install( + const cmd = new Install( ['-p', myPackageVersion04t, '-t', 'Delete', '--no-prompt', '-o', testOrg.username], config - ).run(); - + ); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxConfirmStub.calledOnce).to.be.false; expect(result).to.deep.equal(pkgInstallRequest); }); @@ -477,10 +508,9 @@ describe('package:install', () => { ); installStub = stubMethod($$.SANDBOX, SubscriberPackageVersion.prototype, 'install').resolves(pkgInstallRequest); - const result = await new Install( - ['-p', myPackageVersion04t, '--no-prompt', '-o', testOrg.username], - config - ).run(); + const cmd = new Install(['-p', myPackageVersion04t, '--no-prompt', '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(getExternalSitesStub.calledOnce).to.be.true; expect(uxConfirmStub.calledOnce).to.be.false; @@ -501,10 +531,12 @@ describe('package:install', () => { CspTrustedSites: { settings: ['url/for/site2'] }, }); - const result = await new Install( + const cmd = new Install( ['-p', myPackageVersion04t, '--no-prompt', '-k', installationkey, '-o', testOrg.username], config - ).run(); + ); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxConfirmStub.calledOnce).to.be.false; expect(installStub.args[0][0]).to.deep.equal(expectedCreateRequest); @@ -521,7 +553,9 @@ describe('package:install', () => { }); uxConfirmStub.resolves(true); - const result = await new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxConfirmStub.calledOnce).to.be.true; expect(uxConfirmStub.args[0][0]).to.include(extSites.join('\n')); @@ -537,7 +571,9 @@ describe('package:install', () => { CspTrustedSites: { settings: [{ endpointUrl: 'url/for/site2' }] }, }); - const result = await new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config).run(); + const cmd = new Install(['-p', myPackageVersion04t, '-o', testOrg.username], config); + stubSpinner(cmd); + const result = await cmd.run(); expect(uxConfirmStub.calledOnce).to.be.true; expect(uxConfirmStub.args[0][0]).to.include(extSites.join('\n')); diff --git a/test/commands/package/packageConvert.test.ts b/test/commands/package/packageConvert.test.ts index 56d0e928..c1952bbd 100644 --- a/test/commands/package/packageConvert.test.ts +++ b/test/commands/package/packageConvert.test.ts @@ -10,7 +10,6 @@ import { MockTestOrgData, TestContext } from '@salesforce/core/lib/testSetup'; import { Config } from '@oclif/core'; import { Package, PackagingSObjects } from '@salesforce/packaging'; import * as sinon from 'sinon'; -import { stubMethod } from '@salesforce/ts-sinon'; import { PackageConvert } from '../../../src/commands/package/convert'; import Package2VersionStatus = PackagingSObjects.Package2VersionStatus; @@ -22,12 +21,15 @@ describe('package:convert', () => { const testOrg = new MockTestOrgData(); const config = new Config({ root: resolve(__dirname, '../../package.json') }); - const sandbox = sinon.createSandbox(); - // stubs let spinnerStartStub: sinon.SinonStub; let convertStub: sinon.SinonStub; + const stubSpinner = (cmd: PackageConvert) => { + spinnerStartStub = $$.SANDBOX.stub(cmd.spinner, 'start'); + $$.SANDBOX.stub(cmd.spinner, 'stop'); + }; + before(async () => { await $$.stubAuths(testOrg); await config.load(); @@ -35,7 +37,6 @@ describe('package:convert', () => { afterEach(() => { $$.restore(); - sandbox.restore(); }); it('returns error for missing installationkey or installationkeybypass flag', async () => { @@ -43,7 +44,9 @@ describe('package:convert', () => { 'Exactly one of the following must be provided: --installation-key, --installation-key-bypass'; try { - await new PackageConvert(['-p', CONVERTED_FROM_PACKAGE_ID, '-v', 'test@user.com'], config).run(); + const cmd = new PackageConvert(['-p', CONVERTED_FROM_PACKAGE_ID, '-v', 'test@user.com'], config); + stubSpinner(cmd); + await cmd.run(); } catch (e) { expect((e as Error).message).to.include(expectedErrorMsg); } @@ -65,12 +68,12 @@ describe('package:convert', () => { }; convertStub = $$.SANDBOX.stub(Package, 'convert').resolves(pvc); - const command = new PackageConvert( + const cmd = new PackageConvert( ['-p', CONVERTED_FROM_PACKAGE_ID, '--installation-key', INSTALL_KEY, '-v', 'test@user.com'], config ); - spinnerStartStub = stubMethod(sandbox, command.spinner, 'start'); - const result = await command.run(); + stubSpinner(cmd); + const result = await cmd.run(); expect(spinnerStartStub.called).to.be.true; expect(result).to.deep.equal(pvc); @@ -92,10 +95,12 @@ describe('package:convert', () => { convertStub.restore(); convertStub = $$.SANDBOX.stub(Package, 'convert').resolves(pvc); - const result = await new PackageConvert( + const cmd = new PackageConvert( ['-p', CONVERTED_FROM_PACKAGE_ID, '--installation-key', INSTALL_KEY, '-v', 'test@user.com'], config - ).run(); + ); + stubSpinner(cmd); + const result = await cmd.run(); expect(result).to.deep.equal(pvc); }); it('starts package version create request (error)', async () => { @@ -116,10 +121,12 @@ describe('package:convert', () => { convertStub.restore(); convertStub = $$.SANDBOX.stub(Package, 'convert').resolves(pvc); try { - await new PackageConvert( + const cmd = new PackageConvert( ['-p', CONVERTED_FROM_PACKAGE_ID, '--installation-key', INSTALL_KEY, '-v', 'test@user.com'], config - ).run(); + ); + stubSpinner(cmd); + await cmd.run(); } catch (e) { expect((e as Error).message).to.include('Error: server error 1'); expect((e as Error).message).to.include('Error: server error 2'); diff --git a/test/commands/package/packageVersionCreate.test.ts b/test/commands/package/packageVersionCreate.test.ts index 79ff838d..f6f5e570 100644 --- a/test/commands/package/packageVersionCreate.test.ts +++ b/test/commands/package/packageVersionCreate.test.ts @@ -53,32 +53,33 @@ describe('package:version:create - tests', () => { let createStub = $$.SANDBOX.stub(PackageVersion, 'create'); const config = new Config({ root: resolve(__dirname, '../../package.json') }); - const sandbox = sinon.createSandbox(); - // stubs let logStub: sinon.SinonStub; + const stubSpinner = (cmd: PackageVersionCreateCommand) => { + $$.SANDBOX.stub(cmd.spinner, 'start'); + $$.SANDBOX.stub(cmd.spinner, 'stop'); + }; + before(async () => { await $$.stubAuths(testOrg); await config.load(); }); beforeEach(async () => { - logStub = sandbox.stub(SfCommand.prototype, 'log'); + logStub = $$.SANDBOX.stub(SfCommand.prototype, 'log'); }); afterEach(() => { $$.restore(); - sandbox.restore(); }); describe('package:version:create', () => { it('should create a new package version', async () => { createStub.resolves(pkgVersionCreateSuccessResult); - const res = await new PackageVersionCreateCommand( - ['-p', '05i3i000000Gmj6XXX', '-v', 'test@hub.org', '-x'], - config - ).run(); + const cmd = new PackageVersionCreateCommand(['-p', '05i3i000000Gmj6XXX', '-v', 'test@hub.org', '-x'], config); + stubSpinner(cmd); + const res = await cmd.run(); expect(res).to.deep.equal({ Branch: undefined, CreatedBy: '0053i000001ZIyGAAW', @@ -102,7 +103,9 @@ describe('package:version:create - tests', () => { createStub = $$.SANDBOX.stub(PackageVersion, 'create'); createStub.resolves(pkgVersionCreateErrorResult); try { - await new PackageVersionCreateCommand(['-p', '05i3i000000Gmj6XXX', '-v', 'test@hub.org', '-x'], config).run(); + const cmd = new PackageVersionCreateCommand(['-p', '05i3i000000Gmj6XXX', '-v', 'test@hub.org', '-x'], config); + stubSpinner(cmd); + await cmd.run(); assert.fail('the above should throw multiple errors'); } catch (e) { expect((e as Error).message).to.equal( From 407902ec1181f240c69df3e5740855a3aad71e8f Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Thu, 2 Feb 2023 09:27:18 -0700 Subject: [PATCH 3/4] test: fix PV update NUT --- messages/package_version_update.md | 2 +- src/commands/package/version/update.ts | 2 +- .../package/versionPromoteUpdate.nut.ts | 7 ++-- yarn.lock | 33 +++++++++++-------- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/messages/package_version_update.md b/messages/package_version_update.md index 2919ffd5..21d30fa0 100644 --- a/messages/package_version_update.md +++ b/messages/package_version_update.md @@ -48,4 +48,4 @@ New installation key for key-protected package (default: null) # success -Successfully updated the package version. +Successfully updated the package version. %s diff --git a/src/commands/package/version/update.ts b/src/commands/package/version/update.ts index 78c8adeb..9a4bf7d5 100644 --- a/src/commands/package/version/update.ts +++ b/src/commands/package/version/update.ts @@ -77,7 +77,7 @@ export class PackageVersionUpdateCommand extends SfCommand { Tag: flags.tag, }); - this.logSuccess(messages.getMessage('success')); + this.logSuccess(messages.getMessage('success', [result.id])); return result; } diff --git a/test/commands/package/versionPromoteUpdate.nut.ts b/test/commands/package/versionPromoteUpdate.nut.ts index 7f4244a9..6844681b 100644 --- a/test/commands/package/versionPromoteUpdate.nut.ts +++ b/test/commands/package/versionPromoteUpdate.nut.ts @@ -6,11 +6,14 @@ */ import * as path from 'path'; - import { execCmd, genUniqueString, TestSession } from '@salesforce/cli-plugins-testkit'; import { expect } from 'chai'; import { PackageSaveResult, PackageVersionCreateRequestResult } from '@salesforce/packaging'; import { Duration } from '@salesforce/kit'; +import { Messages } from '@salesforce/core'; + +Messages.importMessagesDirectory(__dirname); +const messages = Messages.loadMessages('@salesforce/plugin-packaging', 'package_version_update'); describe('package:version:promote / package:version:update', () => { let packageId: string | undefined | null; @@ -93,7 +96,7 @@ describe('package:version:promote / package:version:update', () => { const result = execCmd(`package:version:update --package ${packageId} --branch MySuperCoolBranch`, { ensureExitCode: 0, }).shellOutput.stdout; - expect(result).to.contain(`Successfully updated the package version. ${packageId}`); + expect(result).to.contain(messages.getMessage('success', [packageId])); }); it('should update a package (--json)', () => { diff --git a/yarn.lock b/yarn.lock index 4896bbac..cb1d0699 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1184,23 +1184,23 @@ shx "^0.3.3" tslib "^2.2.0" -"@salesforce/packaging@^1.1.11": - version "1.1.12" - resolved "https://registry.yarnpkg.com/@salesforce/packaging/-/packaging-1.1.12.tgz#c8b3b6a4567b2c7c366e11010a8776a3e188e832" - integrity sha512-zrGvDcUn5gxT0M1uFx/B4GkXKZpxigaDVKYYD2ld2oVDw3emlpKEoVKE4XE/9vSqdkwDWRLSl+zBGH16biJKLw== +"@salesforce/packaging@^1.2.0": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@salesforce/packaging/-/packaging-1.2.3.tgz#c363c23613979e278b7e3c795a7e816273d38de4" + integrity sha512-wdSwXDi/8pDQoLfT7SN/RWbFlsZMNhksHazt6Uzg4ewiwKtq0cDSR9uo3r/uTYmhPbVQ423I/drawStI9P1U2w== dependencies: "@oclif/core" "^1.25.0" "@salesforce/core" "^3.32.11" - "@salesforce/kit" "^1.8.0" - "@salesforce/schemas" "^1.4.0" - "@salesforce/source-deploy-retrieve" "^7.5.19" + "@salesforce/kit" "^1.8.3" + "@salesforce/schemas" "^1.5.0" + "@salesforce/source-deploy-retrieve" "^7.7.5" "@salesforce/ts-types" "^1.7.1" "@xmldom/xmldom" "^0.8.6" debug "^4.3.4" globby "^11" graphology "^0.25.1" graphology-traversal "^0.3.1" - graphology-types "^0.24.5" + graphology-types "^0.24.7" js2xmlparser "^4.0.2" jsforce "2.0.0-beta.19" jszip "^3.10.1" @@ -1259,6 +1259,11 @@ resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.4.0.tgz#7dff427c8059895d8108176047aee600703c82d6" integrity sha512-BJ25uphssN42Zy6kksheFHMTLiR98AAHe/Wxnv0T4dYxtrEbUjSXVAGKZqfewJPFXA4xB5gxC+rQZtfz6xKCFg== +"@salesforce/schemas@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.5.0.tgz#8bfe2cb5d7cb29d3394b3b9cfb71bb527009c82c" + integrity sha512-EKFBURBuON7cj8XZCW+ybeSRRw7wUP1XUXZVHzFgx8KiYmSeGiRHBYbDjQOsQMho2uOLsTozMPEt2ehYnji0YA== + "@salesforce/sf-plugins-core@^1.21.5", "@salesforce/sf-plugins-core@^1.22.1": version "1.22.2" resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-1.22.2.tgz#56aa9c490a64a53142160eb0b67bc32331ad0674" @@ -1271,13 +1276,13 @@ chalk "^4" inquirer "^8.2.5" -"@salesforce/source-deploy-retrieve@^7.5.19": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-7.7.5.tgz#4eb64f02d4759f98e1e64187a081c472ebe8a2ae" - integrity sha512-zkGpbvTVr2nBJfbTxShFfaa4DAOvbXiaaWjZg0oVLUDoAQh+uQKX4aPdsXqJR4pKdQR8u1JwEV7TlR1f5gMCrg== +"@salesforce/source-deploy-retrieve@^7.7.5": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-7.7.7.tgz#81e04f54f0a1b0f2aa216b5230f419292a488327" + integrity sha512-KZEhg6+XQM+0cP9NAMHkhAdQY0ljaWSng4NEwkes5MDPLdQyt3S3uLpEF8pszfcNzfGhTTSgquIGrXt87pbjow== dependencies: "@salesforce/core" "^3.32.13" - "@salesforce/kit" "^1.8.0" + "@salesforce/kit" "^1.8.3" "@salesforce/ts-types" "^1.7.2" archiver "^5.3.1" fast-xml-parser "^3.21.1" @@ -4350,7 +4355,7 @@ graphology-traversal@^0.3.1: graphology-indices "^0.17.0" graphology-utils "^2.0.0" -graphology-types@^0.24.5: +graphology-types@^0.24.7: version "0.24.7" resolved "https://registry.yarnpkg.com/graphology-types/-/graphology-types-0.24.7.tgz#7d630a800061666bfa70066310f56612e08b7bee" integrity sha512-tdcqOOpwArNjEr0gNQKCXwaNCWnQJrog14nJNQPeemcLnXQUUGrsCWpWkVKt46zLjcS6/KGoayeJfHHyPDlvwA== From 53e90f927563ea80af2cfd32c226cce0eafe0564 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Thu, 2 Feb 2023 10:53:22 -0700 Subject: [PATCH 4/4] test: fix UT --- test/commands/package/install.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/commands/package/install.test.ts b/test/commands/package/install.test.ts index 3888ca10..3da6e29f 100644 --- a/test/commands/package/install.test.ts +++ b/test/commands/package/install.test.ts @@ -416,7 +416,7 @@ describe('package:install', () => { }); stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves(subscriberPackageVersion); - const cmd = new Install(['-p', myPackageVersion04t, '-w', '1', '-b', '1', '-o', testOrg.username], config); + const cmd = new Install(['-p', myPackageVersion04t, '-w', '1', '-b', '2', '-o', testOrg.username], config); stubSpinner(cmd); const result = await cmd.run();