tweak in response to reviewer comments

This commit is contained in:
Nick Fyson 2020-09-11 18:25:23 +01:00
parent 88951d6193
commit 1fb7c81099
12 changed files with 40 additions and 52 deletions

View file

@ -11,7 +11,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const exec = __importStar(require("@actions/exec"));
const toolrunnner = __importStar(require("@actions/exec/lib/toolrunner"));
const ava_1 = __importDefault(require("ava"));
const testing_utils_1 = require("./testing-utils");
const toolrunner_error_catcher_1 = require("./toolrunner-error-catcher");
@ -82,15 +81,15 @@ ava_1.default('execErrorCatcher preserves behavior of provided listeners', async
function buildDummyArgs(stdoutContents, stderrContents, desiredErrorMessage, desiredExitCode) {
let command = '';
if (stdoutContents)
command += 'console.log(\\"' + stdoutContents + '\\");';
command += 'console.log("' + stdoutContents + '");';
if (stderrContents)
command += 'console.error(\\"' + stderrContents + '\\");';
command += 'console.error("' + stderrContents + '");';
if (command.length === 0)
throw new Error("Must provide contents for either stdout or stderr");
if (desiredErrorMessage)
command += 'throw new Error(\\"' + desiredErrorMessage + '\\");';
command += 'throw new Error("' + desiredErrorMessage + '");';
if (desiredExitCode)
command += 'process.exitCode = ' + desiredExitCode + ';';
return toolrunnner.argStringToArray('-e "' + command + '"');
return ["-e", command];
}
//# sourceMappingURL=toolrunner-error-catcher.test.js.map