diff --git a/test/nuts/delete/source.nut.ts b/test/nuts/delete/source.nut.ts index 49d5c8f5..020f764d 100644 --- a/test/nuts/delete/source.nut.ts +++ b/test/nuts/delete/source.nut.ts @@ -39,7 +39,7 @@ describe('CustomLabels', () => { scratchOrgs: [{ setDefault: true, config: path.join('config', 'project-scratch-def.json') }], devhubAuthStrategy: 'AUTO', }); - execCmd('force:source:deploy --sourcepath force-app', { ensureExitCode: 0 }); + execCmd('project:deploy:start --source-dir force-app', { ensureExitCode: 0 }); }); after(async () => { @@ -103,7 +103,7 @@ describe('project delete source NUTs', () => { ensureExitCode: 0, cli: 'sf', }); - execCmd(`force:source:deploy -m ApexClass:${apexName}`, { ensureExitCode: 0 }); + execCmd(`project:deploy:start -m ApexClass:${apexName}`, { ensureExitCode: 0 }); return { apexName, output, pathToClass }; }; @@ -112,7 +112,7 @@ describe('project delete source NUTs', () => { nut: __filename, repository: 'https://github.com/trailheadapps/dreamhouse-lwc.git', }); - execCmd('force:source:deploy --sourcepath force-app', { ensureExitCode: 0 }); + execCmd('project:deploy:start --source-dir force-app', { ensureExitCode: 0 }); }); after(async () => { @@ -239,7 +239,7 @@ describe('project delete source NUTs', () => { // use the brokerCard LWC const lwcPath = path.join(testkit.projectDir, 'force-app', 'main', 'default', 'lwc', 'brokerCard', 'helper.js'); fs.writeFileSync(lwcPath, '//', { encoding: 'utf8' }); - execCmd(`force:source:deploy -p ${lwcPath}`); + execCmd(`project:deploy:start --source-dir ${lwcPath}`, { cli: 'sf', ensureExitCode: 0 }); const deleteResult = execCmd<{ deletedSource: [FileResponse] }>( `project:delete:source -p ${lwcPath} --no-prompt --json` ).jsonOutput?.result; @@ -259,7 +259,7 @@ describe('project delete source NUTs', () => { const lwcPath2 = path.join(testkit.projectDir, 'force-app', 'main', 'default', 'lwc', 'daysOnMarket', 'helper.js'); fs.writeFileSync(lwcPath1, '//', { encoding: 'utf8' }); fs.writeFileSync(lwcPath2, '//', { encoding: 'utf8' }); - execCmd(`force:source:deploy -p ${lwcPath1},${lwcPath2}`); + execCmd(`project:deploy:start --source-dir ${lwcPath1} --source-dir ${lwcPath2}`); // delete both helper.js files at the same time const deleteResult = execCmd<{ deletedSource: FileResponse[] }>( // eslint-disable-next-line sf-plugin/no-execcmd-double-quotes @@ -285,7 +285,7 @@ describe('project delete source NUTs', () => { const lwcPath = path.join(testkit.projectDir, 'force-app', 'main', 'default', 'lwc'); const mylwcPath = path.join(lwcPath, 'mylwc'); execCmd(`force:lightning:component:create -n mylwc --type lwc -d ${lwcPath}`, { cli: 'sf', ensureExitCode: 0 }); - execCmd(`force:source:deploy -p ${mylwcPath}`); + execCmd(`project:deploy:start --source-dir ${mylwcPath}`); expect(await isNameObsolete(testkit.username, 'LightningComponentBundle', 'mylwc')).to.be.false; const deleteResult = execCmd<{ deletedSource: [FileResponse] }>( `project:delete:source -p ${mylwcPath} --no-prompt --json` diff --git a/test/nuts/tracking/basics.nut.ts b/test/nuts/tracking/basics.nut.ts index 7de1dd55..d0bf10ee 100644 --- a/test/nuts/tracking/basics.nut.ts +++ b/test/nuts/tracking/basics.nut.ts @@ -49,6 +49,7 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => { it('detects the initial metadata status', () => { const result = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; assert(Array.isArray(result)); // the fields should be populated @@ -92,11 +93,13 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => { it('sees no local changes (all were committed from push), but profile updated in remote', () => { const localResult = execCmd('force:source:status --json --local', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(localResult?.filter(filterIgnored)).to.deep.equal([]); const remoteResult = execCmd('force:source:status --json --remote', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(remoteResult?.some((item) => item.type === 'Profile')).to.equal(true); }); @@ -110,6 +113,7 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => { it('sf sees no remote changes (all were committed from push) except Profile', () => { const remoteResult = execCmd('force:source:status --json --remote', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(remoteResult?.some((item) => item.type === 'Profile')).to.equal(true); }); @@ -127,6 +131,7 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => { it('sees no local or remote changes', () => { const result = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(result?.filter((r) => r.type === 'Profile').filter(filterIgnored), JSON.stringify(result)).to.have.length( 0 @@ -155,6 +160,7 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => { ]); const result = execCmd('force:source:status --json --local', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(result?.filter(filterIgnored)).to.deep.equal([ { @@ -199,6 +205,7 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => { it('does not see any change in remote status', () => { const result = execCmd('force:source:status --json --remote', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect( result?.filter((r) => r.fullName === 'TestOrderController'), @@ -224,6 +231,7 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => { it('sees no local changes', () => { const result = execCmd('force:source:status --json --local', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(result?.filter(filterIgnored), JSON.stringify(result)).to.be.an.instanceof(Array).with.length(0); }); @@ -243,6 +251,7 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => { assert(hubUsername, 'hubUsername should be defined'); const failure = execCmd(`force:source:status -u ${hubUsername} --remote --json`, { ensureExitCode: 1, + cli: 'sf', }).jsonOutput as unknown as { name: string }; // command5 is removing `Error` from the end of the error names. expect(failure.name).to.include('NonSourceTrackedOrg'); @@ -281,6 +290,7 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => { it('sees no local changes', () => { const result = execCmd('force:source:status --json --local', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(result?.filter(filterIgnored), JSON.stringify(result)).to.be.an.instanceof(Array).with.length(2); }); diff --git a/test/nuts/tracking/conflicts.nut.ts b/test/nuts/tracking/conflicts.nut.ts index 2c5a5802..dbd91027 100644 --- a/test/nuts/tracking/conflicts.nut.ts +++ b/test/nuts/tracking/conflicts.nut.ts @@ -76,6 +76,7 @@ describe('conflict detection and resolution', () => { }); const result = execCmd('force:source:status --json --remote', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect( result?.filter((r) => r.type === 'CustomApplication'), @@ -99,6 +100,7 @@ describe('conflict detection and resolution', () => { it('can see the conflict in status', () => { const result = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result.filter((app) => app.type === 'CustomApplication'); // json is not sorted. This relies on the implementation of getConflicts() expect(result).to.deep.equal([ diff --git a/test/nuts/tracking/deleteResetTracking.nut.ts b/test/nuts/tracking/deleteResetTracking.nut.ts index dae86edc..0b66862f 100644 --- a/test/nuts/tracking/deleteResetTracking.nut.ts +++ b/test/nuts/tracking/deleteResetTracking.nut.ts @@ -66,6 +66,7 @@ describe('reset and clear tracking', () => { it('runs status to start tracking', () => { const result = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(result).to.have.length.greaterThan(100); // ebikes is big }); @@ -109,7 +110,7 @@ describe('reset and clear tracking', () => { } }); // gets tracking files from server - execCmd('force:source:status --json --remote', { ensureExitCode: 0 }); + execCmd('force:source:status --json --remote', { ensureExitCode: 0, cli: 'sf' }); const revisions = await getRevisionsAsArray(); const revisionFile = JSON.parse( await fs.promises.readFile(path.join(trackingFileFolder, 'maxRevision.json'), 'utf8') diff --git a/test/nuts/tracking/forceIgnore.nut.ts b/test/nuts/tracking/forceIgnore.nut.ts index 79058fb3..baa88934 100644 --- a/test/nuts/tracking/forceIgnore.nut.ts +++ b/test/nuts/tracking/forceIgnore.nut.ts @@ -72,6 +72,7 @@ describe('forceignore changes', () => { it('shows the file in status as ignored', () => { const output = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(output, JSON.stringify(output)).to.deep.include({ state: 'Local Add', @@ -157,6 +158,7 @@ describe('forceignore changes', () => { // gets file into source tracking const statusOutput = execCmd('force:source:status --json --remote', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(statusOutput?.some((result) => result.fullName === 'CreatedClass')).to.equal(true); }); diff --git a/test/nuts/tracking/lwc.nut.ts b/test/nuts/tracking/lwc.nut.ts index d73bcf93..9795ff10 100644 --- a/test/nuts/tracking/lwc.nut.ts +++ b/test/nuts/tracking/lwc.nut.ts @@ -58,6 +58,7 @@ describe('lwc', () => { ); const result = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(result?.find((r) => r.filePath === cssPathRelative)).to.have.property('actualState', 'Changed'); }); @@ -87,6 +88,7 @@ describe('lwc', () => { it('sfdx sees no local changes', () => { const result = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }) .jsonOutput?.result.filter((r) => r.origin === 'Local') .filter(filterIgnored); @@ -106,6 +108,7 @@ describe('lwc', () => { await fs.promises.rm(cssPathAbsolute); const result = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }) .jsonOutput?.result.filter(filterIgnored) .find((r) => r.filePath === cssPathRelative); @@ -137,6 +140,7 @@ describe('lwc', () => { it('sees no local changes', () => { const result = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }) .jsonOutput?.result.filter((r) => r.origin === 'Local') .filter(filterIgnored); @@ -167,6 +171,7 @@ describe('lwc', () => { ); const result = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result.filter((r) => r.origin === 'Local'); assert(result); expect(result.filter(filterIgnored)).to.have.length(4); @@ -190,6 +195,7 @@ describe('lwc', () => { it('sees no local changes', () => { const result = execCmd('force:source:status --json', { ensureExitCode: 0, + cli: 'sf', }) .jsonOutput?.result.filter((r) => r.origin === 'Local') .filter(filterIgnored); diff --git a/test/nuts/tracking/remoteChanges.nut.ts b/test/nuts/tracking/remoteChanges.nut.ts index 94403f31..2c6f6425 100644 --- a/test/nuts/tracking/remoteChanges.nut.ts +++ b/test/nuts/tracking/remoteChanges.nut.ts @@ -68,6 +68,7 @@ describe('remote changes', () => { it('sees no local changes (all were committed from deploy)', () => { const localResult = execCmd('force:source:status --json --local', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(localResult?.filter(filterIgnored)).to.deep.equal([]); }); @@ -108,6 +109,7 @@ describe('remote changes', () => { it('sfdx can see the delete in status', () => { const result = execCmd('force:source:status --json --remote', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; // it shows up as one class on the server, but 2 files when pulled expect( @@ -125,6 +127,7 @@ describe('remote changes', () => { it('sfdx does not see any change in local status', () => { const result = execCmd('force:source:status --json --local', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(result?.filter(filterIgnored)).to.deep.equal([]); }); @@ -159,11 +162,13 @@ describe('remote changes', () => { it('sees correct local and remote status', () => { const remoteResult = execCmd('force:source:status --json --remote', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(remoteResult?.filter((r) => r.state.includes('Remote Deleted'))).to.deep.equal([]); const localStatus = execCmd('force:source:status --json --local', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(localStatus?.filter(filterIgnored)).to.deep.equal([]); }); @@ -197,6 +202,7 @@ describe('remote changes', () => { it('can see the add in status', () => { const result = execCmd('force:source:status --json --remote', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect( result?.some((r) => r.fullName === className), @@ -224,6 +230,7 @@ describe('remote changes', () => { it('sfdx sees correct remote status', () => { const remoteResult = execCmd('force:source:status --json --remote', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect( remoteResult?.filter((r) => r.fullName === className), @@ -233,6 +240,7 @@ describe('remote changes', () => { it('sfdx sees correct local status', () => { const localStatus = execCmd('force:source:status --json --local', { ensureExitCode: 0, + cli: 'sf', }).jsonOutput?.result; expect(localStatus?.filter(filterIgnored)).to.deep.equal([]); });