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.2.1 to 0.2.2

2

lib/index.d.ts

@@ -20,3 +20,3 @@ export = Loadmill;

}
declare function Loadmill({token}: Loadmill.LoadmillOptions): {
declare function Loadmill(options: Loadmill.LoadmillOptions): {
run(config: Loadmill.Configuration, paramsOrCallback?: Loadmill.ParamsOrCallback, callback?: Loadmill.Callback): Promise<string>;

@@ -23,0 +23,0 @@ wait(testDefOrId: string | Loadmill.TestDef, callback?: Loadmill.Callback): Promise<Loadmill.TestResult>;

@@ -7,4 +7,5 @@ "use strict";

var TYPE_FUNCTIONAL = 'functional';
function Loadmill(_a) {
var token = _a.token;
function Loadmill(options) {
var _a = options, token = _a.token, _b = _a._testingServerHost, _testingServerHost = _b === void 0 ? "www.loadmill.com" : _b;
var testingServer = "https://" + _testingServerHost;
function _runFunctional(async, config, paramsOrCallback, callback) {

@@ -21,3 +22,3 @@ return tslib_1.__awaiter(this, void 0, void 0, function () {

config['async'] = async;
return [4 /*yield*/, superagent.post("https://www.loadmill.com/api/tests/trials")
return [4 /*yield*/, superagent.post(testingServer + "/api/tests/trials")
.send(config)

@@ -34,3 +35,3 @@ .auth(token, '')];

type: TYPE_FUNCTIONAL,
url: "https://www.loadmill.com/app/functional/" + id,
url: testingServer + "/app/functional/" + id,
passed: async ? null : isFunctionalPassed(trialResult)

@@ -55,3 +56,3 @@ }];

config = toConfig(config, paramsOrCallback);
return [4 /*yield*/, superagent.post("https://www.loadmill.com/api/tests")
return [4 /*yield*/, superagent.post(testingServer + "/api/tests")
.send(config)

@@ -61,3 +62,3 @@ .auth(token, '')];

testId = (_a.sent()).body.testId;
return [4 /*yield*/, superagent.put("https://www.loadmill.com/api/tests/" + testId + "/load")
return [4 /*yield*/, superagent.put(testingServer + "/api/tests/" + testId + "/load")
.auth(token, '')];

@@ -78,3 +79,4 @@ case 2:

} : testDefOrId;
var testUrls = getTestUrls(testDef);
var apiUrl = getTestUrl(testDef, testingServer + '/api/tests/', 'trials/', '');
var webUrl = getTestUrl(testDef, testingServer + '/app/', 'functional/', 'test/');
var intervalId = setInterval(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {

@@ -86,3 +88,3 @@ var _a, trialResult, result, testResult, err_1;

_b.trys.push([0, 2, , 3]);
return [4 /*yield*/, superagent.get(testUrls.api)
return [4 /*yield*/, superagent.get(apiUrl)
.auth(token, '')];

@@ -93,3 +95,3 @@ case 1:

clearInterval(intervalId);
testResult = tslib_1.__assign({}, testDef, { url: testUrls.web, passed: testDef.type === TYPE_LOAD ?
testResult = tslib_1.__assign({}, testDef, { url: webUrl, passed: testDef.type === TYPE_LOAD ?
result === 'done' : isFunctionalPassed(trialResult) });

@@ -138,8 +140,2 @@ if (callback) {

}
function getTestUrls(testDef) {
return {
api: getTestUrl(testDef, 'https://www.loadmill.com/api/tests/', 'trials/', ''),
web: getTestUrl(testDef, 'https://www.loadmill.com/app/', 'functional/', 'test/')
};
}
function getTestUrl(_a, prefix, funcSuffix, loadSuffix) {

@@ -146,0 +142,0 @@ var id = _a.id, type = _a.type;

{
"name": "loadmill",
"version": "0.2.1",
"version": "0.2.2",
"description": "A node.js module for running load tests and functional tests on loadmill.com",

@@ -5,0 +5,0 @@ "keywords": [

@@ -29,4 +29,10 @@ import * as fs from 'fs';

function Loadmill({token}: Loadmill.LoadmillOptions) {
function Loadmill(options: Loadmill.LoadmillOptions) {
const {
token,
_testingServerHost = "www.loadmill.com"
} = options as any;
const testingServer = "https://" + _testingServerHost;
async function _runFunctional(

@@ -50,3 +56,3 @@ async: boolean,

}
} = await superagent.post("https://www.loadmill.com/api/tests/trials")
} = await superagent.post(testingServer + "/api/tests/trials")
.send(config)

@@ -62,3 +68,3 @@ .auth(token, '');

type: TYPE_FUNCTIONAL,
url: `https://www.loadmill.com/app/functional/${id}`,
url: `${testingServer}/app/functional/${id}`,
passed: async ? null : isFunctionalPassed(trialResult),

@@ -82,7 +88,7 @@ };

const {body: {testId}} = await superagent.post("https://www.loadmill.com/api/tests")
const {body: {testId}} = await superagent.post(testingServer + "/api/tests")
.send(config)
.auth(token, '');
await superagent.put(`https://www.loadmill.com/api/tests/${testId}/load`)
await superagent.put(`${testingServer}/api/tests/${testId}/load`)
.auth(token, '');

@@ -104,7 +110,11 @@

const testUrls = getTestUrls(testDef);
const apiUrl = getTestUrl(testDef,
testingServer + '/api/tests/', 'trials/', '');
const webUrl = getTestUrl(testDef,
testingServer + '/app/', 'functional/', 'test/');
const intervalId = setInterval(async () => {
try {
const {body: {trialResult, result}} = await superagent.get(testUrls.api)
const {body: {trialResult, result}} = await superagent.get(apiUrl)
.auth(token, '');

@@ -117,3 +127,3 @@

...testDef,
url: testUrls.web,
url: webUrl,
passed: testDef.type === TYPE_LOAD ?

@@ -177,9 +187,2 @@ result === 'done' : isFunctionalPassed(trialResult),

function getTestUrls(testDef: Loadmill.TestDef) {
return {
api: getTestUrl(testDef, 'https://www.loadmill.com/api/tests/', 'trials/', ''),
web: getTestUrl(testDef, 'https://www.loadmill.com/app/', 'functional/', 'test/'),
};
}
function getTestUrl({id, type}: Loadmill.TestDef, prefix: string, funcSuffix: string, loadSuffix: string) {

@@ -186,0 +189,0 @@ const suffix = type === TYPE_FUNCTIONAL ? funcSuffix : loadSuffix;

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