Skip to content

Commit

Permalink
chore: use testkit v3 (#494)
Browse files Browse the repository at this point in the history
* chore: upgrade to testkit v3

* chore: bump testkit

* chore: nuts
  • Loading branch information
mdonnalley authored Oct 3, 2022
1 parent 17e851a commit 13d99dd
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 36 deletions.
14 changes: 0 additions & 14 deletions .vscode/launch.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^3",
"@salesforce/cli-plugins-testkit": "^2",
"@salesforce/cli-plugins-testkit": "^3.0.1",
"@salesforce/dev-config": "^3.0.1",
"@salesforce/dev-scripts": "^2.0.3",
"@salesforce/plugin-command-reference": "^2",
Expand Down Expand Up @@ -135,4 +135,4 @@
"publishConfig": {
"access": "public"
}
}
}
2 changes: 1 addition & 1 deletion test/commands/auth/accesstoken/store.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('auth:accesstoken:store NUTs', () => {
instanceUrl = ensureString(env.getString('TESTKIT_HUB_INSTANCE'));
clientId = ensureString(env.getString('TESTKIT_JWT_CLIENT_ID'));
ensureString(env.getString('TESTKIT_JWT_KEY'));
testSession = await TestSession.create({ authStrategy: 'NONE' });
testSession = await TestSession.create();
const jwtKeyFilePath = prepareForJwt(testSession.homeDir);
const res = execCmd<{ accessToken: string }>(
`auth:jwt:grant -f ${jwtKeyFilePath} -i ${clientId} -u ${username} --setdefaultdevhubusername --instanceurl ${instanceUrl} --json`,
Expand Down
2 changes: 1 addition & 1 deletion test/commands/auth/jwt/grant.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('auth:jwt:grant NUTs', () => {
clientId = ensureString(env.getString('TESTKIT_JWT_CLIENT_ID'));
ensureString(env.getString('TESTKIT_JWT_KEY'));

testSession = await TestSession.create({ authStrategy: 'NONE' });
testSession = await TestSession.create();
jwtKey = prepareForJwt(testSession.homeDir);
});

Expand Down
2 changes: 1 addition & 1 deletion test/commands/auth/logout.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('auth:logout NUTs', () => {
clientId = ensureString(env.getString('TESTKIT_JWT_CLIENT_ID'));
ensureString(env.getString('TESTKIT_JWT_KEY'));

testSession = await TestSession.create({ authStrategy: 'NONE' });
testSession = await TestSession.create();
jwtKey = prepareForJwt(testSession.homeDir);
});

Expand Down
26 changes: 15 additions & 11 deletions test/commands/auth/scratch-identify.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { expect } from 'chai';

import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { Env } from '@salesforce/kit';
import { AnyJson, ensureString, getString, isArray } from '@salesforce/ts-types';
import { ensureString } from '@salesforce/ts-types';
import { AuthFields, OrgAuthorization } from '@salesforce/core';
import { readJson } from 'fs-extra';

Expand All @@ -28,18 +28,22 @@ describe('verify discovery/id of scratch org', () => {
hubUsername = ensureString(env.getString('TESTKIT_HUB_USERNAME'));
testSession = await TestSession.create({
project: { name: 'ScratchIDProject' },
setupCommands: [
`sfdx force:org:create -d 1 -s -f ${path.join('config', 'project-scratch-def.json')} --json`,
'sfdx force:org:display --json',
scratchOrgs: [
{
executable: 'sfdx',
duration: 1,
setDefault: true,
config: path.join('config', 'project-scratch-def.json'),
},
],
});
if (isArray<AnyJson>(testSession.setup)) {
orgUsername = getString(testSession.setup[0], 'result.username');
orgInstanceUrl = getString(testSession.setup[1], 'result.instanceUrl', 'https://test.salesforce.com').replace(
'.com/',
'.com'
);
}

orgUsername = [...testSession.orgs.keys()][0];
orgInstanceUrl = (testSession.orgs.get(orgUsername).instanceUrl ?? 'https://test.salesforce.com').replace(
'.com/',
'.com'
);

// we'll need this path for testing
jwtKey = path.join(testSession.homeDir, 'jwtKey');
});
Expand Down
2 changes: 1 addition & 1 deletion test/commands/auth/sfdxurl/store.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('auth:sfdxurl:store NUTs', () => {
before('prepare session and ensure environment variables', async () => {
ensureString(env.getString('TESTKIT_AUTH_URL'));
username = ensureString(env.getString('TESTKIT_HUB_USERNAME'));
testSession = await TestSession.create({ authStrategy: 'NONE' });
testSession = await TestSession.create();
authUrl = prepareForAuthUrl(testSession.homeDir);
});

Expand Down
33 changes: 28 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1001,10 +1001,10 @@
mv "~2"
safe-json-stringify "~1"

"@salesforce/cli-plugins-testkit@^2":
version "2.5.3"
resolved "https://registry.yarnpkg.com/@salesforce/cli-plugins-testkit/-/cli-plugins-testkit-2.5.3.tgz#80d6d640f1fccb8975e0648361ffa984e30b26d3"
integrity sha512-wK94o+JHe1S05kjvqpZzGFKFAGn/J1NAKq953JdoBqjSCbyhEzAWgjaABxFTirJk3zPMX1/vR7BFmsN+E5ju9w==
"@salesforce/cli-plugins-testkit@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@salesforce/cli-plugins-testkit/-/cli-plugins-testkit-3.0.1.tgz#91eaacb89c4cf445dc13db4fb49368527185fd21"
integrity sha512-cRiNLHNxQg1YyM6s8Js0J0Yi6zhVDKkbwQ7lAt+Lkb4CRFuu7cO65GbEXkOq6td01dBI4DkwWf8Wdi7+A5a9lQ==
dependencies:
"@salesforce/core" "^3.30.9"
"@salesforce/kit" "^1.6.1"
Expand All @@ -1029,7 +1029,30 @@
"@salesforce/ts-types" "^1.5.21"
chalk "^2.4.2"

"@salesforce/core@^3.15.5", "@salesforce/core@^3.19.2", "@salesforce/core@^3.30.8", "@salesforce/core@^3.30.9", "@salesforce/core@^3.8.0":
"@salesforce/core@^3.15.5", "@salesforce/core@^3.19.2", "@salesforce/core@^3.8.0":
version "3.30.8"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.30.8.tgz#e40ee555b4eae5c74ae337d74c5db5a8f0d5fc59"
integrity sha512-5ixL5R9F600RfHtskuFLossGWAa2BDzysQk6Ns5OsHLY87U/1bH8edf+fubamf3aDaZaMIrcBoucQ2OJVmPtYw==
dependencies:
"@salesforce/bunyan" "^2.0.0"
"@salesforce/kit" "^1.5.41"
"@salesforce/schemas" "^1.1.0"
"@salesforce/ts-types" "^1.5.20"
"@types/graceful-fs" "^4.1.5"
"@types/semver" "^7.3.9"
ajv "^8.11.0"
archiver "^5.3.0"
change-case "^4.1.2"
debug "^3.2.7"
faye "^1.4.0"
form-data "^4.0.0"
graceful-fs "^4.2.9"
js2xmlparser "^4.0.1"
jsforce beta
jsonwebtoken "8.5.1"
ts-retry-promise "^0.6.0"

"@salesforce/core@^3.30.9":
version "3.30.9"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.30.9.tgz#a2a577db60f1276d08b81e185d49161a75b54d76"
integrity sha512-dZFr2QS0joxl/FgdR+ZYhIVTEsJ7t+u02eaZCXLOqug/rzBq9xFoGPQaBboXx4CSf7k71Ox/Ty0sMSZNzkXb0A==
Expand Down

0 comments on commit 13d99dd

Please sign in to comment.