Skip to content

Commit

Permalink
fix: index orgs by alias
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 4, 2022
1 parent 79baf0a commit 019ca66
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/testSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export class TestSession extends AsyncOptionalCreatable<TestSessionOptions> {
private shelljsExecOptions: shell.ExecOptions = {
silent: true,
};
private orgsAliases: string[] = ['default'];

public constructor(options: TestSessionOptions = {}) {
super(options);
Expand Down Expand Up @@ -259,7 +260,7 @@ export class TestSession extends AsyncOptionalCreatable<TestSessionOptions> {
private async deleteOrgs(): Promise<void> {
if (!env.getString('TESTKIT_ORG_USERNAME') && this.orgs.size > 0) {
for (const org of [...this.orgs.keys()]) {
if (org === 'default') continue;
if (this.orgsAliases.includes(org)) continue;

this.debug(`Deleting test org: ${org}`);
const rv = shell.exec(`sf env delete scratch -o ${org} -p`, this.shelljsExecOptions) as shell.ShellString;
Expand Down Expand Up @@ -353,6 +354,11 @@ export class TestSession extends AsyncOptionalCreatable<TestSessionOptions> {
if (org.setDefault) {
this.orgs.set('default', jsonOutput.result.authFields);
}

if (org.alias) {
this.orgsAliases.push(org.alias);
this.orgs.set(org.alias, jsonOutput.result.authFields);
}
}
};

Expand Down

0 comments on commit 019ca66

Please sign in to comment.