本文整理汇总了TypeScript中shelljs.tempdir函数的典型用法代码示例。如果您正苦于以下问题:TypeScript tempdir函数的具体用法?TypeScript tempdir怎么用?TypeScript tempdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tempdir函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('codecoverage.publish : publish code coverage files with additional files having same file name', function(done) {
this.timeout(2000);
var additionalFileDirectory = path.join(shell.tempdir(), "files");
var duplicateDirectory = path.join(additionalFileDirectory, "duplicate");
shell.mkdir('-p', additionalFileDirectory);
shell.mkdir('-p', duplicateDirectory);
shell.cp('-f', path.resolve(__dirname, './codecoveragefiles/jacoco.xml'), additionalFileDirectory);
shell.cp('-f', path.resolve(__dirname, './codecoveragefiles/jacoco.xml'), duplicateDirectory);
var properties: { [name: string]: string } = { "summaryfile": coberturaSummaryFile, "codecoveragetool": "Cobertura", "reportdirectory": "", "additionalcodecoveragefiles": path.join(additionalFileDirectory, "jacoco.xml") + "," + path.join(duplicateDirectory, "jacoco.xml") };
var command: cm.ITaskCommand = new tc.TestCommand(null, null, null);
command.properties = properties;
var coberturaSummaryReader = new csr.CoberturaSummaryReader(command);
var jobInfo = new jobInf.TestJobInfo({});
jobInfo.variables = { "agent.workingDirectory": __dirname, "build.buildId": "1" };
testExecutionContext = new tec.TestExecutionContext(jobInfo);
var codeCoveragePublishCommand = new cpc.CodeCoveragePublishCommand(testExecutionContext, command);
codeCoveragePublishCommand.runCommandAsync().then(function(result) {
assert(testExecutionContext.service.jobsCompletedSuccessfully(), 'CodeCoveragePublish Task Failed! Details : ' + testExecutionContext.service.getRecordsString());
assert(testExecutionContext.service.containerItems.length == 3);
assert(testExecutionContext.service.artifactNames.length == 2);
assert(testExecutionContext.service.artifactNames[0] == "Code Coverage Report_1");
assert(testExecutionContext.service.artifactNames[1] == "Code Coverage Files_1");
assert(result);
done();
},
function(err) {
assert(false, 'CodeCoveragePublish Task Failed! Details : ' + err.message);
done();
});
})
开发者ID:IvyMH,项目名称:vso-agent,代码行数:32,代码来源:publishcodecoveragetests.ts
示例2: createLinkAndFinish
function createLinkAndFinish(result, jobStatus: string, resultMessage: string) {
var tempDir = shell.tempdir();
var linkMarkdownFile = path.join(tempDir, 'JenkinsJob_' + jenkinsTaskName + '_' + jenkinsExecutableNumber + '.md');
tl.debug('jenkinsLink: ' + linkMarkdownFile);
var summaryTitle = 'Jenkins ' + jenkinsTaskName + ' - ' + jenkinsExecutableNumber + ' - ' + jobStatus;
tl.debug('summaryTitle: ' + summaryTitle);
var markdownContents = '[' + jenkinsExecutableUrl + '](' + jenkinsExecutableUrl + ')';
fs.writeFile(linkMarkdownFile, markdownContents, function callBack(err) {
if (err) {
//don't fail the build -- there just won't be a link
console.log('Error creating link to Jenkins job: ' + err);
} else {
console.log('##vso[task.addattachment type=Distributedtask.Core.Summary;name=' + summaryTitle + ';]' + linkMarkdownFile);
}
tl.setResult(result, resultMessage);
});
}
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:17,代码来源:jenkinsqueuejobtask.ts
示例3: describe
describe('CodeCoveragePublisherTests', function() {
var jacocoSummaryFile = path.resolve(__dirname, './codecoveragefiles/jacoco.xml');
var coberturaSummaryFile = path.resolve(__dirname, './codecoveragefiles/cobertura.xml');
var invalidJacocoSummaryFile = path.resolve(__dirname, './codecoveragefiles/invalidjacoco.xml');
var invalidCoberturaSummaryFile = path.resolve(__dirname, './codecoveragefiles/invalidcobertura.xml');
var emptyJacocoSummaryFile = path.resolve(__dirname, './codecoveragefiles/emptyjacoco.xml');
var emptyCoberturaSummaryFile = path.resolve(__dirname, './codecoveragefiles/emptycobertura.xml');
var reportDirectory = path.join(shell.tempdir(), "report");
shell.mkdir('-p', reportDirectory);
shell.cp('-r', path.resolve(__dirname, './codecoveragefiles'), reportDirectory);
var testExecutionContext;
it('codecoverage.publish : publish summary fails when code coverage tool is invalid', function(done) {
this.timeout(2000);
var summaryFile = "./SummaryFile";
var properties: { [name: string]: string } = { "codecoveragetool": "invalid", "summaryfile": jacocoSummaryFile };
var command: cm.ITaskCommand = new tc.TestCommand(null, null, null);
command.properties = properties;
testExecutionContext = new tec.TestExecutionContext(new jobInf.TestJobInfo({}));
var codeCoveragePublishCommand = new cpc.CodeCoveragePublishCommand(testExecutionContext, command);
codeCoveragePublishCommand.runCommandAsync().then(function(result) {
assert(false, 'Publish code coverage Task did not fail as expected')
done();
},
function(err) {
var expectedMessage = "Error: Code coverage tool 'invalid' is not supported.";
assert(err == expectedMessage);
done();
});
})
it('codecoverage.publish : publish summary fails when code coverage tool is not provided', function(done) {
this.timeout(2000);
var summaryFile = "./SummaryFile";
var properties: { [name: string]: string } = { "summaryfile": jacocoSummaryFile };
var command: cm.ITaskCommand = new tc.TestCommand(null, null, null);
command.properties = properties;
testExecutionContext = new tec.TestExecutionContext(new jobInf.TestJobInfo({}));
var codeCoveragePublishCommand = new cpc.CodeCoveragePublishCommand(testExecutionContext, command);
codeCoveragePublishCommand.runCommandAsync().then(function(result) {
assert(false, 'Publish code coverage Task did not fail as expected')
done();
},
function(err) {
var expectedMessage = "Error: No code coverage tool is provided.";
assert(err == expectedMessage);
done();
});
})
it('codecoverage.publish : publish summary fails when summary xml is not provided', function(done) {
this.timeout(2000);
var summaryFile = "./SummaryFile";
var properties: { [name: string]: string } = { "codecoveragetool": "JaCoCo" };
var command: cm.ITaskCommand = new tc.TestCommand(null, null, null);
command.properties = properties;
testExecutionContext = new tec.TestExecutionContext(new jobInf.TestJobInfo({}));
var codeCoveragePublishCommand = new cpc.CodeCoveragePublishCommand(testExecutionContext, command);
codeCoveragePublishCommand.runCommandAsync().then(function(result) {
assert(false, 'Publish code coverage Task did not fail as expected')
done();
},
function(err) {
var expectedMessage = "Error: No code coverage summary file is provided.";
assert(err == expectedMessage);
done();
});
})
it('codecoverage.publish : publish summary fails when summary xml does not exist', function(done) {
this.timeout(2000);
var summaryFile = "./SummaryFile";
var properties: { [name: string]: string } = { "summaryfile": summaryFile, "codecoveragetool": "JaCoCo" };
var command: cm.ITaskCommand = new tc.TestCommand(null, null, null);
command.properties = properties;
testExecutionContext = new tec.TestExecutionContext(new jobInf.TestJobInfo({}));
var codeCoveragePublishCommand = new cpc.CodeCoveragePublishCommand(testExecutionContext, command);
codeCoveragePublishCommand.runCommandAsync().then(function(result) {
assert(false, 'Publish code coverage Task did not fail as expected')
done();
},
function(err) {
var expectedMessage = "Error: Code coverage summary file '" + summaryFile + "' doesnot exist or it is not a valid file.";
assert(err == expectedMessage);
done();
});
})
it('codecoverage.publish : publish summary fails when summary xml is not a valid file', function(done) {
this.timeout(2000);
var properties: { [name: string]: string } = { "summaryfile": reportDirectory, "codecoveragetool": "JaCoCo" };
var command: cm.ITaskCommand = new tc.TestCommand(null, null, null);
command.properties = properties;
testExecutionContext = new tec.TestExecutionContext(new jobInf.TestJobInfo({}));
//.........这里部分代码省略.........
开发者ID:IvyMH,项目名称:vso-agent,代码行数:101,代码来源:publishcodecoveragetests.ts
注:本文中的shelljs.tempdir函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论