@salesforce/cli-plugins-testkit 2.0.1 → 2.1.2

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.1.2](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.1.1...v2.1.2) (2022-06-02)
6
+
7
+ ### Bug Fixes
8
+
9
+ - clear globalInfo instance after every possible touchpoint ([ca7dc01](https://github.com/salesforcecli/cli-plugins-testkit/commit/ca7dc012496ec207649e0ef48a6d1fef2ec94f8d))
10
+
11
+ ### [2.1.1](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.1.0...v2.1.1) (2022-06-02)
12
+
13
+ ## [2.1.0](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.0.1...v2.1.0) (2022-06-01)
14
+
15
+ ### Features
16
+
17
+ - native node delete retries ([e4b336f](https://github.com/salesforcecli/cli-plugins-testkit/commit/e4b336f78f57ec1b43daa302c5b4eb2c1fe685c5))
18
+
5
19
  ### [2.0.1](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.0.0...v2.0.1) (2022-06-01)
6
20
 
7
21
  ## [2.0.0](https://github.com/salesforcecli/cli-plugins-testkit/compare/v1.5.35...v2.0.0) (2022-05-31)
package/lib/hubAuth.js CHANGED
@@ -12,6 +12,7 @@ const os = require("os");
12
12
  const fs = require("fs");
13
13
  const shell = require("shelljs");
14
14
  const debug_1 = require("debug");
15
+ const core_1 = require("@salesforce/core");
15
16
  const kit_1 = require("@salesforce/kit");
16
17
  // this seems to be a known eslint error for enums
17
18
  // eslint-disable-next-line no-shadow
@@ -86,6 +87,7 @@ const testkitHubAuth = (homeDir, authStrategy = getAuthStrategy()) => {
86
87
  logger('trying jwt auth');
87
88
  const jwtKey = (0, exports.prepareForJwt)(homeDir);
88
89
  const results = shell.exec(`sfdx auth:jwt:grant -d -u ${kit_1.env.getString('TESTKIT_HUB_USERNAME', '')} -i ${kit_1.env.getString('TESTKIT_JWT_CLIENT_ID', '')} -f ${jwtKey} -r ${kit_1.env.getString('TESTKIT_HUB_INSTANCE', DEFAULT_INSTANCE_URL)}`, execOpts);
90
+ core_1.GlobalInfo.clearInstance();
89
91
  if (results.code !== 0) {
90
92
  throw new Error(`jwt:grant for org ${kit_1.env.getString('TESTKIT_HUB_USERNAME', 'TESTKIT_HUB_USERNAME was not set')} failed with exit code: ${results.code}\n ${results.stdout + results.stderr}`);
91
93
  }
@@ -95,6 +97,7 @@ const testkitHubAuth = (homeDir, authStrategy = getAuthStrategy()) => {
95
97
  logger('trying to authenticate with AuthUrl');
96
98
  const tmpUrl = (0, exports.prepareForAuthUrl)(homeDir);
97
99
  const shellOutput = shell.exec(`sfdx auth:sfdxurl:store -d -f ${tmpUrl}`, execOpts);
100
+ core_1.GlobalInfo.clearInstance();
98
101
  logger(shellOutput);
99
102
  if (shellOutput.code !== 0) {
100
103
  throw new Error(`auth:sfdxurl for url ${tmpUrl} failed with exit code: ${shellOutput.code}\n ${shellOutput.stdout + shellOutput.stderr}`);
@@ -158,6 +161,7 @@ const transferExistingAuthToEnv = (authStrategy = getAuthStrategy()) => {
158
161
  // this is an org from web:auth or auth:url. Generate the authUrl and set in the env
159
162
  logger('copying variables to env from org:display for AuthUrl');
160
163
  const displayContents = JSON.parse(shell.exec(`sfdx force:org:display -u ${devhub} --verbose --json`, execOpts));
164
+ core_1.GlobalInfo.clearInstance();
161
165
  logger(`found ${displayContents.result.sfdxAuthUrl}`);
162
166
  kit_1.env.setString('TESTKIT_AUTH_URL', displayContents.result.sfdxAuthUrl);
163
167
  return;
@@ -10,6 +10,7 @@ exports.TestSession = void 0;
10
10
  const fs = require("fs");
11
11
  const path = require("path");
12
12
  const debug_1 = require("debug");
13
+ const core_1 = require("@salesforce/core");
13
14
  const kit_1 = require("@salesforce/kit");
14
15
  const ts_types_1 = require("@salesforce/ts-types");
15
16
  const sinon_1 = require("sinon");
@@ -182,6 +183,7 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
182
183
  }
183
184
  this.debug('Deleted org result=', rv.stdout);
184
185
  }
186
+ core_1.GlobalInfo.clearInstance();
185
187
  }
186
188
  }
187
189
  async rmSessionDir() {
@@ -190,7 +192,7 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
190
192
  return;
191
193
  }
192
194
  this.debug(`Deleting test session dir: ${this.dir}`);
193
- return fs.promises.rm(this.dir, { recursive: true, force: true });
195
+ return fs.promises.rm(this.dir, { recursive: true, force: true, maxRetries: 100, retryDelay: 2000 });
194
196
  }
195
197
  // Executes commands and keeps track of any orgs created.
196
198
  // Throws if any commands return a non-zero exitCode.
@@ -273,6 +275,8 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
273
275
  await this.sleep(timeout);
274
276
  }
275
277
  }
278
+ // there may be globalInfo touches from org:create or other setup commands run
279
+ core_1.GlobalInfo.clearInstance();
276
280
  }
277
281
  async sleep(duration) {
278
282
  await (0, kit_1.sleep)(duration);
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": "2.0.1",
4
+ "version": "2.1.2",
5
5
  "author": "Salesforce",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "lib/index.js",