@salesforce/cli-plugins-testkit 2.3.7 → 2.3.10

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,12 @@
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.3.10](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.3.9...v2.3.10) (2022-08-02)
6
+
7
+ ### [2.3.9](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.3.8...v2.3.9) (2022-08-02)
8
+
9
+ ### [2.3.8](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.3.7...v2.3.8) (2022-08-02)
10
+
5
11
  ### [2.3.7](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.3.6...v2.3.7) (2022-08-02)
6
12
 
7
13
  ### [2.3.6](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.3.5...v2.3.6) (2022-08-01)
package/lib/execCmd.js CHANGED
@@ -65,9 +65,8 @@ const getExitCodeError = (cmd, expectedCode, output) => {
65
65
  * @returns The command string with CLI executable. E.g., `"node_modules/bin/sfdx force:user:create -a testuser1"`
66
66
  */
67
67
  const buildCmd = (cmdArgs, options) => {
68
- var _a;
69
68
  const debug = (0, debug_1.default)('testkit:buildCmd');
70
- const bin = (_a = kit_1.env.getString('TESTKIT_EXECUTABLE_PATH')) !== null && _a !== void 0 ? _a : (0, path_1.join)('bin', 'dev');
69
+ const bin = kit_1.env.getString('TESTKIT_EXECUTABLE_PATH') ?? (0, path_1.join)('bin', 'dev');
71
70
  const which = shelljs.which(bin);
72
71
  let resolvedPath = (0, path_1.resolve)(bin);
73
72
  // If which finds the path in the system path, use that.
@@ -79,7 +78,7 @@ const buildCmd = (cmdArgs, options) => {
79
78
  }
80
79
  debug(`Using executable path: ${bin}`);
81
80
  debug(`Resolved executable path: ${resolvedPath}`);
82
- if ((options === null || options === void 0 ? void 0 : options.answers) && process.platform !== 'win32') {
81
+ if (options?.answers && process.platform !== 'win32') {
83
82
  return `printf "${options.answers.join('\\n')}" | ${bin} ${cmdArgs}`;
84
83
  }
85
84
  else {
@@ -40,7 +40,7 @@ class TestProject {
40
40
  this.shelljsExecOptions.shell = shellOverride;
41
41
  }
42
42
  // Copy a dir containing a SFDX project to a dir for testing.
43
- if (options === null || options === void 0 ? void 0 : options.sourceDir) {
43
+ if (options?.sourceDir) {
44
44
  const rv = shell.cp('-r', options.sourceDir, destDir);
45
45
  if (rv.code !== 0) {
46
46
  throw new Error(`project copy failed with error:\n${rv.stderr}`);
@@ -48,7 +48,7 @@ class TestProject {
48
48
  this.dir = path.join(destDir, path.basename(options.sourceDir));
49
49
  }
50
50
  // Clone a git repo containing a SFDX project in a dir for testing.
51
- else if (options === null || options === void 0 ? void 0 : options.gitClone) {
51
+ else if (options?.gitClone) {
52
52
  // verify git is found
53
53
  if (!shell.which('git')) {
54
54
  throw new Error('git executable not found for creating a project from a git clone');
@@ -87,8 +87,8 @@ class TestProject {
87
87
  * @returns The created zip file path.
88
88
  */
89
89
  async zip(name, destDir) {
90
- name !== null && name !== void 0 ? name : (name = `${path.basename(this.dir)}.zip`);
91
- destDir !== null && destDir !== void 0 ? destDir : (destDir = path.dirname(this.dir));
90
+ name ?? (name = `${path.basename(this.dir)}.zip`);
91
+ destDir ?? (destDir = path.dirname(this.dir));
92
92
  return this.zipDir({ name, sourceDir: this.dir, destDir });
93
93
  }
94
94
  }
@@ -146,13 +146,12 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
146
146
  */
147
147
  async zip(name, destDir) {
148
148
  if (kit_1.env.getBoolean('TESTKIT_ENABLE_ZIP')) {
149
- name !== null && name !== void 0 ? name : (name = `${path.basename(this.dir)}.zip`);
150
- destDir !== null && destDir !== void 0 ? destDir : (destDir = path.dirname(this.dir));
149
+ name ?? (name = `${path.basename(this.dir)}.zip`);
150
+ destDir ?? (destDir = path.dirname(this.dir));
151
151
  return this.zipDir({ name, sourceDir: this.dir, destDir });
152
152
  }
153
153
  }
154
154
  async init() {
155
- var _a;
156
155
  // Run all setup commands
157
156
  await this.setupCommands(this.options.setupCommands);
158
157
  this.debug('Created testkit session:');
@@ -160,7 +159,7 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
160
159
  this.debug(` Created Date: ${this.createdDate}`);
161
160
  this.debug(` Dir: ${this.dir}`);
162
161
  this.debug(` Home Dir: ${this.homeDir}`);
163
- if ((_a = this.orgs) === null || _a === void 0 ? void 0 : _a.length) {
162
+ if (this.orgs?.length) {
164
163
  this.debug(' Orgs: ', this.orgs);
165
164
  }
166
165
  if (this.project) {
@@ -168,8 +167,7 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
168
167
  }
169
168
  }
170
169
  async deleteOrgs() {
171
- var _a;
172
- if (!kit_1.env.getString('TESTKIT_ORG_USERNAME') && ((_a = this.orgs) === null || _a === void 0 ? void 0 : _a.length)) {
170
+ if (!kit_1.env.getString('TESTKIT_ORG_USERNAME') && this.orgs?.length) {
173
171
  const orgs = this.orgs.slice();
174
172
  for (const org of orgs) {
175
173
  this.debug(`Deleting test org: ${org}`);
@@ -195,7 +193,6 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
195
193
  // Executes commands and keeps track of any orgs created.
196
194
  // Throws if any commands return a non-zero exitCode.
197
195
  async setupCommands(cmds) {
198
- var _a;
199
196
  const dbug = (0, debug_1.debug)('testkit:setupCommands');
200
197
  const setup = () => {
201
198
  if (cmds) {
@@ -256,7 +253,7 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
256
253
  };
257
254
  let attempts = 0;
258
255
  let completed = false;
259
- const timeout = new kit_1.Duration((_a = kit_1.env.getNumber('TESTKIT_SETUP_RETRIES_TIMEOUT')) !== null && _a !== void 0 ? _a : 5000, kit_1.Duration.Unit.MILLISECONDS);
256
+ const timeout = new kit_1.Duration(kit_1.env.getNumber('TESTKIT_SETUP_RETRIES_TIMEOUT') ?? 5000, kit_1.Duration.Unit.MILLISECONDS);
260
257
  while (!completed && attempts <= this.setupRetries) {
261
258
  try {
262
259
  dbug(`Executing setup commands (attempt ${attempts + 1} of ${this.setupRetries + 1})`);
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.3.7",
4
+ "version": "2.3.10",
5
5
  "author": "Salesforce",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "lib/index.js",