當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript shelljs.tempdir函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。