Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

loadmill

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loadmill - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

lib/index.ts

77

index.js

@@ -1,1 +0,76 @@

module.exports = function (options) {};
"use strict";
var tslib_1 = require("tslib");
var fs = require("fs");
var superagent = require("superagent");
var LoadmillClient = (function () {
function LoadmillClient(token) {
var _this = this;
this.token = token;
this.run = function (config, paramsOrCallback) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var testId;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
config = toConfig(config, paramsOrCallback);
return [4 /*yield*/, this._auth(superagent.post("https://www.loadmill.com/api/tests")
.send(config))];
case 1:
testId = (_a.sent()).body.testId;
return [4 /*yield*/, this._auth(superagent.put("https://www.loadmill.com/api/tests/" + testId + "/load"))];
case 2:
_a.sent();
return [2 /*return*/, testId];
}
});
}); };
this.runFunctional = function (config, paramsOrCallback) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var _a, id, trialResult, incompleteMessage;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
config = toConfig(config, paramsOrCallback);
return [4 /*yield*/, this._auth(superagent.post("https://www.loadmill.com/api/tests/trials")
.send(config))];
case 1:
_a = (_b.sent()).body, id = _a.id, trialResult = _a.trialResult, incompleteMessage = _a.incompleteMessage;
if (incompleteMessage) {
throw Error(incompleteMessage);
}
else {
return [2 /*return*/, {
id: id,
url: "https://www.loadmill.com/app/functional/" + id,
passed: trialResult && Object.keys(trialResult.failures || {}).length === 0
}];
}
return [2 /*return*/];
}
});
}); };
this._auth = function (req) { return req.auth(_this.token, ''); };
}
return LoadmillClient;
}());
function toConfig(config, paramsOrCallback) {
if (typeof config === 'string') {
var text = fs.readFileSync(config).toString();
config = JSON.parse(text);
}
if (typeof paramsOrCallback === 'object' && paramsOrCallback != null) {
var parameters = config.parameters;
if (!parameters) {
config.parameters = paramsOrCallback;
}
else if (typeof parameters.push === 'function') {
parameters.push(paramsOrCallback);
}
else {
config.parameters = [parameters, paramsOrCallback];
}
}
return config;
}
module.exports = function (_a) {
var token = _a.token;
return new LoadmillClient(token);
};
{
"name": "loadmill",
"version": "0.0.3",
"version": "0.0.4",
"description": "A node.js module for running load tests and functional tests on loadmill.com",

@@ -15,3 +15,14 @@ "keywords": [

"author": "itaysabato <itay@loadmill.com>",
"license": "MIT"
"license": "MIT",
"scripts": {
"postinstall": "tsc"
},
"dependencies": {
"superagent": "^3.5.2"
},
"devDependencies": {
"@types/node": "^8.0.10",
"tslib": "^1.7.1",
"typescript": "^2.4.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc