@salesforce/cli-plugins-testkit
Advanced tools
Comparing version 1.2.12 to 1.3.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [1.3.0](https://github.com/salesforcecli/cli-plugins-testkit/compare/v1.2.12...v1.3.0) (2021-08-04) | ||
### Features | ||
* allow option to answer prompts ([#171](https://github.com/salesforcecli/cli-plugins-testkit/issues/171)) ([2a7133e](https://github.com/salesforcecli/cli-plugins-testkit/commit/2a7133e16fcd04619964306af777701772c12720)) | ||
### [1.2.12](https://github.com/salesforcecli/cli-plugins-testkit/compare/v1.2.11...v1.2.12) (2021-08-04) | ||
@@ -7,0 +14,0 @@ |
@@ -15,2 +15,6 @@ import { Duration } from '@salesforce/kit'; | ||
cli?: 'sfdx' | 'sf'; | ||
/** | ||
* Answers to supply to any prompts. This does NOT work on windows. | ||
*/ | ||
answers?: string[]; | ||
} | ||
@@ -17,0 +21,0 @@ export interface ExecCmdResult { |
@@ -63,3 +63,3 @@ "use strict"; | ||
*/ | ||
const buildCmd = (cmdArgs) => { | ||
const buildCmd = (cmdArgs, options) => { | ||
const debug = debug_1.default('testkit:buildCmd'); | ||
@@ -78,3 +78,8 @@ const bin = kit_1.env.getString('TESTKIT_EXECUTABLE_PATH') || path_1.join('bin', 'run'); | ||
debug(`Resolved executable path: ${resolvedPath}`); | ||
return `${bin} ${cmdArgs}`; | ||
if ((options === null || options === void 0 ? void 0 : options.answers) && process.platform !== 'win32') { | ||
return `printf "${options.answers.join('\\n')}" | ${bin} ${cmdArgs}`; | ||
} | ||
else { | ||
return `${bin} ${cmdArgs}`; | ||
} | ||
}; | ||
@@ -84,3 +89,3 @@ const execCmdSync = (cmd, options) => { | ||
// Add on the bin path | ||
cmd = buildCmd(cmd); | ||
cmd = buildCmd(cmd, options); | ||
const cmdOptions = buildCmdOptions(options); | ||
@@ -108,3 +113,3 @@ debug(`Running cmd: ${cmd}`); | ||
// Add on the bin path | ||
cmd = buildCmd(cmd); | ||
cmd = buildCmd(cmd, options); | ||
const resultPromise = new Promise((resolve, reject) => { | ||
@@ -111,0 +116,0 @@ const cmdOptions = buildCmdOptions(options); |
{ | ||
"name": "@salesforce/cli-plugins-testkit", | ||
"description": "Provides test utilities to assist Salesforce CLI plug-in authors with writing non-unit tests (NUT).", | ||
"version": "1.2.12", | ||
"version": "1.3.0", | ||
"author": "Salesforce", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause", |
70541
1128