@salesforce/source-testkit 0.0.15 → 0.0.18

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,102 +2,102 @@
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
- ### [0.0.15](https://github.com/salesforcecli/source-testkit/compare/v0.0.14...v0.0.15) (2021-09-29)
5
+ ### [0.0.18](https://github.com/salesforcecli/source-testkit/compare/v0.0.17...v0.0.18) (2022-03-08)
6
+
7
+ ### Features
6
8
 
9
+ - make type changes to make testing sf easier ([#59](https://github.com/salesforcecli/source-testkit/issues/59)) ([7752ed6](https://github.com/salesforcecli/source-testkit/commit/7752ed66eff3be11c9fa6921223f277427334fab))
10
+
11
+ ### [0.0.17](https://github.com/salesforcecli/source-testkit/compare/v0.0.16...v0.0.17) (2022-02-12)
12
+
13
+ ### [0.0.16](https://github.com/salesforcecli/source-testkit/compare/v0.0.15...v0.0.16) (2021-10-13)
7
14
 
8
15
  ### Bug Fixes
9
16
 
10
- * use appropriate config key based on executable ([cc36ff8](https://github.com/salesforcecli/source-testkit/commit/cc36ff859c4fc7e4645043cccbd39b75c0cc253c))
17
+ - add support for simple retrieve metadata for sf ([#12](https://github.com/salesforcecli/source-testkit/issues/12)) ([85a940d](https://github.com/salesforcecli/source-testkit/commit/85a940d008370ae86a9796904e8aa29c29241c2f))
11
18
 
12
- ### [0.0.14](https://github.com/salesforcecli/source-testkit/compare/v0.0.13...v0.0.14) (2021-09-08)
19
+ ### [0.0.15](https://github.com/salesforcecli/source-testkit/compare/v0.0.14...v0.0.15) (2021-09-29)
20
+
21
+ ### Bug Fixes
13
22
 
23
+ - use appropriate config key based on executable ([cc36ff8](https://github.com/salesforcecli/source-testkit/commit/cc36ff859c4fc7e4645043cccbd39b75c0cc253c))
24
+
25
+ ### [0.0.14](https://github.com/salesforcecli/source-testkit/compare/v0.0.13...v0.0.14) (2021-09-08)
14
26
 
15
27
  ### Bug Fixes
16
28
 
17
- * convert correct sep ([#10](https://github.com/salesforcecli/source-testkit/issues/10)) ([6b9356b](https://github.com/salesforcecli/source-testkit/commit/6b9356b537932dd485cf448b6bdb0ab64c15a5f0))
29
+ - convert correct sep ([#10](https://github.com/salesforcecli/source-testkit/issues/10)) ([6b9356b](https://github.com/salesforcecli/source-testkit/commit/6b9356b537932dd485cf448b6bdb0ab64c15a5f0))
18
30
 
19
31
  ### [0.0.13](https://github.com/salesforcecli/source-testkit/compare/v0.0.12...v0.0.13) (2021-09-01)
20
32
 
21
33
  ### [0.0.12](https://github.com/salesforcecli/source-testkit/compare/v0.0.11...v0.0.12) (2021-09-01)
22
34
 
23
-
24
35
  ### Bug Fixes
25
36
 
26
- * add filesToBeDeployedViaResult method ([#8](https://github.com/salesforcecli/source-testkit/issues/8)) ([bfc45b6](https://github.com/salesforcecli/source-testkit/commit/bfc45b6d42bded3e49e0ba2bea511e9a611da0bd))
37
+ - add filesToBeDeployedViaResult method ([#8](https://github.com/salesforcecli/source-testkit/issues/8)) ([bfc45b6](https://github.com/salesforcecli/source-testkit/commit/bfc45b6d42bded3e49e0ba2bea511e9a611da0bd))
27
38
 
28
39
  ### [0.0.11](https://github.com/salesforcecli/source-testkit/compare/v0.0.10...v0.0.11) (2021-08-17)
29
40
 
30
-
31
41
  ### Bug Fixes
32
42
 
33
- * ensure file history exists when testing if local files have changed ([01eea46](https://github.com/salesforcecli/source-testkit/commit/01eea46baf613b639edf02a3da568290fe3335b1))
43
+ - ensure file history exists when testing if local files have changed ([01eea46](https://github.com/salesforcecli/source-testkit/commit/01eea46baf613b639edf02a3da568290fe3335b1))
34
44
 
35
45
  ### [0.0.10](https://github.com/salesforcecli/source-testkit/compare/v0.0.9...v0.0.10) (2021-08-06)
36
46
 
37
-
38
47
  ### Features
39
48
 
40
- * use SDR 4 ([#6](https://github.com/salesforcecli/source-testkit/issues/6)) ([c0cab8f](https://github.com/salesforcecli/source-testkit/commit/c0cab8fc623560f18107e65f61e270c1c1bcd16e))
49
+ - use SDR 4 ([#6](https://github.com/salesforcecli/source-testkit/issues/6)) ([c0cab8f](https://github.com/salesforcecli/source-testkit/commit/c0cab8fc623560f18107e65f61e270c1c1bcd16e))
41
50
 
42
51
  ### [0.0.9](https://github.com/salesforcecli/source-testkit/compare/v0.0.8...v0.0.9) (2021-07-26)
43
52
 
44
-
45
53
  ### Bug Fixes
46
54
 
47
- * make sf friendly ([0f93b9a](https://github.com/salesforcecli/source-testkit/commit/0f93b9a16c62a74e4b4d6b5e945d8252ca4ec5cb))
55
+ - make sf friendly ([0f93b9a](https://github.com/salesforcecli/source-testkit/commit/0f93b9a16c62a74e4b4d6b5e945d8252ca4ec5cb))
48
56
 
49
57
  ### [0.0.8](https://github.com/salesforcecli/source-testkit/compare/v0.0.7...v0.0.8) (2021-07-15)
50
58
 
51
-
52
59
  ### Bug Fixes
53
60
 
54
- * rename sf project deploy ([5d3f52e](https://github.com/salesforcecli/source-testkit/commit/5d3f52ed742f57a15515606c2e543b9fd356c8ce))
61
+ - rename sf project deploy ([5d3f52e](https://github.com/salesforcecli/source-testkit/commit/5d3f52ed742f57a15515606c2e543b9fd356c8ce))
55
62
 
56
63
  ### [0.0.7](https://github.com/salesforcecli/source-testkit/compare/v0.0.6...v0.0.7) (2021-07-09)
57
64
 
58
-
59
65
  ### Bug Fixes
60
66
 
61
- * executionLog ([8ec172c](https://github.com/salesforcecli/source-testkit/commit/8ec172c07267a1d55e35807a6782e4d222ca246c))
67
+ - executionLog ([8ec172c](https://github.com/salesforcecli/source-testkit/commit/8ec172c07267a1d55e35807a6782e4d222ca246c))
62
68
 
63
69
  ### [0.0.6](https://github.com/salesforcecli/source-testkit/compare/v0.0.5...v0.0.6) (2021-07-06)
64
70
 
65
-
66
71
  ### Features
67
72
 
68
- * make execute method public ([3ff8eca](https://github.com/salesforcecli/source-testkit/commit/3ff8ecad8eeb8061ccaf3e8945f4126102c8c519))
73
+ - make execute method public ([3ff8eca](https://github.com/salesforcecli/source-testkit/commit/3ff8ecad8eeb8061ccaf3e8945f4126102c8c519))
69
74
 
70
75
  ### [0.0.5](https://github.com/salesforcecli/source-testkit/compare/v0.0.4...v0.0.5) (2021-05-25)
71
76
 
72
-
73
77
  ### Bug Fixes
74
78
 
75
- * convert Metadataresolver file paths to match glob results ([#4](https://github.com/salesforcecli/source-testkit/issues/4)) ([fb78972](https://github.com/salesforcecli/source-testkit/commit/fb789726cb15e436fc9dbe3e3647697a7027ac96))
79
+ - convert Metadataresolver file paths to match glob results ([#4](https://github.com/salesforcecli/source-testkit/issues/4)) ([fb78972](https://github.com/salesforcecli/source-testkit/commit/fb789726cb15e436fc9dbe3e3647697a7027ac96))
76
80
 
77
81
  ### [0.0.4](https://github.com/salesforcecli/source-testkit/compare/v0.0.3...v0.0.4) (2021-05-24)
78
82
 
79
-
80
83
  ### Bug Fixes
81
84
 
82
- * add assignPermissionSet, assign/create commands ([#3](https://github.com/salesforcecli/source-testkit/issues/3)) ([e423bba](https://github.com/salesforcecli/source-testkit/commit/e423bbae3acd217dd4708efad15af83996b0ff1e))
85
+ - add assignPermissionSet, assign/create commands ([#3](https://github.com/salesforcecli/source-testkit/issues/3)) ([e423bba](https://github.com/salesforcecli/source-testkit/commit/e423bbae3acd217dd4708efad15af83996b0ff1e))
83
86
 
84
87
  ### [0.0.3](https://github.com/salesforcecli/source-testkit/compare/v0.0.2...v0.0.3) (2021-05-17)
85
88
 
86
-
87
89
  ### Features
88
90
 
89
- * support sf commands ([#2](https://github.com/salesforcecli/source-testkit/issues/2)) ([6152e52](https://github.com/salesforcecli/source-testkit/commit/6152e52790d9ba4561621fd625fef78b2f0028d2))
91
+ - support sf commands ([#2](https://github.com/salesforcecli/source-testkit/issues/2)) ([6152e52](https://github.com/salesforcecli/source-testkit/commit/6152e52790d9ba4561621fd625fef78b2f0028d2))
90
92
 
91
93
  ### [0.0.2](https://github.com/salesforcecli/source-testkit/compare/v0.0.1...v0.0.2) (2021-05-14)
92
94
 
93
-
94
95
  ### Features
95
96
 
96
- * add new methods ([fa0579a](https://github.com/salesforcecli/source-testkit/commit/fa0579a3513e01c6bed7c88eb8b656dadcc40d62))
97
+ - add new methods ([fa0579a](https://github.com/salesforcecli/source-testkit/commit/fa0579a3513e01c6bed7c88eb8b656dadcc40d62))
97
98
 
98
99
  ### 0.0.1 (2021-05-14)
99
100
 
100
-
101
101
  ### Features
102
102
 
103
- * add SourceTestkit ([#1](https://github.com/salesforcecli/source-testkit/issues/1)) ([99f30f3](https://github.com/salesforcecli/source-testkit/commit/99f30f3b2d8a14438808114d3d11c6d9d6f4d684))
103
+ - add SourceTestkit ([#1](https://github.com/salesforcecli/source-testkit/issues/1)) ([99f30f3](https://github.com/salesforcecli/source-testkit/commit/99f30f3b2d8a14438808114d3d11c6d9d6f4d684))
package/LICENSE.txt ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2022, Salesforce.com, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -40,6 +40,10 @@ export declare class Assertions {
40
40
  * Finds all files in project based on the provided globs and expects them to be updated on the server
41
41
  */
42
42
  filesToBeDeployed(globs: string[], ignore?: string[], deployCommand?: string): Promise<void>;
43
+ /**
44
+ * Finds all files in project based on the provided globs and expects them to be retrieved from the server
45
+ */
46
+ filesToBeRetrieved(globs: string[], ignore?: string[], retrieveCommand?: string): Promise<void>;
43
47
  /**
44
48
  * Finds all files in project based on the provided globs and expects them to be updated on the server by comparing to what was returned in the FileResponse[]
45
49
  */
package/lib/assertions.js CHANGED
@@ -87,6 +87,12 @@ class Assertions {
87
87
  async filesToBeDeployed(globs, ignore = [], deployCommand = this.commands.deploy) {
88
88
  await this.filesToBeUpdated(globs, ignore, deployCommand);
89
89
  }
90
+ /**
91
+ * Finds all files in project based on the provided globs and expects them to be retrieved from the server
92
+ */
93
+ async filesToBeRetrieved(globs, ignore = [], retrieveCommand = this.commands.retrieve) {
94
+ await this.filesToBeUpdated(globs, ignore, retrieveCommand);
95
+ }
90
96
  /**
91
97
  * Finds all files in project based on the provided globs and expects them to be updated on the server by comparing to what was returned in the FileResponse[]
92
98
  */
package/lib/testkit.d.ts CHANGED
@@ -58,9 +58,9 @@ export declare class SourceTestkit extends AsyncCreatable<SourceTestkit.Options>
58
58
  /**
59
59
  * Executes force:source:deploy
60
60
  */
61
- deploy(options?: Partial<SourceTestkit.CommandOpts>): Promise<Result<{
61
+ deploy<T = {
62
62
  id: string;
63
- }>>;
63
+ }>(options?: Partial<SourceTestkit.CommandOpts>): Promise<Result<T>>;
64
64
  /**
65
65
  * Executes force:source:deploy:report
66
66
  */
@@ -257,5 +257,6 @@ export declare const COMMANDS: {
257
257
  };
258
258
  sf: {
259
259
  deploy: string;
260
+ retrieve: string;
260
261
  };
261
262
  };
package/lib/testkit.js CHANGED
@@ -346,7 +346,7 @@ class SourceTestkit extends kit_1.AsyncCreatable {
346
346
  ? cli_plugins_testkit_1.execCmd(command, { ensureExitCode: exitCode, cli: 'sf' })
347
347
  : cli_plugins_testkit_1.execCmd(command, { ensureExitCode: exitCode, cli: 'sfdx' });
348
348
  await this.fileTracker.updateAll(`POST: ${command}`);
349
- if (json && this.executableName === Executable.SFDX) {
349
+ if (json) {
350
350
  const jsonOutput = result.jsonOutput;
351
351
  this.debug('%O', jsonOutput);
352
352
  if (!jsonOutput) {
@@ -361,18 +361,10 @@ class SourceTestkit extends kit_1.AsyncCreatable {
361
361
  }
362
362
  return jsonOutput;
363
363
  }
364
- if (json && this.executableName === Executable.SF) {
365
- const jsonOutput = result.jsonOutput;
366
- this.debug('%O', jsonOutput);
367
- if (!jsonOutput) {
368
- console.error(`${command} returned null jsonOutput`);
369
- console.error(result);
370
- }
371
- return jsonOutput;
372
- }
373
364
  }
374
365
  catch (err) {
375
- await this.handleError(err);
366
+ const error = err;
367
+ await this.handleError(error);
376
368
  }
377
369
  }
378
370
  async init() {
@@ -410,7 +402,8 @@ class SourceTestkit extends kit_1.AsyncCreatable {
410
402
  .map((f) => f.replace(`${this.testMetadataFolder}${path.sep}`, ''));
411
403
  }
412
404
  catch (err) {
413
- await this.handleError(err, true);
405
+ const error = err;
406
+ await this.handleError(error, true);
414
407
  }
415
408
  }
416
409
  async getExecutableName() {
@@ -521,6 +514,7 @@ exports.COMMANDS = {
521
514
  },
522
515
  [Executable.SF]: {
523
516
  deploy: 'deploy metadata',
517
+ retrieve: 'retrieve metadata',
524
518
  },
525
519
  };
526
520
  //# sourceMappingURL=testkit.js.map
package/lib/types.d.ts CHANGED
@@ -1,11 +1,9 @@
1
1
  import { Connection } from '@salesforce/core';
2
2
  import { JsonCollection, JsonMap, Nullable } from '@salesforce/ts-types';
3
- export declare type SfdxResult<T = JsonMap> = Nullable<JsonMap & {
3
+ export declare type Result<T = JsonCollection> = Nullable<JsonMap & {
4
4
  status: number;
5
5
  result: T;
6
6
  }>;
7
- export declare type SfResult<T = JsonCollection> = Nullable<T>;
8
- export declare type Result<T = JsonCollection> = SfdxResult<T> | SfResult<T>;
9
7
  export declare type Context = {
10
8
  projectDir: string;
11
9
  connection: Nullable<Connection>;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@salesforce/source-testkit",
3
3
  "description": "testkit for running NUTs for source related commands",
4
- "version": "0.0.15",
4
+ "version": "0.0.18",
5
5
  "author": "Salesforce",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "lib/index.js",
8
8
  "types": "lib/index.d.ts",
9
- "repository": "https://github.com/salesforcecli/source-testkit",
9
+ "repository": "salesforcecli/source-testkit",
10
10
  "scripts": {
11
11
  "build": "sf-build && yarn copy-metadata",
12
12
  "ci-docs": "yarn sf-ci-docs",
@@ -19,8 +19,9 @@
19
19
  "lint": "sf-lint",
20
20
  "lint-fix": "yarn sf-lint --fix",
21
21
  "prepack": "sf-prepack && yarn copy-metadata",
22
+ "prepare": "sf-install",
22
23
  "pretest": "sf-compile-test",
23
- "test": "sf-test --require ts-node/register"
24
+ "test": "sf-test"
24
25
  },
25
26
  "files": [
26
27
  "docs",
@@ -28,13 +29,6 @@
28
29
  "messages",
29
30
  "!lib/**/*.map"
30
31
  ],
31
- "husky": {
32
- "hooks": {
33
- "commit-msg": "sf-husky-commit-msg",
34
- "pre-commit": "sf-husky-pre-commit",
35
- "pre-push": "sf-husky-pre-push"
36
- }
37
- },
38
32
  "dependencies": {
39
33
  "@salesforce/cli-plugins-testkit": "^1.2.0",
40
34
  "@salesforce/core": "^2.20.11",
@@ -49,14 +43,13 @@
49
43
  "strip-ansi": "^6.0.0"
50
44
  },
51
45
  "devDependencies": {
52
- "@salesforce/dev-config": "^2.0.0",
53
- "@salesforce/dev-scripts": "^0.9.1",
46
+ "@salesforce/dev-config": "^3.0.0",
47
+ "@salesforce/dev-scripts": "^2.0.0",
54
48
  "@salesforce/prettier-config": "^0.0.2",
55
49
  "@salesforce/ts-sinon": "^1.3.5",
56
50
  "@types/archiver": "^5.1.0",
57
51
  "@types/debug": "^4.1.5",
58
52
  "@types/shelljs": "^0.8.8",
59
- "@types/sinon": "^9.0.10",
60
53
  "@typescript-eslint/eslint-plugin": "^4.15.2",
61
54
  "@typescript-eslint/parser": "^4.15.2",
62
55
  "chai": "^4.3.0",
@@ -64,19 +57,20 @@
64
57
  "cz-conventional-changelog": "^3.3.0",
65
58
  "eslint": "^7.21.0",
66
59
  "eslint-config-prettier": "^8.1.0",
67
- "eslint-config-salesforce": "^0.1.0",
68
- "eslint-config-salesforce-license": "^0.1.0",
69
- "eslint-config-salesforce-typescript": "^0.2.0",
60
+ "eslint-config-salesforce": "^0.1.6",
61
+ "eslint-config-salesforce-license": "^0.1.6",
62
+ "eslint-config-salesforce-typescript": "^0.2.7",
70
63
  "eslint-plugin-header": "^3.1.1",
71
64
  "eslint-plugin-import": "^2.22.1",
72
65
  "eslint-plugin-jsdoc": "^32.2.0",
73
66
  "eslint-plugin-prettier": "^3.3.1",
74
- "husky": "^4.2.5",
75
- "mocha": "^8.3.0",
67
+ "husky": "^7.0.4",
68
+ "mocha": "^9.1.3",
76
69
  "nyc": "^15.1.0",
77
70
  "prettier": "^2.0.5",
78
71
  "pretty-quick": "^3.1.0",
79
- "ts-node": "^9.1.1",
72
+ "sinon": "^10.0.0",
73
+ "ts-node": "^10.0.0",
80
74
  "typescript": "^4.1.3"
81
75
  },
82
76
  "config": {