Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move from sfdx examples/commands/defaults to sf #462

Merged
merged 9 commits into from
May 5, 2023
9 changes: 4 additions & 5 deletions src/testSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import { DevhubAuthStrategy, getAuthStrategy, testkitHubAuth, transferExistingAu
import { JsonOutput } from './execCmd';

export type ScratchOrgConfig = {
/**
* @deprecated 'sf' will be default
*/
executable?: 'sfdx' | 'sf';
config?: string;
duration?: number;
Expand Down Expand Up @@ -328,11 +331,7 @@ export class TestSession<T extends TestSessionOptions = TestSessionOptions> exte
throw new Error(`${executable} executable not found for creating scratch orgs`);
}

let baseCmd =
executable === 'sf'
? `${executable} env create scratch --json -y ${org.duration ?? '1'}`
: `${executable} force:org:create --json -d ${org.duration ?? '1'}`;
baseCmd += ` -w ${org.wait ?? 60}`;
let baseCmd = `sf env:create:scratch --json -y ${org.duration ?? '1'} -w ${org.wait ?? 60}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's still some sfdx-specific stuff on the flags on the new few dozen lines that will break.


if (org.config) {
baseCmd += ` -f ${org.config}`;
Expand Down
6 changes: 3 additions & 3 deletions test/unit/testSession.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe('TestSession', () => {
expect(execStub.callCount).to.equal(scratchOrgs.length * (retries + 1));
expect(session.orgs.get(username)).to.deep.equal({ username, orgId: '12345' });
expect(execStub.firstCall.args[0]).to.equal(
'sf env create scratch --json -y 1 -w 60 -f config/project-scratch-def.json'
'sf env:create:scratch --json -y 1 -w 60 -f config/project-scratch-def.json'
);
});

Expand Down Expand Up @@ -215,7 +215,7 @@ describe('TestSession', () => {
expect(session.orgs.get(username)).to.deep.equal({ username, orgId: '12345' });
expect(session.orgs.get('default')).to.deep.equal({ username, orgId: '12345' });
expect(execStub.firstCall.args[0]).to.equal(
'sf env create scratch --json -y 1 -w 60 -f config/project-scratch-def.json -a my-org -d -e developer'
'sf env:create:scratch --json -y 1 -w 60 -f config/project-scratch-def.json -a my-org -d -e developer'
);
expect(process.env.HOME).to.equal(session.homeDir);
expect(process.env.USERPROFILE).to.equal(session.homeDir);
Expand Down Expand Up @@ -256,7 +256,7 @@ describe('TestSession', () => {

it('should error if setup command fails', async () => {
stubMethod(sandbox, shelljs, 'which').returns(true);
const expectedCmd = 'sf env create scratch --json -y 1 -w 60 -f config/project-scratch-def.json';
const expectedCmd = 'sf env:create:scratch --json -y 1 -w 60 -f config/project-scratch-def.json';
const execRv = 'Cannot foo before bar';
const shellString = new ShellString(JSON.stringify(execRv));
shellString.code = 1;
Expand Down