• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript mock-test.MockTestRunner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: it

    it('roots patterns', (done: MochaDone) => {
        this.timeout(1000);

        let testPath = path.join(__dirname, 'L0rootsPatterns.js');
        let runner: mocktest.MockTestRunner = new mocktest.MockTestRunner(testPath);
        runner.run();

        assert(
            runner.succeeded,
            'should have succeeded');
        assert(
            runner.stdOutContained(`copying ${path.normalize('/srcDir/someOtherDir/file1.file')} to ${path.normalize('/destDir/someOtherDir/file1.file')}`),
            'should have copied file1');
        assert(
            runner.stdOutContained(`copying ${path.normalize('/srcDir/someOtherDir/file2.file')} to ${path.normalize('/destDir/someOtherDir/file2.file')}`),
            'should have copied file2');
        assert(
            runner.stdOutContained(`copying ${path.normalize('/srcDir/someOtherDir2/file2.file')} to ${path.normalize('/destDir/someOtherDir2/file2.file')}`),
            'should have copied file1');
        done();
    });
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:21,代码来源:L0.ts


示例2: it

    it('run gradle with all default inputs', (done) => {
        let tp: string = path.join(__dirname, 'L0AllDefaultInputs.js');
        let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

        try {
            tr.run();

            assert(tr.ran(gradleWrapper + ' build'), 'it should have run gradlew build');
            assert(tr.invokedToolCount === 1, 'should have only run gradle 1 time');
            assert(tr.stderr.length === 0, 'should not have written to stderr');
            assert(tr.succeeded, 'task should have succeeded');
            assert(tr.stdout.indexOf('GRADLE_OPTS is now set to -Xmx2048m') > 0);

            done();
        } catch (err) {
            console.log(tr.stdout);
            console.log(tr.stderr);
            console.log(err);
            done(err);
        }
    });
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:21,代码来源:L0.ts


示例3: it

    it('Positive path: upload Calabash test with service endpoint', function () {
        this.timeout(4000);

        let tp = path.join(__dirname, 'L0CalabashPass.js');
        let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

        tr.run();
        assert(tr.succeeded, 'task should have succeeded');
        assert(tr.invokedToolCount === 2, 'Should have run test prepare and test run');
        assert(tr.ran("/path/to/appcenter test prepare calabash --artifacts-dir " +
            "/path/to/artifactsDir --app-path /test/path/to/my.ipa --project-dir " +
            "/path/to/project --sign-info SignInfo --config-path /path/to/configfile " +
            "--profile myProfile --quiet"),
            "Should have run prepare");

        assert(tr.ran("/path/to/appcenter test run manifest " +
            "--manifest-path /path/to/artifactsDir/manifest.json --app-path /test/path/to/my.ipa " +
            "--app testuser/testapp --devices 1234abcd --test-series master --dsym-dir /path/to/dsym " +
            "--async --locale nl_NL --myRunOpts abc --quiet --token mytoken123"),
            "Should have run test run");
    });
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:21,代码来源:L0.ts


示例4: it

    it('Should have the correct url if the job is under folder', (done) => {
        const tp: string = path.join(__dirname, 'L0FolderJobShouldHaveCorrectUrl.js');
        const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

        try {
            tr.run();

            let expectedMessage: string = "Found Jenkins job details jobName:folder1/folder2/testmultibranchproject, jobType:org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject, buildId:20, IsMultiBranchPipeline:true, MultiBranchPipelineName:master";
            assert(tr.stdout.indexOf(expectedMessage) != -1, "Should correctly find the Latest job is inside a folder");

            let buildIndexApi: string = "http://url/job/folder1/job/folder2/job/testmultibranchproject//job/master/20/api/json?tree=number,result,actions[remoteUrls],changeSet[kind,items[commitId,date,msg,author[fullName]]]";
            assert(tr.stdout.indexOf(buildIndexApi) != -1, "Url for folder job should be correct");

            done();
        } catch(err) {
            console.log(tr.stdout);
            console.log(tr.stderr);
            console.log(err);
            done(err);
        }
    });
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:21,代码来源:L0.ts


