当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript MockTestRunner.run方法代码示例

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


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

示例1: it

    it('Get latest pre-release version cache miss and download failed and fallback cache miss', (done: MochaDone) => {

        // Setup the mock runner
        const tp = path.join(__dirname, 'TestSetup.js');
        const tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);

        // Set the inputs
        process.env[constants.versionSelector] = 'latestPreRelease';
        process.env[constants.testPlatformVersion] = '';
        process.env[testConstants.expectedTestPlatformVersion] = '15.6.0-preview-20171108-02';
        process.env[testConstants.listPackagesReturnCode] = '0';
        process.env[testConstants.downloadPackageReturnCode] = '1';

        // Start the run
        tr.run();

        // Asserts
        assert(tr.stderr.length !== 0 || tr.errorIssues.length, 'should not have written to stderr');
        assert(tr.failed, `Task should have failed`);
        assert(tr.stdOutContained(`LookingForLatestPreReleaseVersion`), `Should have looked for latest pre-release version.`);
        assert(tr.stdOutContained(`Found the latest version to be ${process.env[testConstants.expectedTestPlatformVersion]}.`), `Should have found latest version to be ${process.env[testConstants.expectedTestPlatformVersion]}`);
        assert(tr.stdOutContained(`Looking for version ${process.env[testConstants.expectedTestPlatformVersion]} in the tools cache.`), `Should have looked for ${process.env[testConstants.expectedTestPlatformVersion]} in the cache.`);
        assert(tr.stdOutContained(`Could not find Microsoft.TestPlatform.${process.env[testConstants.expectedTestPlatformVersion]} in the tools cache. Fetching it from nuget.`), `Should have encountered a cache miss for ${process.env[testConstants.expectedTestPlatformVersion]}.`);
        assert(tr.stdOutContained(`Downloading Test Platform version ${process.env[testConstants.expectedTestPlatformVersion]} from ${process.env[testConstants.packageSource]} to ${process.env[constants.downloadPath]}.`), `Should have attempted download of version ${process.env[testConstants.expectedTestPlatformVersion]}`);
        assert(tr.stdOutContained(`TestPlatformDownloadFailed`), `Download should have failed`);
        process.env[testConstants.expectedTestPlatformVersion] = 'x';
        assert(tr.stdOutContained(`Cache miss for ${process.env[testConstants.expectedTestPlatformVersion]}`), `Should have been a cache miss for ${process.env[testConstants.expectedTestPlatformVersion]}`);
        assert(tr.stdOutContained('NoPackageFoundInCache'), `Should warn no stable package found in cache`);
        assert(tr.stdOutContained('FailedToAcquireTestPlatform'), `Should fail with failed to acquire test platform`);

        done();
    });
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:32,代码来源:L0.ts

示例2: it

    it('Xcode 9 signing defaults to automatic, with auto export', function (done: MochaDone) {
        this.timeout(parseInt(process.env.TASK_TEST_TIMEOUT) || 20000);

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

        tr.run();
        //version
        assert(tr.ran('/home/bin/xcodebuild -version'), 'xcodebuild for version should have been run.');

        //export prep
        assert(tr.ran("/usr/libexec/PlistBuddy -c Clear _XcodeTaskExportOptions.plist"),
            'PlistBuddy Clear should have run.');

        assert(tr.ran("/usr/libexec/PlistBuddy -c Add method string app-store _XcodeTaskExportOptions.plist"),
            'PlistBuddy add method should have run.');

        //export
        assert(tr.ran('/home/bin/xcodebuild -exportArchive -archivePath /user/build/testScheme.xcarchive ' +
            '-exportPath /user/build -exportOptionsPlist _XcodeTaskExportOptions.plist'),
            'xcodebuild exportArchive should have been run to export the IPA from the .xcarchive');

        assert(tr.stderr.length === 0, 'should not have written to stderr');
        assert(tr.succeeded, 'task should have succeeded');
        assert(tr.invokedToolCount === 14, 'Should have run \"PlistBuddy -c Add...\" once, and 13 other command lines.');

        done();
    });
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:28,代码来源:L0.ts


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