本文整理汇总了TypeScript中vsts-task-lib/mock-run.TaskMockRunner.run方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TaskMockRunner.run方法的具体用法?TypeScript TaskMockRunner.run怎么用?TypeScript TaskMockRunner.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vsts-task-lib/mock-run.TaskMockRunner
的用法示例。
在下文中一共展示了TaskMockRunner.run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
"loadBalancerInboundNatRules": [
{
"id": "xlr8lb-inboundNatRules-RDP3"
}]
}
}],
"macAddress": "mac-nic3",
"primary": true,
"virtualMachine": {
"id": "test-vm3"
}
}
}
];
},
setNetworkInterface: function(SPN, endpointUrl, nic, resourceGroupName) {
tl._writeLine(tl.loc("SettingTheNetworkInterface"));
throw tl.loc("FailedSettingNetworkInterface");
}
});
var utility = require('../utility');
tmr.registerMock("./utility", {
getMacAddress: function () {
return ["mac-nic1", "mac-nic2"];
},
getPrimaryNetworkInterface: utility.getPrimaryNetworkInterface
});
tmr.run();
示例2:
import * as MockRun from "vsts-task-lib/mock-run";
import * as Path from "path";
let taskPath: string = Path.join(__dirname, "../../../Tasks/SetVariable/setVariable.js");
let taskMock: MockRun.TaskMockRunner = new MockRun.TaskMockRunner(taskPath);
taskMock.setInput("name", "TaskVariable");
taskMock.run();
示例3:
taskRunner.setInput('createCustomEnvironment', 'true');
taskRunner.setInput('environmentName', 'test');
// Mock vsts-task-lib
taskRunner.setAnswers({
which: {
'conda': '/miniconda/bin/conda'
},
exec: {
'sudo /miniconda/bin/conda create --quiet --prefix /miniconda/envs/test --mkdir --yes': {
code: 0
},
'conda create --quiet --prefix \\miniconda\\envs\\test --mkdir --yes': {
code: 0
},
}
});
// Mock vsts-task-tool-lib
taskRunner.registerMock('vsts-task-tool-lib/tool', {
prependPath: () => undefined,
});
// Mock other dependencies
mockery.registerMock('fs', {
existsSync: () => false
});
taskRunner.run();