Comparing version 2.2.0 to 2.2.1
@@ -9,2 +9,3 @@ "use strict"; | ||
var loadmill_runner_1 = require("loadmill-runner"); | ||
var pLimit = require('p-limit'); | ||
function Loadmill(options) { | ||
@@ -204,3 +205,3 @@ var _a = options, token = _a.token, _b = _a._testingServerHost, _testingServerHost = _b === void 0 ? utils_1.TESTING_HOST : _b; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var suites, logger, results, _i, suites_1, suite; | ||
var suites, logger, results, limit_1, suitesPromises, _i, suites_1, suite; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -221,8 +222,10 @@ switch (_a.label) { | ||
logger.verbose("Executing all suites in parallel"); | ||
return [4 /*yield*/, Promise.all(suites.map(function (suite) { | ||
logger.verbose("Executing suite " + suite.description + " with id " + suite.id); | ||
return _runTestSuite(tslib_1.__assign({}, suite, { options: options }), params) | ||
.then(_wait) | ||
.then(function (res) { results.push(res); }); | ||
}))]; | ||
limit_1 = pLimit(10); | ||
suitesPromises = suites.map(function (suite) { return limit_1(function () { | ||
logger.verbose("Executing suite " + suite.description + " with id " + suite.id); | ||
return _runTestSuite(tslib_1.__assign({}, suite, { options: options }), params) | ||
.then(_wait) | ||
.then(function (res) { results.push(res); }); | ||
}); }); | ||
return [4 /*yield*/, Promise.all(suitesPromises)]; | ||
case 2: | ||
@@ -229,0 +232,0 @@ _a.sent(); |
@@ -9,2 +9,3 @@ "use strict"; | ||
var superagent = require("superagent"); | ||
var pLimit = require('p-limit'); | ||
var flatMap = require("lodash/flatMap"); | ||
@@ -252,3 +253,3 @@ var isEmpty = require("lodash/isEmpty"); | ||
text += "\n+ \"Expected: " + check + " " + operation + " " + (value != null ? value : '') + " "; | ||
text += "\n- \" Actual: " + (actual !== 'null' ? actual : 'null') + " "; | ||
text += "\n- \"Actual: " + (actual !== 'null' ? actual : 'null') + " "; | ||
} | ||
@@ -296,3 +297,3 @@ return text; | ||
var suiteToMochawesone = function (suite, token) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var flows, passedFlows, failedFlows, _a, _b; | ||
var flows, passedFlows, failedFlows, flowsLength, limit, _a, _b; | ||
return tslib_1.__generator(this, function (_c) { | ||
@@ -304,2 +305,4 @@ switch (_c.label) { | ||
failedFlows = flows.filter(function (f) { return f.status === 'FAILED'; }).map(function (f) { return f.id; }); | ||
flowsLength = flows.length; | ||
limit = pLimit(Math.max(3, Math.min(3, flowsLength / 5))); | ||
_a = { | ||
@@ -309,3 +312,3 @@ "title": suite.description | ||
_b = "tests"; | ||
return [4 /*yield*/, Promise.all(flows.map(function (f) { return flowToMochawesone(suite, f, token); }))]; | ||
return [4 /*yield*/, Promise.all(flows.map(function (f) { return limit(function () { return flowToMochawesone(suite, f, token); }); }))]; | ||
case 1: return [2 /*return*/, (_a[_b] = _c.sent(), | ||
@@ -330,3 +333,3 @@ _a["duration"] = (+suite.endTime - +suite.startTime), | ||
var generateMochawesomeReport = function (suiteOrSuites, token) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var passedSuites, failedSuites, duration, res, _a, _b, _c, _d; | ||
var passedSuites, failedSuites, duration, suitesLength, limit, res, _a, _b, _c, _d; | ||
return tslib_1.__generator(this, function (_e) { | ||
@@ -341,6 +344,8 @@ switch (_e.label) { | ||
duration = suiteOrSuites.reduce(function (acc, s) { return acc + (+s.endTime - +s.startTime); }, 0); | ||
suitesLength = suiteOrSuites.length; | ||
limit = pLimit(Math.max(3, Math.min(3, suitesLength / 5))); | ||
_a = { | ||
"stats": { | ||
"suites": suiteOrSuites.length, | ||
"tests": suiteOrSuites.length, | ||
"suites": suitesLength, | ||
"tests": suitesLength, | ||
"passes": passedSuites, | ||
@@ -351,5 +356,5 @@ "failures": failedSuites, | ||
"pending": 0, | ||
"testsRegistered": suiteOrSuites.length, | ||
"testsRegistered": suitesLength, | ||
"pendingPercent": 0, | ||
"passPercent": passedSuites / suiteOrSuites.length, | ||
"passPercent": passedSuites / suitesLength, | ||
"other": 0, | ||
@@ -367,3 +372,3 @@ "hasOther": false, | ||
_d = "suites"; | ||
return [4 /*yield*/, Promise.all(suiteOrSuites.map(function (s) { return suiteToMochawesone(s, token); }))]; | ||
return [4 /*yield*/, Promise.all(suiteOrSuites.map(function (s) { return limit(function () { return suiteToMochawesone(s, token); }); }))]; | ||
case 1: | ||
@@ -370,0 +375,0 @@ res = (_a[_b] = [ |
{ | ||
"name": "loadmill", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "A node.js module for running load tests and functional tests on loadmill.com", | ||
@@ -44,2 +44,3 @@ "keywords": [ | ||
"moment": "^2.17.0", | ||
"p-limit": "^3.1.0", | ||
"quickselect": "^2.0.0", | ||
@@ -46,0 +47,0 @@ "randomstring": "^1.1.5", |
@@ -244,3 +244,3 @@ # Loadmill | ||
- `-a, --launch-all-test-suites` Launch all team's test suites containing at least one flow marked for execution with CI toggle and wait for execution to end (executing one by one). | ||
- `-p, --parallel` Launch in parallel all team's test suites containing at least one flow marked for execution with CI toggle and wait for execution to end. Same as `-a` but in parallel. | ||
- `-p, --parallel` Launch in parallel all team's test suites containing at least one flow marked for execution with CI toggle and wait for execution to end. Same as `-a` but in parallel. Max concurrency is 10. | ||
- `--additional-description <description>` Add an additional description at the end of the current suite's description - available only for test suites. | ||
@@ -247,0 +247,0 @@ - `--labels <labels>`, Run flows that are assigned to a specific label. Multiple labels can be provided by seperated them with "," (e.g. 'label1,label2'). |
@@ -10,2 +10,3 @@ import './polyfills' | ||
import { runFunctionalOnLocalhost } from 'loadmill-runner'; | ||
const pLimit = require('p-limit'); | ||
@@ -213,8 +214,10 @@ export = Loadmill; | ||
logger.verbose(`Executing all suites in parallel`); | ||
await Promise.all<void>(suites.map(suite => { | ||
const limit = pLimit(10); // max concurrency we allow | ||
const suitesPromises = suites.map(suite => limit(() => { | ||
logger.verbose(`Executing suite ${suite.description} with id ${suite.id}`); | ||
return _runTestSuite({ ...suite, options }, params) | ||
.then(_wait) | ||
.then((res) => { results.push(res); }) | ||
.then((res) => { results.push(res); }); | ||
})); | ||
await Promise.all<void>(suitesPromises); | ||
} else { | ||
@@ -221,0 +224,0 @@ |
@@ -6,2 +6,3 @@ import * as fs from "fs"; | ||
import * as superagent from 'superagent'; | ||
const pLimit = require('p-limit'); | ||
@@ -273,3 +274,3 @@ import flatMap = require('lodash/flatMap'); | ||
text += `\n+ \"Expected: ${check} ${operation} ${value != null ? value : ''} `; | ||
text += `\n- \" Actual: ${actual !== 'null' ? actual : 'null'} `; | ||
text += `\n- \"Actual: ${actual !== 'null' ? actual : 'null'} `; | ||
} | ||
@@ -320,5 +321,8 @@ return text; | ||
const flowsLength = flows.length; | ||
const limit = pLimit(Math.max(3, Math.min(3, flowsLength / 5))); | ||
return { | ||
"title": suite.description, | ||
"tests": await Promise.all(flows.map(f => flowToMochawesone(suite, f, token))), | ||
"tests": await Promise.all(flows.map(f => limit(() => flowToMochawesone(suite, f, token)))), | ||
"duration": (+suite.endTime - +suite.startTime), | ||
@@ -348,6 +352,9 @@ "suites": [], | ||
const suitesLength = suiteOrSuites.length; | ||
const limit = pLimit(Math.max(3, Math.min(3, suitesLength / 5))); | ||
const res = { | ||
"stats": { | ||
"suites": suiteOrSuites.length, | ||
"tests": suiteOrSuites.length, | ||
"suites": suitesLength, | ||
"tests": suitesLength, | ||
"passes": passedSuites, | ||
@@ -358,5 +365,5 @@ "failures": failedSuites, | ||
"pending": 0, | ||
"testsRegistered": suiteOrSuites.length, | ||
"testsRegistered": suitesLength, | ||
"pendingPercent": 0, | ||
"passPercent": passedSuites / suiteOrSuites.length, | ||
"passPercent": passedSuites / suitesLength, | ||
"other": 0, | ||
@@ -371,3 +378,3 @@ "hasOther": false, | ||
"title": "Loadmill API tests", | ||
"suites": await Promise.all(suiteOrSuites.map(s => suiteToMochawesone(s, token))), | ||
"suites": await Promise.all(suiteOrSuites.map(s => limit(() => suiteToMochawesone(s, token)))), | ||
"tests": [], | ||
@@ -374,0 +381,0 @@ "pending": [], |
142511
2701
19
+ Addedp-limit@^3.1.0
+ Addedp-limit@3.1.0(transitive)
+ Addedyocto-queue@0.1.0(transitive)