本文整理汇总了TypeScript中azure-pipelines-task-lib/mock-test.MockTestRunner类的典型用法代码示例。如果您正苦于以下问题:TypeScript MockTestRunner类的具体用法?TypeScript MockTestRunner怎么用?TypeScript MockTestRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MockTestRunner类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('Xcode 8 create IPA with bad exportOptionsPlist path', function (done: MochaDone) {
this.timeout(1000);
let tp = path.join(__dirname, 'L0ExportOptionsPlistBadPath.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.');
//build
assert(tr.ran('/home/bin/xcodebuild -sdk $(SDK) -configuration $(Configuration) ' +
'-workspace /user/build/fun.xcodeproj/project.xcworkspace -scheme testScheme build'),
'xcodebuild for building the ios project/workspace should have been run.');
//archive
assert(tr.ran('/home/bin/xcodebuild -workspace /user/build/fun.xcodeproj/project.xcworkspace -scheme testScheme ' +
'archive -sdk $(SDK) -configuration $(Configuration) -archivePath /user/build/testScheme'),
'xcodebuild archive should have been run to create the .xcarchive.');
assert(tr.invokedToolCount === 3, 'should have run xcodebuild for version, build, and archive.');
assert(tr.failed, 'task should have failed');
assert(tr.stdout.indexOf('##vso[task.issue type=error;]Error: loc_mock_ExportOptionsPlistInvalidFilePath') >= 0,
'Build should show error indicating invalid Plist file path.');
done();
});
示例2: it
it('Get latest pre-release version cache miss and download success', (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] = '0';
// Start the run
tr.run();
// Asserts
assert(tr.stderr.length === 0 || tr.errorIssues.length, 'should not have written to stderr');
assert(tr.succeeded, `Task should have succeeded`);
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(`Caching the downloaded folder temp\\VsTest\\${constants.packageId}.${process.env[testConstants.expectedTestPlatformVersion]}.`), `Should have cached ${process.env[testConstants.expectedTestPlatformVersion]}`);
assert(tr.stdOutContained(`Set variable VsTestToolsInstallerInstalledToolLocation value to VsTest\\${process.env[testConstants.expectedTestPlatformVersion]}.`), `Should have set variable to VsTest\\${process.env[testConstants.expectedTestPlatformVersion]}.`);
assert(tr.stdOutContained('InstallationSuccessful'));
done();
});
示例3: it
it("[VersionFetcher.DotNetCoreVersionFetcher] getVersionInfo should return latest version info in a major.minor version for a versionSpec of type majorVersion.minorVersion.x", (done) => {
process.env["__versionspec__"] = "2.2.x";
let tr = new ttm.MockTestRunner(path.join(__dirname, "versionFetcherGetVersionInfoTestsCorrect.js"));
tr.run();
runValidations(() => {
assert(tr.succeeded == true, ("Should have returned the correct version info."));
}, tr, done);
});