Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
suite.setupSuiteAsync(function (setUpDone) {
// commonly used variables
location = suite.Get('location', 'centralus');
resourceGroupName = suite.Get('resourceGroupName', 'rsmt-rnr-rg');
client = new ServerManagement(suite.credentials, suite.subscriptionId, baseUrl);
// adapt the SMT client library to use promises.
Promise.adaptToPromise(client.gateway);
Promise.adaptToPromise(client.node);
Promise.adaptToPromise(client.session);
Promise.adaptToPromise(client.powerShell);
setUpDone(); // We tell the test framework we are done setting up
done(); // We tell mocha we are done with the 'before' part
});
});
suite.setupSuiteAsync(function (setUpDone) {
// commonly used variables
location = suite.Get('location', 'centralus');
resourceGroupName = suite.Get('resourceGroupName', 'rsmt-rnr-rg');
client = new ServerManagement(suite.credentials, suite.subscriptionId, baseUrl);
// adapt the SMT client library to use promises.
Promise.adaptToPromise(client.gateway);
Promise.adaptToPromise(client.node);
Promise.adaptToPromise(client.session);
Promise.adaptToPromise(client.powerShell);
setUpDone(); // We tell the test framework we are done setting up
done(); // We tell mocha we are done with the 'before' part
});
});
suite.setupSuiteAsync(function (setUpDone) {
// commonly used variables
location = suite.Get('location', 'centralus');
resourceGroupName = suite.Get('resourceGroupName', 'rsmt-rnr-rg');
client = new ServerManagement(suite.credentials, suite.subscriptionId, baseUrl);
// adapt the SMT client library to use promises.
Promise.adaptToPromise(client.gateway);
Promise.adaptToPromise(client.node);
Promise.adaptToPromise(client.session);
Promise.adaptToPromise(client.powerShell);
setUpDone(); // We tell the test framework we are done setting up
done(); // We tell mocha we are done with the 'before' part
});
});
Promise.adaptToPromise = function (fn, argumentCount) {
if (typeof (fn) == 'object') {
// adapt members of an object
for (var each in fn) {
if (typeof (fn[each]) == 'function' && !each.startsWith("begin")) {
fn[each] = Promise.adaptToPromise(fn[each]);
}
}
return;
}
if (typeof (fn) != 'function') {
return;
}
// adapt a function.
argumentCount = argumentCount || Infinity;
return function () {
var self = this;
var args = Array.prototype.slice.call(arguments);
return new Promise(function (resolve, reject) {
while (args.length && args.length > argumentCount) {
args.pop();
}
suite.setupSuiteAsync(function (setUpDone) {
// commonly used variables
location = suite.Get('location', 'centralus');
resourceGroupName = suite.Get('resourceGroupName', 'rsmt-rnr-rg');
client = new ServerManagement(suite.credentials, suite.subscriptionId, baseUrl);
// adapt the SMT client library to use promises.
Promise.adaptToPromise(client.gateway);
Promise.adaptToPromise(client.node);
Promise.adaptToPromise(client.session);
Promise.adaptToPromise(client.powerShell);
setUpDone(); // We tell the test framework we are done setting up
done(); // We tell mocha we are done with the 'before' part
});
});