当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript mock-run.TaskMockRunner类代码示例

本文整理汇总了TypeScript中azure-pipelines-task-lib/mock-run.TaskMockRunner的典型用法代码示例。如果您正苦于以下问题:TypeScript TaskMockRunner类的具体用法?TypeScript TaskMockRunner怎么用?TypeScript TaskMockRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TaskMockRunner类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: 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();
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:22,代码来源:L0SelectsArchitecture.ts

示例2: 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();
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:24,代码来源:L0PyPy2.ts

示例3: 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', '3.x');
taskRunner.setInput('addToPath', 'false');
taskRunner.setInput('architecture', 'x64');

// `getVariable` is not supported by `TaskLibAnswers`
process.env['AGENT_TOOLSDIRECTORY'] = '$(Agent.ToolsDirectory)';

// Mock azure-pipelines-tool-lib
taskRunner.registerMock('azure-pipelines-tool-lib/tool', {
    findLocalTool: () => null,
    findLocalToolVersions: () => ['2.6.0', '2.7.13']
});

taskRunner.run();
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:21,代码来源:L0FailsWhenVersionIsMissing.ts


注:本文中的azure-pipelines-task-lib/mock-run.TaskMockRunner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。