@salesforce/source-testkit 1.0.0 → 1.1.0

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
+ ## [1.1.0](https://github.com/salesforcecli/source-testkit/compare/v1.0.2...v1.1.0) (2022-06-06)
6
+
7
+ ### Features
8
+
9
+ - clear StateAggregator ([180ee90](https://github.com/salesforcecli/source-testkit/commit/180ee9081e307ed17948a4c92140ddf7ed5d4da1))
10
+
11
+ ### [1.0.2](https://github.com/salesforcecli/source-testkit/compare/v1.0.1...v1.0.2) (2022-06-06)
12
+
13
+ ### [1.0.1](https://github.com/salesforcecli/source-testkit/compare/v1.0.0...v1.0.1) (2022-05-31)
14
+
15
+ ### Bug Fixes
16
+
17
+ - support multiple plugin-config versions ([#78](https://github.com/salesforcecli/source-testkit/issues/78)) ([365831f](https://github.com/salesforcecli/source-testkit/commit/365831f5de5f489d2f2065230e8847de1ecf4f0b))
18
+
5
19
  ## [1.0.0](https://github.com/salesforcecli/source-testkit/compare/v0.0.18...v1.0.0) (2022-05-31)
6
20
 
7
21
  ### Features
package/lib/testkit.d.ts CHANGED
@@ -199,7 +199,7 @@ export declare class SourceTestkit extends AsyncCreatable<SourceTestkit.Options>
199
199
  */
200
200
  spoofRemoteChange(globs: string[]): Promise<void>;
201
201
  /**
202
- * Returns true if the executable being used belongs to a local pacakage
202
+ * Returns true if the executable being used belongs to a local package
203
203
  */
204
204
  isLocalExecutable(): boolean;
205
205
  /**
package/lib/testkit.js CHANGED
@@ -314,7 +314,7 @@ class SourceTestkit extends kit_1.AsyncCreatable {
314
314
  await this.writeMaxRevision(maxRevision);
315
315
  }
316
316
  /**
317
- * Returns true if the executable being used belongs to a local pacakage
317
+ * Returns true if the executable being used belongs to a local package
318
318
  */
319
319
  isLocalExecutable() {
320
320
  return (this.executable.endsWith(SourceTestkit.LocalDevPath) || this.executable.endsWith(SourceTestkit.LocalProdPath));
@@ -382,8 +382,8 @@ class SourceTestkit extends kit_1.AsyncCreatable {
382
382
  this.metadataResolver = new source_deploy_retrieve_1.MetadataResolver();
383
383
  this.session = await this.createSession();
384
384
  this.projectDir = this.session.project.dir;
385
- const sfdxProject = await core_1.SfdxProject.resolve(this.projectDir);
386
- this.packages = sfdxProject.getPackageDirectories();
385
+ const sfProject = await core_1.SfProject.resolve(this.projectDir);
386
+ this.packages = sfProject.getPackageDirectories();
387
387
  this.packageNames = this.packages.map((p) => p.name);
388
388
  this.packagePaths = this.packages.map((p) => p.fullPath);
389
389
  this.packageGlobs = this.packages.map((p) => `${p.path}/**/*`);
@@ -461,18 +461,24 @@ class SourceTestkit extends kit_1.AsyncCreatable {
461
461
  });
462
462
  }
463
463
  async getDefaultUsername() {
464
- const configVar = this.executableName === Executable.SF ? 'target-org' : core_1.SfdxPropertyKeys.DEFAULT_USERNAME;
465
- const configResult = (0, cli_plugins_testkit_1.execCmd)(`config:get ${configVar} --json`).jsonOutput;
466
- const results = (0, ts_types_1.get)(configResult, 'result', configResult);
467
- const username = results.find((r) => r.key === configVar || r.name === configVar).value;
464
+ var _a, _b;
465
+ const configVar = 'target-org';
466
+ const configResult = (_a = (0, cli_plugins_testkit_1.execCmd)(`config:get ${configVar} --json`).jsonOutput) === null || _a === void 0 ? void 0 : _a.result;
467
+ // depending on which version of config:get the user has available, there may be a name or key
468
+ // eventually, drop the `key` option and the deprecated SfdxPropertyKeys
469
+ const possibleKeys = [configVar, core_1.SfdxPropertyKeys.DEFAULT_USERNAME];
470
+ const username = (_b = configResult === null || configResult === void 0 ? void 0 : configResult.find((r) => (r.key && possibleKeys.includes(r.key)) || (r.name && possibleKeys.includes(r.name)))) === null || _b === void 0 ? void 0 : _b.value;
468
471
  return username;
469
472
  }
470
473
  async createConnection() {
471
474
  if (this.orgless)
472
475
  return;
473
- return await core_1.Connection.create({
476
+ core_1.StateAggregator.clearInstance();
477
+ const conn = await core_1.Connection.create({
474
478
  authInfo: await core_1.AuthInfo.create({ username: this.username }),
475
479
  });
480
+ core_1.StateAggregator.clearInstance();
481
+ return conn;
476
482
  }
477
483
  async doGlob(globs) {
478
484
  const dir = this.projectDir.replace(/\\/g, '/');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/source-testkit",
3
3
  "description": "testkit for running NUTs for source related commands",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "author": "Salesforce",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "lib/index.js",
@@ -30,11 +30,11 @@
30
30
  "!lib/**/*.map"
31
31
  ],
32
32
  "dependencies": {
33
- "@salesforce/cli-plugins-testkit": "^2.0.0",
34
- "@salesforce/core": "^3.19.1",
35
- "@salesforce/kit": "^1.4.5",
33
+ "@salesforce/cli-plugins-testkit": "^2.1.3",
34
+ "@salesforce/core": "^3.19.4",
35
+ "@salesforce/kit": "^1.5.42",
36
36
  "@salesforce/source-deploy-retrieve": "^6.0.2",
37
- "@salesforce/ts-types": "^1.5.5",
37
+ "@salesforce/ts-types": "^1.5.20",
38
38
  "archiver": "^5.2.0",
39
39
  "chai-each": "^0.0.1",
40
40
  "debug": "^4.3.1",
@@ -55,14 +55,14 @@
55
55
  "chai": "^4.3.0",
56
56
  "copyfiles": "^2.4.1",
57
57
  "cz-conventional-changelog": "^3.3.0",
58
- "eslint": "^7.21.0",
58
+ "eslint": "^7.27.0",
59
59
  "eslint-config-prettier": "^8.1.0",
60
60
  "eslint-config-salesforce": "^0.1.6",
61
61
  "eslint-config-salesforce-license": "^0.1.6",
62
62
  "eslint-config-salesforce-typescript": "^0.2.8",
63
63
  "eslint-plugin-header": "^3.1.1",
64
- "eslint-plugin-import": "^2.22.1",
65
- "eslint-plugin-jsdoc": "^32.2.0",
64
+ "eslint-plugin-import": "2.24.2",
65
+ "eslint-plugin-jsdoc": "^35.1.2",
66
66
  "eslint-plugin-prettier": "^3.3.1",
67
67
  "husky": "^7.0.4",
68
68
  "mocha": "^9.1.3",