From 2744d960d13637dcb0a63414d1964819fcc62878 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Wed, 8 Nov 2023 10:52:24 -0400 Subject: [PATCH] chore: add cli: 'sf' where requried --- src/formatters/deployResultFormatter.ts | 8 ++++---- test/nuts/REST/deploy.mpd.nut.ts | 2 +- test/nuts/REST/deploy.nut.ts | 4 ++-- test/nuts/deployDestructive.nut.ts | 2 +- test/nuts/seeds/deploy.manifest.seed.ts | 4 ++-- test/nuts/seeds/deploy.metadata.seed.ts | 4 ++-- test/nuts/seeds/deploy.testlevel.seed.ts | 2 +- test/nuts/seeds/retrieve.manifest.seed.ts | 2 +- test/nuts/trackingCommands/forceIgnore.nut.ts | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/formatters/deployResultFormatter.ts b/src/formatters/deployResultFormatter.ts index f2c94b0c9..d7927e8c1 100644 --- a/src/formatters/deployResultFormatter.ts +++ b/src/formatters/deployResultFormatter.ts @@ -12,8 +12,9 @@ import chalk from 'chalk'; import { Messages, SfError } from '@salesforce/core'; import { ensureArray } from '@salesforce/kit'; -import { asString, get, getBoolean, getNumber, getString } from '@salesforce/ts-types'; +import { asString, get, getBoolean, getNumber } from '@salesforce/ts-types'; import { + ComponentStatus, DeployMessage, DeployResult, Failures, @@ -24,7 +25,6 @@ import { Successes, } from '@salesforce/source-deploy-retrieve'; import { Ux } from '@salesforce/sf-plugins-core'; -import { ComponentStatus } from '@salesforce/source-deploy-retrieve/lib/src/client/types.js'; import { ResultFormatter, ResultFormatterOptions } from './resultFormatter.js'; import { MdDeployResult } from './mdapi/mdDeployResultFormatter.js'; import { maybePrintCodeCoverageTable } from './codeCoverageTable.js'; @@ -89,7 +89,7 @@ export class DeployResultFormatter extends ResultFormatter { return; } if (this.hasStatus(RequestStatus.Canceled)) { - const canceledByName = getString(this.result, 'response.canceledByName', 'unknown'); + const canceledByName = this.result.response.canceledByName ?? 'unknown'; throw new SfError(messages.getMessage('deployCanceled', [canceledByName]), 'DeployFailed'); } this.displaySuccesses(); @@ -110,7 +110,7 @@ export class DeployResultFormatter extends ResultFormatter { } protected hasStatus(status: RequestStatus): boolean { - return getString(this.result, 'response.status') === status; + return this.result.response.status === status; } protected isRunTestsEnabled(): boolean { diff --git a/test/nuts/REST/deploy.mpd.nut.ts b/test/nuts/REST/deploy.mpd.nut.ts index 027accd67..8a5b61c10 100644 --- a/test/nuts/REST/deploy.mpd.nut.ts +++ b/test/nuts/REST/deploy.mpd.nut.ts @@ -119,7 +119,7 @@ context(`MPD REST Deploy NUTs [name: ${repo.name}]`, () => { for (const manifest of repo.deploy.manifest) { const toDeploy = path.normalize(manifest.toDeploy); it(`should deploy ${toDeploy}`, async () => { - await testkit.convert({ args: `--sourcepath ${toDeploy} --outputdir out` }); + await testkit.convert({ cli: 'sf', args: `--sourcepath ${toDeploy} --outputdir out` }); const packageXml = path.join('out', 'package.xml'); const res = await testkit.deploy({ args: `--manifest ${packageXml}` }); diff --git a/test/nuts/REST/deploy.nut.ts b/test/nuts/REST/deploy.nut.ts index 8bb56b636..c1ed60854 100644 --- a/test/nuts/REST/deploy.nut.ts +++ b/test/nuts/REST/deploy.nut.ts @@ -94,7 +94,7 @@ context(`REST Deploy NUTs [name: ${repo.name}]`, () => { for (const testCase of repo.deploy.manifest) { const toDeploy = path.normalize(testCase.toDeploy); it(`should deploy ${toDeploy}`, async () => { - await testkit.convert({ args: `--sourcepath ${toDeploy} --outputdir out` }); + await testkit.convert({ cli: 'sf', args: `--sourcepath ${toDeploy} --outputdir out` }); const packageXml = path.join('out', 'package.xml'); const res = await testkit.deploy({ args: `--manifest ${packageXml}` }); @@ -120,7 +120,7 @@ context(`REST Deploy NUTs [name: ${repo.name}]`, () => { // deploy all metadata to the org so that we can run tests await testkit.deploy({ args: '--sourcepath force-app' }); // running tests requires a special permission in the 'dreamhouse' permission set - await testkit.assignPermissionSet({ args: '--permsetname dreamhouse' }); + await testkit.assignPermissionSet({ cli: 'sf', args: '--permsetname dreamhouse' }); const checkOnly = (await testkit.deploy({ args: '--sourcepath force-app/main/default/classes --testlevel RunLocalTests --checkonly --ignoreerrors --wait 0', diff --git a/test/nuts/deployDestructive.nut.ts b/test/nuts/deployDestructive.nut.ts index 2ae33a7be..89a5e4f82 100644 --- a/test/nuts/deployDestructive.nut.ts +++ b/test/nuts/deployDestructive.nut.ts @@ -21,7 +21,7 @@ describe('source:deploy --destructive NUTs', () => { const pathToClass = path.join(testkit.projectDir, output, `${apexName}.cls`); execCmd(`force:apex:class:create --classname ${apexName} --outputdir ${output} --api-version 58.0`, { ensureExitCode: 0, - cli: 'dev', + cli: 'sf', }); execCmd(`force:source:deploy -m ApexClass:${apexName}`, { ensureExitCode: 0, cli: 'dev' }); return { apexName, output, pathToClass }; diff --git a/test/nuts/seeds/deploy.manifest.seed.ts b/test/nuts/seeds/deploy.manifest.seed.ts index b25612e8d..0bf832e27 100644 --- a/test/nuts/seeds/deploy.manifest.seed.ts +++ b/test/nuts/seeds/deploy.manifest.seed.ts @@ -26,7 +26,7 @@ context('Deploy manifest NUTs [name: %REPO_NAME%]', () => { // some deploys reference other metadata not included in the deploy, if it's not already in the org it will fail await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` }); if (REPO.gitUrl.includes('dreamhouse')) { - await testkit.assignPermissionSet({ args: '--permsetname dreamhouse' }); + await testkit.assignPermissionSet({ cli: 'sf', args: '--permsetname dreamhouse' }); } }); @@ -43,7 +43,7 @@ context('Deploy manifest NUTs [name: %REPO_NAME%]', () => { for (const testCase of REPO.deploy.manifest) { const toDeploy = path.normalize(testCase.toDeploy); it(`should deploy ${toDeploy}`, async () => { - await testkit.convert({ args: `--sourcepath ${testCase.toDeploy} --outputdir out` }); + await testkit.convert({ cli: 'sf', args: `--sourcepath ${testCase.toDeploy} --outputdir out` }); const packageXml = path.join('out', 'package.xml'); const res = await testkit.deploy({ args: `--manifest ${packageXml}` }); diff --git a/test/nuts/seeds/deploy.metadata.seed.ts b/test/nuts/seeds/deploy.metadata.seed.ts index 4d64e2b36..3d428fd15 100644 --- a/test/nuts/seeds/deploy.metadata.seed.ts +++ b/test/nuts/seeds/deploy.metadata.seed.ts @@ -26,7 +26,7 @@ context('Deploy metadata NUTs [name: %REPO_NAME%]', () => { await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` }); // permset is only present in dreamhouse, not mpd if (REPO.gitUrl.includes('dreamhouse')) { - await testkit.assignPermissionSet({ args: '--permsetname dreamhouse' }); + await testkit.assignPermissionSet({ cli: 'sf', args: '--permsetname dreamhouse' }); } }); @@ -56,7 +56,7 @@ context('Deploy metadata NUTs [name: %REPO_NAME%]', () => { }); it('should not deploy metadata outside of a package directory', async () => { - await testkit.createApexClass({ args: '--outputdir NotAPackage --classname ShouldNotBeDeployed' }); + await testkit.createApexClass({ cli: 'sf', args: '--outputdir NotAPackage --classname ShouldNotBeDeployed' }); await testkit.deploy({ args: '--metadata ApexClass' }); // this is a glob, so no need for path.join await testkit.expect.filesToNotBeDeployed(['NotAPackage/**/*']); diff --git a/test/nuts/seeds/deploy.testlevel.seed.ts b/test/nuts/seeds/deploy.testlevel.seed.ts index 4977348c9..78dae2de8 100644 --- a/test/nuts/seeds/deploy.testlevel.seed.ts +++ b/test/nuts/seeds/deploy.testlevel.seed.ts @@ -24,7 +24,7 @@ context('Deploy testlevel NUTs [name: %REPO_NAME%]', () => { if (REPO.gitUrl.includes('dreamhouse')) { // running tests requires a special permission in the 'dreamhouse' permission set - await testkit.assignPermissionSet({ args: '--permsetname dreamhouse' }); + await testkit.assignPermissionSet({ cli: 'sf', args: '--permsetname dreamhouse' }); } }); diff --git a/test/nuts/seeds/retrieve.manifest.seed.ts b/test/nuts/seeds/retrieve.manifest.seed.ts index e6bb5ecc7..dd11717fa 100644 --- a/test/nuts/seeds/retrieve.manifest.seed.ts +++ b/test/nuts/seeds/retrieve.manifest.seed.ts @@ -42,7 +42,7 @@ context('Retrieve manifest NUTs [name: %REPO_NAME%]', () => { const convertDir = `convert_${i++}`; it(`should retrieve ${toRetrieve}`, async () => { // generate package.xml to use with the --manifest param - await testkit.convert({ args: `--sourcepath ${testCase.toRetrieve} --outputdir ${convertDir}` }); + await testkit.convert({ cli: 'sf', args: `--sourcepath ${testCase.toRetrieve} --outputdir ${convertDir}` }); const packageXml = path.join(convertDir, 'package.xml'); await testkit.modifyLocalGlobs(testCase.toVerify); diff --git a/test/nuts/trackingCommands/forceIgnore.nut.ts b/test/nuts/trackingCommands/forceIgnore.nut.ts index d3085c11b..fc3f03f08 100644 --- a/test/nuts/trackingCommands/forceIgnore.nut.ts +++ b/test/nuts/trackingCommands/forceIgnore.nut.ts @@ -41,7 +41,7 @@ describe('forceignore changes', () => { ], }); - execCmd(`force:apex:class:create -n IgnoreTest --outputdir ${classdir}`, { cli: 'dev', ensureExitCode: 0 }); + execCmd(`force:apex:class:create -n IgnoreTest --outputdir ${classdir}`, { cli: 'sf', ensureExitCode: 0 }); originalForceIgnore = await fs.promises.readFile(path.join(session.project.dir, '.forceignore'), 'utf8'); conn = await Connection.create({ @@ -96,7 +96,7 @@ describe('forceignore changes', () => { execCmd(`force:apex:class:create -n UnIgnoreTest --outputdir ${classdir}`, { cwd: session.project.dir, silent: true, - cli: 'dev', + cli: 'sf', }); // pushes with no results const ignoredOutput = execCmd('force:source:push --json', {