本文整理汇总了TypeScript中performance-now.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: publishCodeChanges
function publishCodeChanges(): Q.Promise<string> {
var startTime = perf();
var endTime : number;
var elapsedTime: number;
var defer = Q.defer<string>();
var selectortool = tl.createToolRunner(getTestSelectorLocation());
selectortool.arg("PublishCodeChanges");
selectortool.arg("/TfsTeamProjectCollection:" + tl.getVariable("System.TeamFoundationCollectionUri"));
selectortool.arg("/ProjectId:" + tl.getVariable("System.TeamProject"));
selectortool.arg("/newdropPath:" + tl.getVariable("Build.SourcesDirectory"));
selectortool.arg("/Definitionid:" + tl.getVariable("System.DefinitionId"));
selectortool.arg("/buildid:" + tl.getVariable("Build.BuildId"));
selectortool.arg("/token:" + tl.getEndpointAuthorizationParameter("SystemVssConnection", "AccessToken", false));
selectortool.exec()
.then(function(code) {
endTime = perf();
elapsedTime = endTime - startTime;
tl._writeLine("##vso[task.logissue type=warning;SubTaskName=PublishCodeChanges;SubTaskDuration=" + elapsedTime + "]");
tl.debug(tl.loc("PublishCodeChangesPerfTime", elapsedTime));
defer.resolve(String(code));
})
.fail(function (err) {
defer.reject(err);
});
return defer.promise;
}
示例2: perf
.then(function(code) {
endTime = perf();
elapsedTime = endTime - startTime;
tl._writeLine("##vso[task.logissue type=warning;SubTaskName=PublishCodeChanges;SubTaskDuration=" + elapsedTime + "]");
tl.debug(tl.loc("PublishCodeChangesPerfTime", elapsedTime));
defer.resolve(String(code));
})
示例3: generateResponseFile
function generateResponseFile(): Q.Promise<string> {
var startTime = perf();
var endTime : number;
var elapsedTime : number;
var defer = Q.defer<string>();
var tempFile = path.join(os.tmpdir(), uuid.v1() + ".txt");
tl.debug("Response file will be generated at " + tempFile);
var selectortool = tl.createToolRunner(getTestSelectorLocation());
selectortool.arg("GetImpactedtests");
selectortool.arg("/TfsTeamProjectCollection:" + tl.getVariable("System.TeamFoundationCollectionUri"));
selectortool.arg("/ProjectId:" + tl.getVariable("System.TeamProject"));
selectortool.arg("/buildid:" + tl.getVariable("Build.BuildId"));
selectortool.arg("/token:" + tl.getEndpointAuthorizationParameter("SystemVssConnection", "AccessToken", false));
selectortool.arg("/responsefile:" + tempFile);
selectortool.exec()
.then(function (code) {
endTime = perf();
elapsedTime = endTime - startTime;
tl._writeLine("##vso[task.logissue type=warning;SubTaskName=GenerateResponseFile;SubTaskDuration=" + elapsedTime + "]");
tl.debug(tl.loc("GenerateResponseFilePerfTime", elapsedTime));
defer.resolve(tempFile);
})
.fail(function (err) {
defer.reject(err);
});
return defer.promise;
}
示例4: processEvent
function processEvent() {
if (paused) {
return;
}
const time = now();
setTime(time);
if (scheduler.isEmpty()) {
return;
}
let nextEventTime = scheduler.peek().time;
while (nextEventTime < time) {
const eventToProcess = scheduler.shiftNextEntry();
if (!eventToProcess.cancelled) {
if (eventToProcess.f) {
eventToProcess.f(eventToProcess, time, scheduler.add, currentTime);
}
if (eventToProcess.type === 'next') {
eventToProcess.stream.shamefullySendNext(eventToProcess.value);
}
if (eventToProcess.type === 'complete') {
eventToProcess.stream.shamefullySendComplete();
}
}
nextEventTime = (scheduler.peek() && scheduler.peek().time) || Infinity;
}
}
示例5: timerPoll
timerPoll() {
if (this.currentTask) {
if ((now() - this.writeTime) > this.MAX_TIME_OUT)
{
this.retryCurrentTask();
}
}
}
示例6: uploadTestResults
public uploadTestResults(tiaConfig: models.TiaConfiguration, vstestConfig: models.VsTestConfigurations, testResultsDirectory: string): number {
const startTime = perf();
let endTime;
let elapsedTime;
let definitionRunId: string;
let resultFile: string;
let resultFiles;
if (!Helper.isNullOrWhitespace(testResultsDirectory)) {
resultFiles = tl.findMatch(testResultsDirectory, path.join(testResultsDirectory, '*.trx'));
}
const selectortool = tl.tool(this.getTestSelectorLocation());
selectortool.arg('UpdateTestResults');
if (tiaConfig.context === 'CD') {
definitionRunId = tl.getVariable('Release.ReleaseId');
} else {
definitionRunId = tl.getVariable('Build.BuildId');
}
if (resultFiles && resultFiles[0]) {
resultFile = resultFiles[0];
}
let output = selectortool.execSync({
cwd: null,
env: {
'collectionurl': tl.getVariable('System.TeamFoundationCollectionUri'),
'projectid': tl.getVariable('System.TeamProject'),
'definitionrunid': definitionRunId,
'token': tl.getEndpointAuthorizationParameter('SystemVssConnection', 'AccessToken', false),
'resultfile': resultFile,
'runidfile': tiaConfig.runIdFile,
'context': tiaConfig.context,
'proxyurl': vstestConfig.proxyConfiguration.proxyUrl,
'proxyusername': vstestConfig.proxyConfiguration.proxyUserName,
'proxypassword': vstestConfig.proxyConfiguration.proxyPassword,
'proxybypasslist': vstestConfig.proxyConfiguration.proxyBypassHosts,
'AGENT_VERSION': tl.getVariable('AGENT.VERSION'),
'VsTest_TaskInstanceIdentifier': vstestConfig.taskInstanceIdentifier,
'VSTS_HTTP_RETRY': tl.getVariable('VSTS_HTTP_RETRY'),
'VSTS_HTTP_TIMEOUT': tl.getVariable('VSTS_HTTP_TIMEOUT'),
'DebugLogging': this.isDebugEnabled()
},
silent: null,
outStream: null,
errStream: null,
windowsVerbatimArguments: null
});
endTime = perf();
elapsedTime = endTime - startTime;
console.log('##vso[task.logissue type=warning;SubTaskName=UploadTestResults;SubTaskDuration=' + elapsedTime + ']');
tl.debug(tl.loc('UploadTestResultsPerfTime', elapsedTime));
if (output.code !== 0) {
tl.error(output.stderr);
}
tl.debug('Completed updating test results');
return output.code;
}
示例7: generateResponseFile
public generateResponseFile(tiaConfig: models.TiaConfiguration, vstestConfig: models.VsTestConfigurations, discoveredTests: string, testCaseFilterOutputFile: string): number {
const startTime = perf();
let endTime: number;
let elapsedTime: number;
let definitionRunId: string;
let title: string;
let platformInput: string;
let configurationInput: string;
let useTestCaseFilterInResponseFile: string;
tl.debug('Response file will be generated at ' + tiaConfig.responseFile);
tl.debug('RunId file will be generated at ' + tiaConfig.runIdFile);
const selectortool = tl.tool(this.getTestSelectorLocation());
selectortool.arg('GetImpactedtests');
if (tiaConfig.context === 'CD') {
// Release context. Passing Release Id.
definitionRunId = tl.getVariable('Release.ReleaseId');
} else {
// Build context. Passing build id.
definitionRunId = tl.getVariable('Build.BuildId');
}
if (vstestConfig.buildPlatform) {
platformInput = vstestConfig.buildPlatform;
} else {
platformInput = '';
}
if (vstestConfig.testRunTitle) {
title = vstestConfig.testRunTitle;
} else {
title = '';
}
if (vstestConfig.buildConfig) {
configurationInput = vstestConfig.buildConfig;
} else {
configurationInput = '';
}
if (tiaConfig.useTestCaseFilterInResponseFile && tiaConfig.useTestCaseFilterInResponseFile.toUpperCase() === 'TRUE') {
useTestCaseFilterInResponseFile = 'true';
} else {
useTestCaseFilterInResponseFile = 'false';
}
let output = selectortool.execSync({
cwd: null,
env: {
'collectionurl': tl.getVariable('System.TeamFoundationCollectionUri'),
'projectid': tl.getVariable('System.TeamProject'),
'definitionrunid': definitionRunId,
'releaseuri': tl.getVariable('release.releaseUri'),
'releaseenvuri': tl.getVariable('release.environmentUri'),
'token': tl.getEndpointAuthorizationParameter('SystemVssConnection', 'AccessToken', false),
'responsefilepath': tiaConfig.responseFile,
'discoveredtestspath': discoveredTests,
'runidfilepath': tiaConfig.runIdFile,
'testruntitle': title,
'baselinebuildfilepath': tiaConfig.baseLineBuildIdFile,
'context': tiaConfig.context,
'platform': platformInput,
'configuration': configurationInput,
'useTestCaseFilterInResponseFile': useTestCaseFilterInResponseFile,
'testCaseFilterOutputFile': testCaseFilterOutputFile ? testCaseFilterOutputFile : "",
'isCustomEngineEnabled': String(!Helper.isNullOrWhitespace(tiaConfig.userMapFile)),
'proxyurl': vstestConfig.proxyConfiguration.proxyUrl,
'proxyusername': vstestConfig.proxyConfiguration.proxyUserName,
'proxypassword': vstestConfig.proxyConfiguration.proxyPassword,
'proxybypasslist': vstestConfig.proxyConfiguration.proxyBypassHosts,
'AGENT_VERSION': tl.getVariable('AGENT.VERSION'),
'VsTest_TaskInstanceIdentifier': vstestConfig.taskInstanceIdentifier,
'VSTS_HTTP_RETRY': tl.getVariable('VSTS_HTTP_RETRY'),
'VSTS_HTTP_TIMEOUT': tl.getVariable('VSTS_HTTP_TIMEOUT'),
'DebugLogging': this.isDebugEnabled()
},
silent: null,
outStream: null,
errStream: null,
windowsVerbatimArguments: null
});
endTime = perf();
elapsedTime = endTime - startTime;
console.log('##vso[task.logissue type=warning;SubTaskName=GetImpactedTests;SubTaskDuration=' + elapsedTime + ']');
tl.debug(tl.loc('GenerateResponseFilePerfTime', elapsedTime));
if (output.code !== 0) {
tl.error(output.stderr);
}
tl.debug('completed publish code changes');
return output.code;
}
示例8: publishCodeChanges
public publishCodeChanges(tiaConfig: models.TiaConfiguration, proxyConfig: models.ProxyConfiguration, testCaseFilterFile: string, taskInstanceIdentifier: string): number {
tl.debug('Entered publish code changes');
const startTime = perf();
let endTime: number;
let elapsedTime: number;
let pathFilters: string;
let definitionRunId: string;
let definitionId: string;
let prFlow: string;
let rebaseLimit: string;
let sourcesDirectory: string;
let newprovider = 'true';
if (this.getTIALevel(tiaConfig) === 'method') {
newprovider = 'false';
}
const selectortool = tl.tool(this.getTestSelectorLocation());
selectortool.arg('PublishCodeChanges');
if (tiaConfig.context === 'CD') {
// Release context. Passing Release Id.
definitionRunId = tl.getVariable('Release.ReleaseId');
definitionId = tl.getVariable('release.DefinitionId');
} else {
// Build context. Passing build id.
definitionRunId = tl.getVariable('Build.BuildId');
definitionId = tl.getVariable('System.DefinitionId');
}
if (tiaConfig.isPrFlow && tiaConfig.isPrFlow.toUpperCase() === 'TRUE') {
prFlow = 'true';
} else {
prFlow = 'false';
}
if (tiaConfig.tiaRebaseLimit) {
rebaseLimit = tiaConfig.tiaRebaseLimit;
}
if (typeof tiaConfig.tiaFilterPaths !== 'undefined') {
pathFilters = tiaConfig.tiaFilterPaths.trim();
} else {
pathFilters = '';
}
if (typeof tiaConfig.sourcesDir !== 'undefined') {
sourcesDirectory = tiaConfig.sourcesDir.trim();
} else {
sourcesDirectory = '';
}
let output = selectortool.execSync({
cwd: null,
env: {
'collectionurl': tl.getVariable('System.TeamFoundationCollectionUri'),
'projectid': tl.getVariable('System.TeamProject'),
'definitionrunid': definitionRunId,
'definitionid': definitionId,
'token': tl.getEndpointAuthorizationParameter('SystemVssConnection', 'AccessToken', false),
'sourcesdir': sourcesDirectory,
'newprovider': newprovider,
'prflow': prFlow,
'rebaselimit': rebaseLimit,
'baselinefile': tiaConfig.baseLineBuildIdFile,
'context': tiaConfig.context,
'filter': pathFilters,
'userMapFile': tiaConfig.userMapFile ? tiaConfig.userMapFile : '',
'testCaseFilterResponseFile': testCaseFilterFile ? testCaseFilterFile : '',
'proxyurl': proxyConfig.proxyUrl,
'proxyusername': proxyConfig.proxyUserName,
'proxypassword': proxyConfig.proxyPassword,
'proxybypasslist': proxyConfig.proxyBypassHosts,
'AGENT_VERSION': tl.getVariable('AGENT.VERSION'),
'VsTest_TaskInstanceIdentifier': taskInstanceIdentifier,
'VSTS_HTTP_RETRY': tl.getVariable('VSTS_HTTP_RETRY'),
'VSTS_HTTP_TIMEOUT': tl.getVariable('VSTS_HTTP_TIMEOUT'),
'DebugLogging': this.isDebugEnabled()
},
silent: null,
outStream: null,
errStream: null,
windowsVerbatimArguments: null
});
endTime = perf();
elapsedTime = endTime - startTime;
console.log('##vso[task.logissue type=warning;SubTaskName=PublishCodeChanges;SubTaskDuration=' + elapsedTime + ']');
tl.debug(tl.loc('PublishCodeChangesPerfTime', elapsedTime));
if (output.code !== 0) {
tl.warning(output.stderr);
}
tl.debug('completed publish code changes');
return output.code;
}
示例9: publishCodeChangesInDistributedMode
public publishCodeChangesInDistributedMode(inputDataContract: inputdatacontract.InputDataContract): number {
tl.debug('Entered publish code changes');
const startTime = perf();
let endTime: number;
let elapsedTime: number;
let pathFilters: string;
let definitionRunId: string;
let definitionId: string;
let prFlow: string;
let rebaseLimit: string;
let sourcesDirectory: string;
let context: string;
let newprovider = 'true';
if (!inputDataContract.ExecutionSettings.TiaSettings.FileLevel) {
newprovider = 'false';
}
const selectortool = tl.tool(this.getTestSelectorLocation());
selectortool.arg('PublishCodeChanges');
if (tl.getVariable('release.releaseUri')) {
// Release context. Passing Release Id.
context = 'CD';
definitionRunId = tl.getVariable('Release.ReleaseId');
definitionId = tl.getVariable('release.DefinitionId');
} else {
// Build context. Passing build id.
context = 'CI';
definitionRunId = tl.getVariable('Build.BuildId');
definitionId = tl.getVariable('System.DefinitionId');
}
if (inputDataContract.ExecutionSettings.TiaSettings.IsPrFlow) {
prFlow = 'true';
} else {
prFlow = 'false';
}
//hydra: check if this conversion works fine (number to string)
if (inputDataContract.ExecutionSettings.TiaSettings.RebaseLimit) {
rebaseLimit = inputDataContract.ExecutionSettings.TiaSettings.RebaseLimit.toString();
}
if (inputDataContract.ExecutionSettings.TiaSettings.FilterPaths) {
pathFilters = inputDataContract.ExecutionSettings.TiaSettings.FilterPaths.trim();
} else {
pathFilters = '';
}
if (inputDataContract.ExecutionSettings.TiaSettings.SourcesDirectory) {
sourcesDirectory = inputDataContract.ExecutionSettings.TiaSettings.SourcesDirectory.trim();
} else {
sourcesDirectory = '';
}
const output = selectortool.execSync({
cwd: null,
env: {
'collectionurl': tl.getVariable('System.TeamFoundationCollectionUri'),
'projectid': tl.getVariable('System.TeamProject'),
'definitionrunid': definitionRunId,
'definitionid': definitionId,
'token': tl.getEndpointAuthorizationParameter('SystemVssConnection', 'AccessToken', false),
'sourcesdir': sourcesDirectory,
'newprovider': newprovider,
'prflow': prFlow,
'rebaselimit': rebaseLimit,
'baselinefile': inputDataContract.TiaBaseLineBuildIdFile,
'context': context,
'filter': pathFilters,
'userMapFile': inputDataContract.ExecutionSettings.TiaSettings.UserMapFile ? inputDataContract.ExecutionSettings.TiaSettings.UserMapFile : '',
'testCaseFilterResponseFile': '',
'proxyurl': inputDataContract.ProxySettings.ProxyUrl,
'proxyusername': inputDataContract.ProxySettings.ProxyUsername,
'proxypassword': inputDataContract.ProxySettings.ProxyPassword,
'proxybypasslist': inputDataContract.ProxySettings.ProxyBypassHosts,
'AGENT_VERSION': tl.getVariable('AGENT.VERSION'),
'VsTest_TaskInstanceIdentifier': uuid.v1(),
'VSTS_HTTP_RETRY': tl.getVariable('VSTS_HTTP_RETRY'),
'VSTS_HTTP_TIMEOUT': tl.getVariable('VSTS_HTTP_TIMEOUT'),
'DebugLogging': this.isDebugEnabled()
},
silent: null,
outStream: null,
errStream: null,
windowsVerbatimArguments: null
});
endTime = perf();
elapsedTime = endTime - startTime;
console.log('##vso[task.logissue type=warning;SubTaskName=PublishCodeChanges;SubTaskDuration=' + elapsedTime + ']');
tl.debug(tl.loc('PublishCodeChangesPerfTime', elapsedTime));
if (output.code !== 0) {
tl.warning(output.stderr);
}
tl.debug('completed publish code changes');
//.........这里部分代码省略.........