@salesforce/cli-plugins-testkit
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -5,2 +5,12 @@ # Changelog | ||
### [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)) | ||
### [0.0.3](https://github.com/salesforcecli/cli-plugins-testkit/compare/v0.0.2...v0.0.3) (2021-02-03) | ||
@@ -7,0 +17,0 @@ |
@@ -18,7 +18,10 @@ "use strict"; | ||
const shelljs_1 = require("shelljs"); | ||
const DEFAULT_SHELL_OPTIONS = { | ||
timeout: 300000, | ||
cwd: process.cwd(), | ||
env: Object.assign({}, process.env), | ||
silent: true, | ||
const buildCmdOptions = (options) => { | ||
const defaults = { | ||
env: Object.assign({}, process.env), | ||
cwd: process.cwd(), | ||
timeout: 300000, | ||
silent: true, | ||
}; | ||
return { ...defaults, ...options }; | ||
}; | ||
@@ -39,4 +42,5 @@ // Create a Duration instance from process.hrtime | ||
}; | ||
const getExitCodeError = (expectedCode, actualCode, cmd) => { | ||
return Error(`Unexpected exit code for command: ${cmd}. Expected: ${expectedCode} Actual: ${actualCode}`); | ||
const getExitCodeError = (cmd, expectedCode, output) => { | ||
const io = cmd.includes('--json') ? output.stdout : output.stderr; | ||
return Error(`Unexpected exit code for command: ${cmd}. Expected: ${expectedCode} Actual: ${output.code}\n${io}`); | ||
}; | ||
@@ -73,3 +77,3 @@ /** | ||
cmd = buildCmd(cmd); | ||
const cmdOptions = { ...DEFAULT_SHELL_OPTIONS, ...options }; | ||
const cmdOptions = buildCmdOptions(options); | ||
debug(`Running cmd: ${cmd}`); | ||
@@ -87,3 +91,3 @@ debug(`Cmd options: ${util_1.inspect(cmdOptions)}`); | ||
if (ts_types_1.isNumber(cmdOptions.ensureExitCode) && result.shellOutput.code !== cmdOptions.ensureExitCode) { | ||
throw getExitCodeError(cmdOptions.ensureExitCode, result.shellOutput.code, cmd); | ||
throw getExitCodeError(cmd, cmdOptions.ensureExitCode, result.shellOutput); | ||
} | ||
@@ -97,3 +101,3 @@ return addJsonOutput(cmd, result); | ||
const resultPromise = new Promise((resolve, reject) => { | ||
const cmdOptions = { ...DEFAULT_SHELL_OPTIONS, ...options }; | ||
const cmdOptions = buildCmdOptions(options); | ||
debug(`Running cmd: ${cmd}`); | ||
@@ -105,3 +109,6 @@ debug(`Cmd options: ${util_1.inspect(cmdOptions)}`); | ||
if (ts_types_1.isNumber(cmdOptions.ensureExitCode) && code !== cmdOptions.ensureExitCode) { | ||
reject(getExitCodeError(cmdOptions.ensureExitCode, code, cmd)); | ||
const output = new shelljs_1.ShellString(stdout); | ||
output.code = code; | ||
output.stderr = stderr; | ||
reject(getExitCodeError(cmd, cmdOptions.ensureExitCode, output)); | ||
} | ||
@@ -108,0 +115,0 @@ const result = { |
export * from './genUniqueString'; | ||
export * from './execCmd'; | ||
export * from './testProject'; | ||
export * from './testSession'; | ||
export { Duration } from '@salesforce/kit'; |
@@ -22,4 +22,6 @@ "use strict"; | ||
__exportStar(require("./execCmd"), exports); | ||
__exportStar(require("./testProject"), exports); | ||
__exportStar(require("./testSession"), exports); | ||
var kit_1 = require("@salesforce/kit"); | ||
Object.defineProperty(exports, "Duration", { enumerable: true, get: function () { return kit_1.Duration; } }); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"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.3", | ||
"version": "0.0.4", | ||
"author": "Salesforce", | ||
@@ -55,3 +55,4 @@ "license": "BSD-3-Clause", | ||
"debug": "^4.3.1", | ||
"shelljs": "^0.8.4" | ||
"shelljs": "^0.8.4", | ||
"archiver": "^5.2.0" | ||
}, | ||
@@ -66,2 +67,3 @@ "devDependencies": { | ||
"@types/sinon": "^9.0.10", | ||
"@types/archiver": "^5.1.0", | ||
"@typescript-eslint/eslint-plugin": "^4.14.1", | ||
@@ -68,0 +70,0 @@ "@typescript-eslint/parser": "^4.14.1", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
40976
16
765
6
30
3
+ Addedarchiver@^5.2.0