@salesforce/source-testkit 0.0.13 → 0.0.17
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 +32 -24
- package/LICENSE.txt +12 -0
- package/lib/assertions.d.ts +4 -0
- package/lib/assertions.js +9 -5
- package/lib/testkit.d.ts +1 -0
- package/lib/testkit.js +8 -7
- package/package.json +13 -19
package/CHANGELOG.md
CHANGED
|
@@ -2,88 +2,96 @@
|
|
|
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.17](https://github.com/salesforcecli/source-testkit/compare/v0.0.16...v0.0.17) (2022-02-12)
|
|
6
|
+
|
|
7
|
+
### [0.0.16](https://github.com/salesforcecli/source-testkit/compare/v0.0.15...v0.0.16) (2021-10-13)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- 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))
|
|
12
|
+
|
|
13
|
+
### [0.0.15](https://github.com/salesforcecli/source-testkit/compare/v0.0.14...v0.0.15) (2021-09-29)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- use appropriate config key based on executable ([cc36ff8](https://github.com/salesforcecli/source-testkit/commit/cc36ff859c4fc7e4645043cccbd39b75c0cc253c))
|
|
18
|
+
|
|
19
|
+
### [0.0.14](https://github.com/salesforcecli/source-testkit/compare/v0.0.13...v0.0.14) (2021-09-08)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- convert correct sep ([#10](https://github.com/salesforcecli/source-testkit/issues/10)) ([6b9356b](https://github.com/salesforcecli/source-testkit/commit/6b9356b537932dd485cf448b6bdb0ab64c15a5f0))
|
|
24
|
+
|
|
5
25
|
### [0.0.13](https://github.com/salesforcecli/source-testkit/compare/v0.0.12...v0.0.13) (2021-09-01)
|
|
6
26
|
|
|
7
27
|
### [0.0.12](https://github.com/salesforcecli/source-testkit/compare/v0.0.11...v0.0.12) (2021-09-01)
|
|
8
28
|
|
|
9
|
-
|
|
10
29
|
### Bug Fixes
|
|
11
30
|
|
|
12
|
-
|
|
31
|
+
- add filesToBeDeployedViaResult method ([#8](https://github.com/salesforcecli/source-testkit/issues/8)) ([bfc45b6](https://github.com/salesforcecli/source-testkit/commit/bfc45b6d42bded3e49e0ba2bea511e9a611da0bd))
|
|
13
32
|
|
|
14
33
|
### [0.0.11](https://github.com/salesforcecli/source-testkit/compare/v0.0.10...v0.0.11) (2021-08-17)
|
|
15
34
|
|
|
16
|
-
|
|
17
35
|
### Bug Fixes
|
|
18
36
|
|
|
19
|
-
|
|
37
|
+
- ensure file history exists when testing if local files have changed ([01eea46](https://github.com/salesforcecli/source-testkit/commit/01eea46baf613b639edf02a3da568290fe3335b1))
|
|
20
38
|
|
|
21
39
|
### [0.0.10](https://github.com/salesforcecli/source-testkit/compare/v0.0.9...v0.0.10) (2021-08-06)
|
|
22
40
|
|
|
23
|
-
|
|
24
41
|
### Features
|
|
25
42
|
|
|
26
|
-
|
|
43
|
+
- use SDR 4 ([#6](https://github.com/salesforcecli/source-testkit/issues/6)) ([c0cab8f](https://github.com/salesforcecli/source-testkit/commit/c0cab8fc623560f18107e65f61e270c1c1bcd16e))
|
|
27
44
|
|
|
28
45
|
### [0.0.9](https://github.com/salesforcecli/source-testkit/compare/v0.0.8...v0.0.9) (2021-07-26)
|
|
29
46
|
|
|
30
|
-
|
|
31
47
|
### Bug Fixes
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
- make sf friendly ([0f93b9a](https://github.com/salesforcecli/source-testkit/commit/0f93b9a16c62a74e4b4d6b5e945d8252ca4ec5cb))
|
|
34
50
|
|
|
35
51
|
### [0.0.8](https://github.com/salesforcecli/source-testkit/compare/v0.0.7...v0.0.8) (2021-07-15)
|
|
36
52
|
|
|
37
|
-
|
|
38
53
|
### Bug Fixes
|
|
39
54
|
|
|
40
|
-
|
|
55
|
+
- rename sf project deploy ([5d3f52e](https://github.com/salesforcecli/source-testkit/commit/5d3f52ed742f57a15515606c2e543b9fd356c8ce))
|
|
41
56
|
|
|
42
57
|
### [0.0.7](https://github.com/salesforcecli/source-testkit/compare/v0.0.6...v0.0.7) (2021-07-09)
|
|
43
58
|
|
|
44
|
-
|
|
45
59
|
### Bug Fixes
|
|
46
60
|
|
|
47
|
-
|
|
61
|
+
- executionLog ([8ec172c](https://github.com/salesforcecli/source-testkit/commit/8ec172c07267a1d55e35807a6782e4d222ca246c))
|
|
48
62
|
|
|
49
63
|
### [0.0.6](https://github.com/salesforcecli/source-testkit/compare/v0.0.5...v0.0.6) (2021-07-06)
|
|
50
64
|
|
|
51
|
-
|
|
52
65
|
### Features
|
|
53
66
|
|
|
54
|
-
|
|
67
|
+
- make execute method public ([3ff8eca](https://github.com/salesforcecli/source-testkit/commit/3ff8ecad8eeb8061ccaf3e8945f4126102c8c519))
|
|
55
68
|
|
|
56
69
|
### [0.0.5](https://github.com/salesforcecli/source-testkit/compare/v0.0.4...v0.0.5) (2021-05-25)
|
|
57
70
|
|
|
58
|
-
|
|
59
71
|
### Bug Fixes
|
|
60
72
|
|
|
61
|
-
|
|
73
|
+
- 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))
|
|
62
74
|
|
|
63
75
|
### [0.0.4](https://github.com/salesforcecli/source-testkit/compare/v0.0.3...v0.0.4) (2021-05-24)
|
|
64
76
|
|
|
65
|
-
|
|
66
77
|
### Bug Fixes
|
|
67
78
|
|
|
68
|
-
|
|
79
|
+
- add assignPermissionSet, assign/create commands ([#3](https://github.com/salesforcecli/source-testkit/issues/3)) ([e423bba](https://github.com/salesforcecli/source-testkit/commit/e423bbae3acd217dd4708efad15af83996b0ff1e))
|
|
69
80
|
|
|
70
81
|
### [0.0.3](https://github.com/salesforcecli/source-testkit/compare/v0.0.2...v0.0.3) (2021-05-17)
|
|
71
82
|
|
|
72
|
-
|
|
73
83
|
### Features
|
|
74
84
|
|
|
75
|
-
|
|
85
|
+
- support sf commands ([#2](https://github.com/salesforcecli/source-testkit/issues/2)) ([6152e52](https://github.com/salesforcecli/source-testkit/commit/6152e52790d9ba4561621fd625fef78b2f0028d2))
|
|
76
86
|
|
|
77
87
|
### [0.0.2](https://github.com/salesforcecli/source-testkit/compare/v0.0.1...v0.0.2) (2021-05-14)
|
|
78
88
|
|
|
79
|
-
|
|
80
89
|
### Features
|
|
81
90
|
|
|
82
|
-
|
|
91
|
+
- add new methods ([fa0579a](https://github.com/salesforcecli/source-testkit/commit/fa0579a3513e01c6bed7c88eb8b656dadcc40d62))
|
|
83
92
|
|
|
84
93
|
### 0.0.1 (2021-05-14)
|
|
85
94
|
|
|
86
|
-
|
|
87
95
|
### Features
|
|
88
96
|
|
|
89
|
-
|
|
97
|
+
- 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.
|
package/lib/assertions.d.ts
CHANGED
|
@@ -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,18 +87,22 @@ 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
|
*/
|
|
93
99
|
async filesToBeDeployedViaResult(globs, ignore = [], result) {
|
|
94
100
|
const all = await this.doGlob(globs);
|
|
95
101
|
const ignoreFiles = await this.doGlob(ignore, false);
|
|
96
|
-
|
|
102
|
+
// glob will return files with '/' as separators, this won't work on Windows
|
|
103
|
+
const toTrack = all.filter((file) => !ignoreFiles.includes(file)).map((file) => file.replace(/\//g, path.sep));
|
|
97
104
|
result.map((source) => {
|
|
98
|
-
|
|
99
|
-
// glob will return files with '/' as separators, this won't work on Windows
|
|
100
|
-
const normalizedFilePath = ((_a = source.filePath) !== null && _a !== void 0 ? _a : '').replace(/\//g, path.sep);
|
|
101
|
-
chai_1.expect(toTrack, `toTrack: ${toTrack.join('\n')}, missing file : ${normalizedFilePath}`).to.include(normalizedFilePath);
|
|
105
|
+
chai_1.expect(toTrack, `toTrack: ${toTrack.join('\n')}, missing file : ${source.filePath}`).to.include(source.filePath);
|
|
102
106
|
});
|
|
103
107
|
}
|
|
104
108
|
/**
|
package/lib/testkit.d.ts
CHANGED
package/lib/testkit.js
CHANGED
|
@@ -372,7 +372,8 @@ class SourceTestkit extends kit_1.AsyncCreatable {
|
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
catch (err) {
|
|
375
|
-
|
|
375
|
+
const error = err;
|
|
376
|
+
await this.handleError(error);
|
|
376
377
|
}
|
|
377
378
|
}
|
|
378
379
|
async init() {
|
|
@@ -410,7 +411,8 @@ class SourceTestkit extends kit_1.AsyncCreatable {
|
|
|
410
411
|
.map((f) => f.replace(`${this.testMetadataFolder}${path.sep}`, ''));
|
|
411
412
|
}
|
|
412
413
|
catch (err) {
|
|
413
|
-
|
|
414
|
+
const error = err;
|
|
415
|
+
await this.handleError(error, true);
|
|
414
416
|
}
|
|
415
417
|
}
|
|
416
418
|
async getExecutableName() {
|
|
@@ -466,12 +468,10 @@ class SourceTestkit extends kit_1.AsyncCreatable {
|
|
|
466
468
|
});
|
|
467
469
|
}
|
|
468
470
|
async getDefaultUsername() {
|
|
469
|
-
const
|
|
471
|
+
const configVar = this.executableName === Executable.SF ? 'target-org' : core_1.Config.DEFAULT_USERNAME;
|
|
472
|
+
const configResult = cli_plugins_testkit_1.execCmd(`config:get ${configVar} --json`).jsonOutput;
|
|
470
473
|
const results = ts_types_1.get(configResult, 'result', configResult);
|
|
471
|
-
const username = results.find((r) => r.key ===
|
|
472
|
-
if (this.executableName === Executable.SF) {
|
|
473
|
-
cli_plugins_testkit_1.execCmd(`config:set target-org ${username} --json`);
|
|
474
|
-
}
|
|
474
|
+
const username = results.find((r) => r.key === configVar || r.name === configVar).value;
|
|
475
475
|
return username;
|
|
476
476
|
}
|
|
477
477
|
async createConnection() {
|
|
@@ -523,6 +523,7 @@ exports.COMMANDS = {
|
|
|
523
523
|
},
|
|
524
524
|
[Executable.SF]: {
|
|
525
525
|
deploy: 'deploy metadata',
|
|
526
|
+
retrieve: 'retrieve metadata',
|
|
526
527
|
},
|
|
527
528
|
};
|
|
528
529
|
//# sourceMappingURL=testkit.js.map
|
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.
|
|
4
|
+
"version": "0.0.17",
|
|
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": "
|
|
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
|
|
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": "^
|
|
53
|
-
"@salesforce/dev-scripts": "^0.
|
|
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.
|
|
68
|
-
"eslint-config-salesforce-license": "^0.1.
|
|
69
|
-
"eslint-config-salesforce-typescript": "^0.2.
|
|
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": "^
|
|
75
|
-
"mocha": "^
|
|
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
|
-
"
|
|
72
|
+
"sinon": "10.0.0",
|
|
73
|
+
"ts-node": "^10.0.0",
|
|
80
74
|
"typescript": "^4.1.3"
|
|
81
75
|
},
|
|
82
76
|
"config": {
|