本文整理汇总了TypeScript中mocha-typescript.timeout函数的典型用法代码示例。如果您正苦于以下问题:TypeScript timeout函数的具体用法?TypeScript timeout怎么用?TypeScript timeout使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了timeout函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Error
@test @timeout(10000) async "AutoRest.dll Modeler"() {
const autoRest = new AutoRest();
const config = await autoRest.view;
const dataStore = config.DataStore;
// load swagger
const swagger = await LoadLiterateSwagger(
config,
dataStore.GetReadThroughScope(),
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2016-12-01/swagger/network.json",
dataStore.CreateScope("loader"));
// call modeler
const autorestPlugin = await GetAutoRestDotNetPlugin();
const pluginScope = dataStore.CreateScope("plugin");
const result = await autorestPlugin.Process("modeler", key => { return ({ namespace: "SomeNamespace" } as any)[key]; }, new QuickScope([swagger]), pluginScope, m => null, CancellationToken.None);
assert.strictEqual(result, true);
const results = await pluginScope.Enum();
if (results.length !== 1) {
throw new Error(`Modeler plugin produced '${results.length}' items. Only expected one (the code model).`);
}
// check results
const codeModel = (await pluginScope.ReadStrict(results[0])).ReadData();
assert.notEqual(codeModel.indexOf("isPolymorphicDiscriminator"), -1);
}
示例2: AutoRest
@test @timeout(10000) async "AutoRest.dll AzureValidator"() {
const autoRest = new AutoRest();
const config = await autoRest.view;
const dataStore = config.DataStore;
// load swagger
const swagger = await LoadLiterateSwagger(
config,
dataStore.GetReadThroughScope(),
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2016-12-01/swagger/network.json",
dataStore.CreateScope("loader"));
// call validator
const autorestPlugin = await GetAutoRestDotNetPlugin();
const pluginScope = dataStore.CreateScope("plugin");
const messages: Message[] = [];
let currConfig: any = {
'openapi-type': 'arm',
'merge-state': 'composed'
};
const result = await autorestPlugin.Process("azure-validator", key => currConfig[key], new QuickScope([swagger]), pluginScope, m => messages.push(m), CancellationToken.None);
assert.strictEqual(result, true);
// check results
assert.notEqual(messages.length, 0);
for (const message of messages) {
assert.ok(message);
assert.ok(message.Details.code);
assert.ok(message.Text);
assert.ok(message.Details.validationCategory);
assert.strictEqual(message.Plugin, "azure-validator");
}
}
示例3: AutoRest
@test @timeout(120000) async "network full game"() {
const autoRest = new AutoRest(new RealFileSystem());
// PumpMessagesToConsole(autoRest);
autoRest.AddConfiguration({
"input-file": [
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/applicationGateway.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/checkDnsAvailability.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/expressRouteCircuit.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/loadBalancer.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/network.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/networkInterface.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/networkSecurityGroup.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/networkWatcher.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/publicIpAddress.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/routeFilter.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/routeTable.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/serviceCommunity.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/usage.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/virtualNetwork.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/virtualNetworkGateway.json",
"https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/vmssNetworkInterface.json"]
});
autoRest.AddConfiguration({
"override-info": {
title: "Network"
}
});
// TODO: generate for all, probe results
const success = await autoRest.Process().finish;
assert.strictEqual(success, true);
}
示例4: Error
@test @skip @timeout(10000) async "AutoRest.dll Modeler"() {
const autoRest = new AutoRest();
const config = await autoRest.view;
const dataStore = config.DataStore;
// load swagger
const swagger = await LoadLiterateSwagger(
config,
dataStore.GetReadThroughScope(new RealFileSystem()),
"https://github.com/Azure/azure-rest-api-specs/blob/fa91f9109c1e9107bb92027924ec2983b067f5ec/arm-network/2016-12-01/swagger/network.json",
dataStore.getDataSink());
// call modeler
const autorestPlugin = await GetAutoRestDotNetPlugin("modeler");
const results: DataHandle[] = [];
const result = await autorestPlugin.Process("modeler", key => { return ({ namespace: "SomeNamespace" } as any)[key]; }, new QuickDataSource([swagger]), dataStore.getDataSink(), f => results.push(f), m => null, CancellationToken.None);
assert.strictEqual(result, true);
if (results.length !== 1) {
throw new Error(`Modeler plugin produced '${results.length}' items. Only expected one (the code model).`);
}
// check results
const codeModel = results[0].ReadData();
assert.notEqual(codeModel.indexOf("isConstant"), -1);
}
示例5: SqlDb
@test @timeout(15000)
pg_select_batch_2000(done: () => void) {
let db = new SqlDb();
db.dbName = "test-pg";
db.dialect = "pg";
let sql: string[] = [];
let total = 2000;
for (let i = 0; i < total; i++) {
if (i === 100)
sql.push("select " + i + " as a777");
else
sql.push("select " + i + " as a777");
}
db.executeSQL(sql)
.then((tables: DataTable[]) => {
for (let i = 0; i < total; i++) {
let row = tables[i].rows[0];
assert.equal(row["a777"], i);
}
done();
})
.catch((error) => {
console.error(error);
throw error;
});
}
示例6: AutoRest
@test @timeout(60000) async "large swagger performance"() {
const autoRest = new AutoRest(new RealFileSystem(), ResolveUri(CreateFolderUri(__dirname), "resources/large-input/"));
await autoRest.AddConfiguration({ "output-artifact": ["swagger-document", "swagger-document.map"] });
const messages: Message[] = [];
autoRest.Message.Subscribe((_, m) => messages.push(m)); // was warning.
await autoRest.Process().finish;
assert.notEqual(messages.length, 0);
}
示例7: AutoRest
@test @timeout(60000) async "other configuration scenario"() {
const autoRest = new AutoRest(new RealFileSystem(), ResolveUri(CreateFolderUri(__dirname), "../../test/resources/literate-example/readme-complicated.md"));
// PumpMessagesToConsole(autoRest);
const config = await autoRest.view;
assert.strictEqual(config["shouldwork"], true);
}
示例8: compare
@test @timeout(30000) async "PlainTextVersion"() {
const compare = (raw: string, expected: string) =>
assert.strictEqual(PlainTextVersion(this.Parse(raw)), expected);
compare("Hello World", "Hello World");
compare("this\ntest\ncould\nuse\nmore\ncowbell", "this test could use more cowbell");
compare("actual\n\nnewline", "actual\nnewline");
compare("some **more** delicious *cowbell*", "some more delicious cowbell");
compare("add some `code` in there", "add some code in there");
compare("# Heading \n Body", "Heading\nBody");
compare("Fancy <b>html</b> features", "Fancy html features");
compare("Even <code>fancier</code> <i>html</i> tags<br> and<hr> stuff", "Even fancier html tags and stuff");
}