示例5: it

        it('Downloads packer for linux agent if packer of lower version exists', (done:MochaDone) => {
            process.env["__packer_exists__"] = "true";
            process.env["__lower_version__"] = "true";

            let tp = path.join(__dirname, 'L0LinuxInstallPacker.js');
            let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
            tr.run();
            process.env["__packer_exists__"] = "false";
            process.env["__lower_version__"] = "false";

            assert(tr.invokedToolCount == 4, 'should have invoked tool four times. actual: ' + tr.invokedToolCount);
            assert(tr.stderr.length == 0 || tr.errorIssues.length, 'should not have written to stderr');
            assert(tr.succeeded, 'task should have succeeded');
            assert(tr.stdout.indexOf("loc_mock_DownloadingPackerRequired") != -1, "should show message that packer will be downloaded");
            assert(tr.stdout.indexOf("Downloading packer from url: https://releases.hashicorp.com/packer/0.12.3/packer_0.12.3_linux_amd64.zip") != -1, "should download from correct url");
            assert(tr.stdout.indexOf("downloading from url https://releases.hashicorp.com/packer/0.12.3/packer_0.12.3_linux_amd64.zip to /tmp/tempdir/100/packer.zip") != -1, "should download to correct staging dir");
            assert(tr.stdout.indexOf("extracting from zip /tmp/tempdir/100/packer.zip to /tmp/tempdir/100/packer") != -1, "should extract from and to correct path");
            assert(tr.stdout.indexOf("Packer path to be used by task: /tmp/tempdir/100/packer/packer") != -1, "should show message that packer will be downloaded");
            assert(tr.stdout.indexOf("##vso[task.setvariable variable=imageUri;issecret=false;]https://bishalpackerimages.blob.core.windows.net/system/Microsoft.Compute/Images/packer/packer-osDisk.e2e08a75-2d73-49ad-97c2-77f8070b65f5.vhd") != -1, "image uri output variable not set");
            done();
        });
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:21,代码来源:L0.ts


示例6: it

    it('Run successfully when the user provides the version for kubectl with checkLatest as true', (done:MochaDone) => {
        let tp = path.join(__dirname, 'TestSetup.js');
        let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
        process.env[shared.TestEnvVars.command] = shared.Commands.get;
        process.env[shared.TestEnvVars.arguments] = "pods";    
        process.env[shared.TestEnvVars.versionOrLocation] = "version";
        process.env[shared.TestEnvVars.versionSpec] = "1.5.0";
        process.env[shared.TestEnvVars.checkLatest] = "true";
        process.env[shared.isKubectlPresentOnMachine] = "false";
        tr.run();

        assert(tr.invokedToolCount == 1, 'should have invoked tool one times. actual: ' + tr.invokedToolCount);
        assert(tr.stderr.length == 0 || tr.errorIssues.length, 'should not have written to stderr');
        assert(tr.succeeded, 'task should have succeeded');
        assert(tr.stdout.indexOf(`Get stable kubectl version`) != -1, "Stable version of kubectl is downloaded");
        assert(tr.stdout.indexOf(`Got kubectl version v1.6.6`) != -1, "Got the latest version of kubectl");
        assert(tr.stdout.indexOf(`Downloaded kubectl version v1.6.6`) != -1, "Downloaded correct version of kubectl");
        assert(tr.stdout.indexOf(`[command]${shared.formatPath("newUserDir/kubectl.exe")} get pods -o json`) != -1, "kubectl get should run");
        console.log(tr.stderr);
        done();
    });
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:21,代码来源:L0.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript task._writeLine函数代码示例发布时间:2022-05-25
下一篇:
TypeScript mock-task.setAnswers函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap