Socket
Socket
Sign inDemoInstall

@salesforce/cli-plugins-testkit

Package Overview
Dependencies
Maintainers
50
Versions
296
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salesforce/cli-plugins-testkit - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

24

CHANGELOG.md

@@ -5,32 +5,30 @@ # Changelog

### [0.0.7](https://github.com/salesforcecli/cli-plugins-testkit/compare/v0.0.6...v0.0.7) (2021-02-18)
### [0.0.6](https://github.com/salesforcecli/cli-plugins-testkit/compare/v0.0.5...v0.0.6) (2021-02-18)
### Bug Fixes
* properly format jwtkey prior to file save ([c6045d3](https://github.com/salesforcecli/cli-plugins-testkit/commit/c6045d301ba97511e50d9fbd470e2ec74fed614a))
- properly format jwtkey prior to file save ([c6045d3](https://github.com/salesforcecli/cli-plugins-testkit/commit/c6045d301ba97511e50d9fbd470e2ec74fed614a))
### [0.0.5](https://github.com/salesforcecli/cli-plugins-testkit/compare/v0.0.4...v0.0.5) (2021-02-18)
### Features
* untested hubauth ([c50e679](https://github.com/salesforcecli/cli-plugins-testkit/commit/c50e6799d81edb85a9384cff97b230be767808e6))
* working autoAuth ([f0dc0d2](https://github.com/salesforcecli/cli-plugins-testkit/commit/f0dc0d2c7fc5d4278a3c81807797a2245b7ba26f))
- untested hubauth ([c50e679](https://github.com/salesforcecli/cli-plugins-testkit/commit/c50e6799d81edb85a9384cff97b230be767808e6))
- working autoAuth ([f0dc0d2](https://github.com/salesforcecli/cli-plugins-testkit/commit/f0dc0d2c7fc5d4278a3c81807797a2245b7ba26f))
### Bug Fixes
* remove authurl from logger ([1aa02f6](https://github.com/salesforcecli/cli-plugins-testkit/commit/1aa02f6c01682c5d16a5736a12bd06d66af5dc3c))
* silent execs ([54a7aa9](https://github.com/salesforcecli/cli-plugins-testkit/commit/54a7aa9cb21fd1a803c8dc15dafd8d3b837c23da))
- remove authurl from logger ([1aa02f6](https://github.com/salesforcecli/cli-plugins-testkit/commit/1aa02f6c01682c5d16a5736a12bd06d66af5dc3c))
- silent execs ([54a7aa9](https://github.com/salesforcecli/cli-plugins-testkit/commit/54a7aa9cb21fd1a803c8dc15dafd8d3b837c23da))
### [0.0.4](https://github.com/salesforcecli/cli-plugins-testkit/compare/v0.0.3...v0.0.4) (2021-02-16)
### Features
* add TestProject, zipDir, and session updates ([4b013ad](https://github.com/salesforcecli/cli-plugins-testkit/commit/4b013adc38e47a0d506fd1a603ebdeeb729ac212))
* adds a test session and test project class for NUTs ([c17a39d](https://github.com/salesforcecli/cli-plugins-testkit/commit/c17a39d9c0f64701bc2265830864775abcef0ec0))
* changes based on code reviews and meetings ([550ce79](https://github.com/salesforcecli/cli-plugins-testkit/commit/550ce7973ef737231406b467f8ad1dad9294a0db))
* finishing touches on test session deletion and project creation ([2920d3f](https://github.com/salesforcecli/cli-plugins-testkit/commit/2920d3f2b73a0f41d38cdd1ee05e2e4765eb4e28))
- add TestProject, zipDir, and session updates ([4b013ad](https://github.com/salesforcecli/cli-plugins-testkit/commit/4b013adc38e47a0d506fd1a603ebdeeb729ac212))
- adds a test session and test project class for NUTs ([c17a39d](https://github.com/salesforcecli/cli-plugins-testkit/commit/c17a39d9c0f64701bc2265830864775abcef0ec0))
- changes based on code reviews and meetings ([550ce79](https://github.com/salesforcecli/cli-plugins-testkit/commit/550ce7973ef737231406b467f8ad1dad9294a0db))
- finishing touches on test session deletion and project creation ([2920d3f](https://github.com/salesforcecli/cli-plugins-testkit/commit/2920d3f2b73a0f41d38cdd1ee05e2e4765eb4e28))

@@ -37,0 +35,0 @@ ### [0.0.3](https://github.com/salesforcecli/cli-plugins-testkit/compare/v0.0.2...v0.0.3) (2021-02-03)

@@ -37,17 +37,12 @@ "use strict";

if (kit_1.env.getString('TESTKIT_JWT_KEY')) {
let keyLines = kit_1.env.getString('TESTKIT_JWT_KEY', '').split('\n');
const jwtKey = kit_1.env.getString('TESTKIT_JWT_KEY');
let keyLines = jwtKey.split(os.EOL);
if (keyLines.length <= 1) {
const footer = '-----END RSA PRIVATE KEY-----';
const header = '-----BEGIN RSA PRIVATE KEY-----';
// strip out header and footer
const newKeyContents = kit_1.env.getString('TESTKIT_JWT_KEY', '').replace(header, '').replace(footer, '');
// check to see if newlines were replaced with spaces
keyLines = newKeyContents.trim().split(/\s/);
if (keyLines.length <= 1) {
// still one big string, split into 64 byte chucks
keyLines = [header, ...newKeyContents.match(/.{1,64}/g), footer];
}
else {
keyLines = [header, ...keyLines, footer];
}
// strip out header, footer and spaces
const newKeyContents = jwtKey.replace(header, '').replace(footer, '').replace(/\s/g, '');
// one big string, split into 64 byte chucks
// const chunks = newKeyContents.match(/.{1,64}/g) as string[];
keyLines = [header, ...newKeyContents.match(/.{1,64}/g), footer];
}

@@ -77,3 +72,6 @@ return keyLines.join('\n');

core_1.fs.writeFileSync(jwtKey, formatJwtKey());
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)}`, { silent: true, fatal: true });
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)}`, { silent: true });
if (results.code !== 0) {
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}`);
}
return;

@@ -85,4 +83,7 @@ }

core_1.fs.writeFileSync(tmpUrl, kit_1.env.getString('TESTKIT_AUTH_URL', ''));
const shellOutput = shell.exec(`sfdx auth:sfdxurl:store -d -f ${tmpUrl}`, { silent: true, fatal: true });
const shellOutput = shell.exec(`sfdx auth:sfdxurl:store -d -f ${tmpUrl}`, { silent: true });
logger(shellOutput);
if (shellOutput.code !== 0) {
throw new Error(`auth:sfdxurl for url ${tmpUrl} failed with exit code: ${shellOutput.code}\n ${shellOutput.stdout + shellOutput.stderr}`);
}
return;

@@ -89,0 +90,0 @@ }

@@ -138,2 +138,15 @@ "use strict";

this.sandbox.restore();
const rmSessionDir = async () => {
// Delete the test session unless they overrode the test session dir
if (!this.overriddenDir) {
this.debug(`Deleting test session dir: ${this.dir}`);
// Processes can hang on to files within the test session dir, preventing
// removal so we wait a bit before trying.
await this.sleep(kit_1.Duration.seconds(2));
const rv = shell.rm('-rf', this.dir);
if (rv.code !== 0) {
throw Error(`Deleting the test session failed due to: ${rv.stderr}`);
}
}
};
if (!kit_1.env.getBoolean('TESTKIT_SAVE_ARTIFACTS')) {

@@ -146,2 +159,4 @@ // Delete the orgs created by the tests unless pointing to a specific org

if (rv.code !== 0) {
// Must still delete the session dir if org:delete fails
await rmSessionDir();
throw Error(`Deleting org ${org} failed due to: ${rv.stderr}`);

@@ -152,13 +167,4 @@ }

}
// Delete the test session unless they overrode the test session dir
if (!this.overriddenDir) {
this.debug(`Deleting test session dir: ${this.dir}`);
// Processes can hang on to files within the test session dir, preventing
// removal so we wait a bit before trying.
await this.sleep(kit_1.Duration.seconds(2));
const rv = shell.rm('-rf', this.dir);
if (rv.code !== 0) {
throw Error(`Deleting the test session failed due to: ${rv.stderr}`);
}
}
// Delete the session dir
await rmSessionDir();
}

@@ -193,3 +199,3 @@ }

dbug(`Not creating a new org. Reusing TESTKIT_ORG_USERNAME of: ${org}`);
this.setup.push(new shell.ShellString(`TESTKIT_ORG_USERNAME=${org}`));
this.setup.push({ result: { username: org } });
continue;

@@ -196,0 +202,0 @@ }

{
"name": "@salesforce/cli-plugins-testkit",
"description": "Provides test utilities to assist Salesforce CLI plug-in authors with writing non-unit tests (NUT).",
"version": "0.0.6",
"version": "0.0.7",
"author": "Salesforce",

@@ -85,3 +85,3 @@ "license": "BSD-3-Clause",

"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"pretty-quick": "^3.1.0",
"sinon": "^9.0.2",

@@ -88,0 +88,0 @@ "ts-node": "^9.1.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc