本文整理匯總了TypeScript中azure-pipelines-task-lib/mock-run.TaskMockRunner.setInput方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TaskMockRunner.setInput方法的具體用法?TypeScript TaskMockRunner.setInput怎麽用?TypeScript TaskMockRunner.setInput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類azure-pipelines-task-lib/mock-run.TaskMockRunner
的用法示例。
在下文中一共展示了TaskMockRunner.setInput方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: TaskMockRunner
import * as path from 'path';
import { TaskMockRunner } from 'azure-pipelines-task-lib/mock-run';
const taskPath = path.join(__dirname, '..', 'main.js');
const taskRunner = new TaskMockRunner(taskPath);
taskRunner.setInput('versionSpec', 'pypy2');
taskRunner.setInput('addToPath', 'true');
taskRunner.setInput('architecture', 'x64');
// Mock azure-pipelines-tool-lib
const toolPath = path.join('/', 'PyPy', '2.7.9', 'x64');
taskRunner.registerMock('azure-pipelines-tool-lib/tool', {
findLocalTool: () => toolPath
});
taskRunner.registerMock('./toolutil', {
prependPathSafe: (toolPath: string) => {
console.log('##vso[task.prependpath]' + toolPath);
}
});
taskRunner.run();
示例2: TaskMockRunner
import * as path from 'path';
import * as sinon from 'sinon';
import { TaskMockRunner } from 'azure-pipelines-task-lib/mock-run';
const taskPath = path.join(__dirname, '..', 'main.js');
const taskRunner = new TaskMockRunner(taskPath);
taskRunner.setInput('versionSpec', '3.x');
taskRunner.setInput('addToPath', 'false');
taskRunner.setInput('architecture', 'x86');
// Mock azure-pipelines-tool-lib
const findLocalTool = sinon.stub();
findLocalTool.withArgs(sinon.match.any, sinon.match.any, 'x86').returns('x86ToolPath');
findLocalTool.withArgs(sinon.match.any, sinon.match.any, 'x64').returns('x64ToolPath');
taskRunner.registerMock('azure-pipelines-tool-lib/tool', {
findLocalTool: findLocalTool
});
taskRunner.run();