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