@salesforce/cli-plugins-testkit 2.1.2 → 2.2.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 +18 -0
- package/lib/hubAuth.js +5 -8
- package/lib/testSession.js +0 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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.2.0](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.1.4...v2.2.0) (2022-06-08)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- core bump for cache fixes ([a8c890f](https://github.com/salesforcecli/cli-plugins-testkit/commit/a8c890ffacdf3d4e4f2ed67ed1f2ef3a5f0db9c3))
|
|
10
|
+
|
|
11
|
+
### [2.1.4](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.1.3...v2.1.4) (2022-06-06)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- remove StateAgg, handle when username and authurl are provided ([522ff33](https://github.com/salesforcecli/cli-plugins-testkit/commit/522ff33237e4d918343963d195ac3a298589ff0e))
|
|
16
|
+
|
|
17
|
+
### [2.1.3](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.1.2...v2.1.3) (2022-06-06)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- globalinfo -> stateAggregator ([6638739](https://github.com/salesforcecli/cli-plugins-testkit/commit/66387396d6aba5276cbadeb2d40fcc98182cd034))
|
|
22
|
+
|
|
5
23
|
### [2.1.2](https://github.com/salesforcecli/cli-plugins-testkit/compare/v2.1.1...v2.1.2) (2022-06-02)
|
|
6
24
|
|
|
7
25
|
### Bug Fixes
|
package/lib/hubAuth.js
CHANGED
|
@@ -12,7 +12,6 @@ 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");
|
|
16
15
|
const kit_1 = require("@salesforce/kit");
|
|
17
16
|
// this seems to be a known eslint error for enums
|
|
18
17
|
// eslint-disable-next-line no-shadow
|
|
@@ -87,7 +86,6 @@ const testkitHubAuth = (homeDir, authStrategy = getAuthStrategy()) => {
|
|
|
87
86
|
logger('trying jwt auth');
|
|
88
87
|
const jwtKey = (0, exports.prepareForJwt)(homeDir);
|
|
89
88
|
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();
|
|
91
89
|
if (results.code !== 0) {
|
|
92
90
|
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}`);
|
|
93
91
|
}
|
|
@@ -97,7 +95,6 @@ const testkitHubAuth = (homeDir, authStrategy = getAuthStrategy()) => {
|
|
|
97
95
|
logger('trying to authenticate with AuthUrl');
|
|
98
96
|
const tmpUrl = (0, exports.prepareForAuthUrl)(homeDir);
|
|
99
97
|
const shellOutput = shell.exec(`sfdx auth:sfdxurl:store -d -f ${tmpUrl}`, execOpts);
|
|
100
|
-
core_1.GlobalInfo.clearInstance();
|
|
101
98
|
logger(shellOutput);
|
|
102
99
|
if (shellOutput.code !== 0) {
|
|
103
100
|
throw new Error(`auth:sfdxurl for url ${tmpUrl} failed with exit code: ${shellOutput.code}\n ${shellOutput.stdout + shellOutput.stderr}`);
|
|
@@ -113,13 +110,14 @@ const getAuthStrategy = () => {
|
|
|
113
110
|
kit_1.env.getString('TESTKIT_JWT_KEY')) {
|
|
114
111
|
return AuthStrategy.JWT;
|
|
115
112
|
}
|
|
113
|
+
// you provided a username but not an auth url, so you must already have an auth that you want to re-use
|
|
114
|
+
if (kit_1.env.getString('TESTKIT_HUB_USERNAME') && !kit_1.env.getString('TESTKIT_AUTH_URL')) {
|
|
115
|
+
return AuthStrategy.REUSE;
|
|
116
|
+
}
|
|
117
|
+
// auth url alone
|
|
116
118
|
if (kit_1.env.getString('TESTKIT_AUTH_URL')) {
|
|
117
119
|
return AuthStrategy.AUTH_URL;
|
|
118
120
|
}
|
|
119
|
-
// none of the above are included, so we want to reuse an already authenticated hub
|
|
120
|
-
if (kit_1.env.getString('TESTKIT_HUB_USERNAME')) {
|
|
121
|
-
return AuthStrategy.REUSE;
|
|
122
|
-
}
|
|
123
121
|
return AuthStrategy.NONE;
|
|
124
122
|
};
|
|
125
123
|
/**
|
|
@@ -161,7 +159,6 @@ const transferExistingAuthToEnv = (authStrategy = getAuthStrategy()) => {
|
|
|
161
159
|
// this is an org from web:auth or auth:url. Generate the authUrl and set in the env
|
|
162
160
|
logger('copying variables to env from org:display for AuthUrl');
|
|
163
161
|
const displayContents = JSON.parse(shell.exec(`sfdx force:org:display -u ${devhub} --verbose --json`, execOpts));
|
|
164
|
-
core_1.GlobalInfo.clearInstance();
|
|
165
162
|
logger(`found ${displayContents.result.sfdxAuthUrl}`);
|
|
166
163
|
kit_1.env.setString('TESTKIT_AUTH_URL', displayContents.result.sfdxAuthUrl);
|
|
167
164
|
return;
|
package/lib/testSession.js
CHANGED
|
@@ -10,7 +10,6 @@ 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");
|
|
14
13
|
const kit_1 = require("@salesforce/kit");
|
|
15
14
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
16
15
|
const sinon_1 = require("sinon");
|
|
@@ -183,7 +182,6 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
|
|
|
183
182
|
}
|
|
184
183
|
this.debug('Deleted org result=', rv.stdout);
|
|
185
184
|
}
|
|
186
|
-
core_1.GlobalInfo.clearInstance();
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
187
|
async rmSessionDir() {
|
|
@@ -275,8 +273,6 @@ class TestSession extends kit_1.AsyncOptionalCreatable {
|
|
|
275
273
|
await this.sleep(timeout);
|
|
276
274
|
}
|
|
277
275
|
}
|
|
278
|
-
// there may be globalInfo touches from org:create or other setup commands run
|
|
279
|
-
core_1.GlobalInfo.clearInstance();
|
|
280
276
|
}
|
|
281
277
|
async sleep(duration) {
|
|
282
278
|
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.
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "lib/index.js",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"!lib/**/*.map"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@salesforce/core": "^3.
|
|
46
|
-
"@salesforce/kit": "^1.5.
|
|
45
|
+
"@salesforce/core": "^3.20.1",
|
|
46
|
+
"@salesforce/kit": "^1.5.42",
|
|
47
47
|
"@salesforce/ts-types": "^1.5.17",
|
|
48
48
|
"archiver": "^5.2.0",
|
|
49
49
|
"debug": "^4.3.1",
|