@salesforce/cli-plugins-testkit 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,6 +80,7 @@ export declare class TestSession extends AsyncOptionalCreatable<TestSessionOptio
80
80
  private zipDir;
81
81
  private options;
82
82
  private shelljsExecOptions;
83
+ private orgsAliases;
83
84
  constructor(options?: TestSessionOptions);
84
85
  /**
85
86
  * Get an existing test session created with the same options,
@@ -54,6 +54,7 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
54
54
  this.shelljsExecOptions = {
55
55
  silent: true,
56
56
  };
57
+ this.orgsAliases = ['default'];
57
58
  this.options = options;
58
59
  this.debug = (0, debug_1.debug)('testkit:session');
59
60
  this.zipDir = zip_1.zipDir;
@@ -87,9 +88,7 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
87
88
  }
88
89
  // Write the test session options used to create this session
89
90
  fs.writeFileSync(path.join(this.dir, 'testSessionOptions.json'), JSON.stringify(JSON.parse(JSON.stringify(this.options))));
90
- const authStrategy = !this.options.devhubAuthStrategy || this.options.devhubAuthStrategy === 'AUTO'
91
- ? (0, hubAuth_1.getAuthStrategy)()
92
- : this.options.devhubAuthStrategy;
91
+ const authStrategy = this.options.devhubAuthStrategy === 'AUTO' ? (0, hubAuth_1.getAuthStrategy)() : this.options.devhubAuthStrategy ?? 'NONE';
93
92
  (0, hubAuth_1.transferExistingAuthToEnv)(authStrategy);
94
93
  // Set the homedir used by this test, on the TestSession and the process
95
94
  process.env.USERPROFILE = process.env.HOME = this.homeDir = kit_1.env.getString('TESTKIT_HOMEDIR', this.dir);
@@ -169,7 +168,7 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
169
168
  async deleteOrgs() {
170
169
  if (!kit_1.env.getString('TESTKIT_ORG_USERNAME') && this.orgs.size > 0) {
171
170
  for (const org of [...this.orgs.keys()]) {
172
- if (org === 'default')
171
+ if (this.orgsAliases.includes(org))
173
172
  continue;
174
173
  this.debug(`Deleting test org: ${org}`);
175
174
  const rv = shell.exec(`sf env delete scratch -o ${org} -p`, this.shelljsExecOptions);
@@ -247,6 +246,10 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
247
246
  if (org.setDefault) {
248
247
  this.orgs.set('default', jsonOutput.result.authFields);
249
248
  }
249
+ if (org.alias) {
250
+ this.orgsAliases.push(org.alias);
251
+ this.orgs.set(org.alias, jsonOutput.result.authFields);
252
+ }
250
253
  }
251
254
  };
252
255
  let attempts = 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/cli-plugins-testkit",
3
3
  "description": "Provides test utilities to assist Salesforce CLI plug-in authors with writing non-unit tests (NUT).",
4
- "version": "3.0.1",
4
+ "version": "3.0.3",
5
5
  "author": "Salesforce",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "lib/index.js",