本文整理汇总了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();