Comparing version 3.0.0 to 3.0.1
import './polyfills'; | ||
export = Loadmill; | ||
declare function Loadmill(options: Loadmill.LoadmillOptions): { | ||
run(config: any, paramsOrCallback?: Loadmill.ParamsOrCallback, callback?: Loadmill.Callback): Promise<string>; | ||
runFolder(folderPath: string, paramsOrCallback?: Loadmill.ParamsOrCallback, callback?: Loadmill.Callback): Promise<Loadmill.TestResult[]>; | ||
run(config: Loadmill.Configuration, paramsOrCallback?: Loadmill.ParamsOrCallback, callback?: Loadmill.Callback): Promise<string>; | ||
runFolder(folderPath: string, paramsOrCallback?: Loadmill.ParamsOrCallback, callback?: Loadmill.Callback): Promise<Array<Loadmill.TestResult>>; | ||
wait(testDefOrId: string | Loadmill.TestDef, callback?: Loadmill.Callback): Promise<Loadmill.TestResult>; | ||
runTestSuite(suite: Loadmill.TestSuiteDef, paramsOrCallback?: Loadmill.ParamsOrCallback, callback?: Loadmill.Callback): Promise<Loadmill.TestDef>; | ||
runTestPlan(testPlan: Loadmill.TestPlanDef, params: Loadmill.Params): Promise<Loadmill.TestDef | undefined>; | ||
junitReport(testResult: Loadmill.TestResult | Loadmill.TestResult[], path?: string | undefined): Promise<void>; | ||
mochawesomeReport(testResult: Loadmill.TestResult | Loadmill.TestResult[], path?: string | undefined): Promise<void>; | ||
junitReport(testResult: Loadmill.TestResult | Array<Loadmill.TestResult>, path?: string | undefined): Promise<void>; | ||
mochawesomeReport(testResult: Loadmill.TestResult | Array<Loadmill.TestResult>, path?: string | undefined): Promise<void>; | ||
}; | ||
@@ -12,0 +12,0 @@ declare namespace Loadmill { |
@@ -29,3 +29,3 @@ "use strict"; | ||
file = listOfFiles_1[_a]; | ||
return [4 /*yield*/, execFunc.apply(void 0, [file].concat(funcArgs))]; | ||
return [4 /*yield*/, execFunc.apply(void 0, tslib_1.__spreadArray([file], funcArgs))]; | ||
case 2: | ||
@@ -78,3 +78,3 @@ res = _b.sent(); | ||
case 3: | ||
testResult = tslib_1.__assign({}, testDef, { url: webUrl, description: body && body.description, passed: isTestPassed(body, testDef.type), startTime: body.startTime, endTime: body.endTime }); | ||
testResult = tslib_1.__assign(tslib_1.__assign({}, testDef), { url: webUrl, description: body && body.description, passed: isTestPassed(body, testDef.type), startTime: body.startTime, endTime: body.endTime }); | ||
if (testDef.type === Loadmill.TYPES.SUITE) { | ||
@@ -81,0 +81,0 @@ testResult.flowRuns = reductFlowRunsData(body.testSuiteFlowRuns); |
import * as Loadmill from "./index"; | ||
export declare const junitReport: (testResult: Loadmill.TestResult | Loadmill.TestResult[], token: string, path?: string | undefined) => Promise<void>; | ||
export declare const mochawesomeReport: (testResult: Loadmill.TestResult | Loadmill.TestResult[], token: string, path?: string | undefined) => Promise<void>; | ||
export declare const junitReport: (testResult: Loadmill.TestResult | Array<Loadmill.TestResult>, token: string, path?: string | undefined) => Promise<void>; | ||
export declare const mochawesomeReport: (testResult: Loadmill.TestResult | Array<Loadmill.TestResult>, token: string, path?: string | undefined) => Promise<void>; |
"use strict"; | ||
var _this = this; | ||
exports.__esModule = true; | ||
exports.mochawesomeReport = exports.junitReport = void 0; | ||
var tslib_1 = require("tslib"); | ||
@@ -16,10 +16,11 @@ var fs = require("fs"); | ||
var utils_1 = require("./utils"); | ||
var generateJunitJsonReport = function (testResult, token) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var flowResult, suiteResult, suites, limit, jsonResults, _a, _b, _c, _d; | ||
var _this = this; | ||
return tslib_1.__generator(this, function (_e) { | ||
switch (_e.label) { | ||
var generateJunitJsonReport = function (testResult, token) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var flowResult, suiteResult, suites, limit, jsonResults, _a, _b; | ||
var _c; | ||
return tslib_1.__generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
flowResult = function (f) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var _a, flowRun, url, body; | ||
flowResult = function (f) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var flowRun, url, body; | ||
var _a; | ||
return tslib_1.__generator(this, function (_b) { | ||
@@ -47,6 +48,7 @@ switch (_b.label) { | ||
}); }; | ||
suiteResult = function (suite) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var _a, flowRuns, failures, limit, _b, _c, _d, _e; | ||
return tslib_1.__generator(this, function (_f) { | ||
switch (_f.label) { | ||
suiteResult = function (suite) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var _a, flowRuns, failures, limit, _b, _c; | ||
var _d; | ||
return tslib_1.__generator(this, function (_e) { | ||
switch (_e.label) { | ||
case 0: | ||
@@ -56,17 +58,17 @@ _a = suite.flowRuns, flowRuns = _a === void 0 ? [] : _a; | ||
limit = pLimit(3); | ||
_b = {}; | ||
_c = 'testsuite'; | ||
_e = (_d = [{ | ||
_attr: { | ||
name: suite.description, | ||
errors: failures, | ||
failures: failures, | ||
timestamp: (new Date()).toISOString().slice(0, -5), | ||
tests: flowRuns.length, | ||
url: suite.url | ||
} | ||
}]).concat; | ||
_d = {}; | ||
_b = 'testsuite'; | ||
_c = [[{ | ||
_attr: { | ||
name: suite.description, | ||
errors: failures, | ||
failures: failures, | ||
timestamp: (new Date()).toISOString().slice(0, -5), | ||
tests: flowRuns.length, | ||
url: suite.url | ||
} | ||
}]]; | ||
return [4 /*yield*/, Promise.all(flowRuns.map(function (f) { return limit(function () { return flowResult(f); }); }))]; | ||
case 1: return [2 /*return*/, (_b[_c] = _e.apply(_d, [_f.sent()]), | ||
_b)]; | ||
case 1: return [2 /*return*/, (_d[_b] = tslib_1.__spreadArray.apply(void 0, _c.concat([_e.sent()])), | ||
_d)]; | ||
} | ||
@@ -87,13 +89,13 @@ }); | ||
limit = pLimit(3); | ||
_a = {}; | ||
_b = 'testsuites'; | ||
_d = (_c = [{ | ||
_attr: { | ||
name: 'Loadmill suites run' | ||
} | ||
}]).concat; | ||
_c = {}; | ||
_a = 'testsuites'; | ||
_b = [[{ | ||
_attr: { | ||
name: 'Loadmill suites run' | ||
} | ||
}]]; | ||
return [4 /*yield*/, Promise.all(suites.map(function (s) { return limit(function () { return suiteResult(s); }); }))]; | ||
case 1: | ||
jsonResults = (_a[_b] = _d.apply(_c, [_e.sent()]), | ||
_a); | ||
jsonResults = (_c[_a] = tslib_1.__spreadArray.apply(void 0, _b.concat([_d.sent()])), | ||
_c); | ||
return [2 /*return*/, jsonResults]; | ||
@@ -279,3 +281,3 @@ } | ||
}; | ||
var flowToMochawesone = function (suite, flow, token) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var flowToMochawesone = function (suite, flow, token) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var url, flowData, hasPassed, res; | ||
@@ -309,4 +311,5 @@ return tslib_1.__generator(this, function (_a) { | ||
}); }; | ||
var suiteToMochawesone = function (suite, token) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var flows, passedFlows, failedFlows, limit, _a, _b; | ||
var suiteToMochawesone = function (suite, token) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var flows, passedFlows, failedFlows, limit, _a; | ||
var _b; | ||
return tslib_1.__generator(this, function (_c) { | ||
@@ -319,27 +322,28 @@ switch (_c.label) { | ||
limit = pLimit(3); | ||
_a = { | ||
_b = { | ||
"title": suite.description | ||
}; | ||
_b = "tests"; | ||
_a = "tests"; | ||
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(), | ||
_a["duration"] = (+suite.endTime - +suite.startTime), | ||
_a["suites"] = [], | ||
_a["uuid"] = suite.id, | ||
_a["passes"] = passedFlows, | ||
_a["failures"] = failedFlows, | ||
_a["root"] = false, | ||
_a["_timeout"] = 0, | ||
_a["file"] = "", | ||
_a["fullFile"] = "", | ||
_a["beforeHooks"] = [], | ||
_a["afterHooks"] = [], | ||
_a["skipped"] = [], | ||
_a["pending"] = [], | ||
_a)]; | ||
case 1: return [2 /*return*/, (_b[_a] = _c.sent(), | ||
_b["duration"] = (+suite.endTime - +suite.startTime), | ||
_b["suites"] = [], | ||
_b["uuid"] = suite.id, | ||
_b["passes"] = passedFlows, | ||
_b["failures"] = failedFlows, | ||
_b["root"] = false, | ||
_b["_timeout"] = 0, | ||
_b["file"] = "", | ||
_b["fullFile"] = "", | ||
_b["beforeHooks"] = [], | ||
_b["afterHooks"] = [], | ||
_b["skipped"] = [], | ||
_b["pending"] = [], | ||
_b)]; | ||
} | ||
}); | ||
}); }; | ||
var generateMochawesomeReport = function (testResult, token) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var suites, passedSuites, failedSuites, duration, suitesLength, limit, res, _a, _b, _c, _d; | ||
var generateMochawesomeReport = function (testResult, token) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var suites, passedSuites, failedSuites, duration, suitesLength, limit, res, _a, _b; | ||
var _c, _d; | ||
return tslib_1.__generator(this, function (_e) { | ||
@@ -354,3 +358,3 @@ switch (_e.label) { | ||
limit = pLimit(3); | ||
_a = { | ||
_c = { | ||
"stats": { | ||
@@ -374,28 +378,28 @@ "suites": suitesLength, | ||
}; | ||
_b = "results"; | ||
_c = { | ||
_a = "results"; | ||
_d = { | ||
"title": "Loadmill API tests" | ||
}; | ||
_d = "suites"; | ||
_b = "suites"; | ||
return [4 /*yield*/, Promise.all(suites.map(function (s) { return limit(function () { return suiteToMochawesone(s, token); }); }))]; | ||
case 1: | ||
res = (_a[_b] = [ | ||
(_c[_d] = _e.sent(), | ||
_c["tests"] = [], | ||
_c["pending"] = [], | ||
_c["root"] = true, | ||
_c["_timeout"] = 0, | ||
_c["uuid"] = suites[0] ? suites[0].id : '123e4567-e89b-12d3-a456-426652340000', | ||
_c["beforeHooks"] = [], | ||
_c["afterHooks"] = [], | ||
_c["fullFile"] = "", | ||
_c["file"] = "", | ||
_c["passes"] = [], | ||
_c["failures"] = [], | ||
_c["skipped"] = [], | ||
_c["duration"] = duration, | ||
_c["rootEmpty"] = true, | ||
_c) | ||
res = (_c[_a] = [ | ||
(_d[_b] = _e.sent(), | ||
_d["tests"] = [], | ||
_d["pending"] = [], | ||
_d["root"] = true, | ||
_d["_timeout"] = 0, | ||
_d["uuid"] = suites[0] ? suites[0].id : '123e4567-e89b-12d3-a456-426652340000', | ||
_d["beforeHooks"] = [], | ||
_d["afterHooks"] = [], | ||
_d["fullFile"] = "", | ||
_d["file"] = "", | ||
_d["passes"] = [], | ||
_d["failures"] = [], | ||
_d["skipped"] = [], | ||
_d["duration"] = duration, | ||
_d["rootEmpty"] = true, | ||
_d) | ||
], | ||
_a); | ||
_c); | ||
return [2 /*return*/, res]; | ||
@@ -405,3 +409,3 @@ } | ||
}); }; | ||
exports.junitReport = function (testResult, token, path) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var junitReport = function (testResult, token, path) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var jsonResults, asXml, resolvedPath; | ||
@@ -425,3 +429,4 @@ return tslib_1.__generator(this, function (_a) { | ||
}); }; | ||
exports.mochawesomeReport = function (testResult, token, path) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
exports.junitReport = junitReport; | ||
var mochawesomeReport = function (testResult, token, path) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var jsonResults, resolvedPath; | ||
@@ -444,1 +449,2 @@ return tslib_1.__generator(this, function (_a) { | ||
}); }; | ||
exports.mochawesomeReport = mochawesomeReport; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.TESTING_HOST = exports.getLogger = exports.Logger = exports.isUUID = exports.isString = exports.isEmptyObj = exports.getJSONFilesInFolderRecursively = exports.filterLabels = exports.convertArrToLabelQueryParams = exports.convertStrToArr = exports.printTestSuitesRunsReport = exports.printFlowRunsReport = exports.getObjectAsString = void 0; | ||
var tslib_1 = require("tslib"); | ||
var fs = require("fs"); | ||
@@ -8,3 +10,3 @@ var path = require("path"); | ||
var util = require("util"); | ||
exports.getObjectAsString = function (obj, colors) { | ||
var getObjectAsString = function (obj, colors) { | ||
// trim response body to length of 255 | ||
@@ -16,2 +18,3 @@ if (obj.response && obj.response.text && obj.response.text.length > 1024) { | ||
}; | ||
exports.getObjectAsString = getObjectAsString; | ||
var coloredFlowLine = function (status, colors) { | ||
@@ -23,3 +26,3 @@ if (!colors) { | ||
}; | ||
exports.printFlowRunsReport = function (suiteDescription, suiteFlowRuns, logger, colors) { | ||
var printFlowRunsReport = function (suiteDescription, suiteFlowRuns, logger, colors) { | ||
if (suiteFlowRuns) { | ||
@@ -31,3 +34,4 @@ logger.log(""); | ||
}; | ||
exports.printTestSuitesRunsReport = function (testPlanDescription, testSuitesRuns, logger, colors) { | ||
exports.printFlowRunsReport = printFlowRunsReport; | ||
var printTestSuitesRunsReport = function (testPlanDescription, testSuitesRuns, logger, colors) { | ||
if (testSuitesRuns) { | ||
@@ -39,9 +43,12 @@ logger.log(""); | ||
}; | ||
exports.convertStrToArr = function (strWithCommas) { | ||
exports.printTestSuitesRunsReport = printTestSuitesRunsReport; | ||
var convertStrToArr = function (strWithCommas) { | ||
return typeof strWithCommas !== "string" ? null : strWithCommas.split(","); | ||
}; | ||
exports.convertArrToLabelQueryParams = function (arr) { | ||
exports.convertStrToArr = convertStrToArr; | ||
var convertArrToLabelQueryParams = function (arr) { | ||
return '&label=' + arr.join('&label='); | ||
}; | ||
exports.filterLabels = function (labels) { | ||
exports.convertArrToLabelQueryParams = convertArrToLabelQueryParams; | ||
var filterLabels = function (labels) { | ||
if (!Array.isArray(labels)) { | ||
@@ -55,3 +62,4 @@ throw new Error("lables need be in array format i.e. ['my label', 'another label']. Got " + labels); | ||
}; | ||
exports.getJSONFilesInFolderRecursively = function (fileOrFolder, filelist) { | ||
exports.filterLabels = filterLabels; | ||
var getJSONFilesInFolderRecursively = function (fileOrFolder, filelist) { | ||
if (filelist === void 0) { filelist = []; } | ||
@@ -70,8 +78,12 @@ var isFile = fs.statSync(fileOrFolder).isFile(); | ||
}; | ||
exports.getJSONFilesInFolderRecursively = getJSONFilesInFolderRecursively; | ||
var endsWith = function (str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; }; | ||
exports.isEmptyObj = function (obj) { return isEmpty(obj); }; | ||
exports.isString = function (obj) { return isAString(obj); }; | ||
exports.isUUID = function (s) { | ||
var isEmptyObj = function (obj) { return isEmpty(obj); }; | ||
exports.isEmptyObj = isEmptyObj; | ||
var isString = function (obj) { return isAString(obj); }; | ||
exports.isString = isString; | ||
var isUUID = function (s) { | ||
return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(s); | ||
}; | ||
exports.isUUID = isUUID; | ||
var Logger = /** @class */ (function () { | ||
@@ -87,3 +99,3 @@ function Logger(verbose, colors) { | ||
} | ||
return console.log.apply(console, [msg].concat(args)); | ||
return console.log.apply(console, tslib_1.__spreadArray([msg], args)); | ||
}; | ||
@@ -111,3 +123,3 @@ this.error = function (err) { | ||
} | ||
return _this.verb ? console.log.apply(console, [msg].concat(args)) : void (0); | ||
return _this.verb ? console.log.apply(console, tslib_1.__spreadArray([msg], args)) : void (0); | ||
}; | ||
@@ -120,3 +132,3 @@ this.verb = verbose; | ||
exports.Logger = Logger; | ||
exports.getLogger = function (testArgs) { | ||
var getLogger = function (testArgs) { | ||
var verbose = testArgs && testArgs.verbose ? testArgs.verbose : false; | ||
@@ -126,2 +138,3 @@ var colors = testArgs && testArgs.colors ? testArgs.colors : false; | ||
}; | ||
exports.getLogger = getLogger; | ||
var getStatusColor = function (status) { | ||
@@ -128,0 +141,0 @@ switch (status) { |
{ | ||
"name": "loadmill", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A node.js module for running load tests and functional tests on loadmill.com", | ||
@@ -36,17 +36,8 @@ "keywords": [ | ||
"cancelable-awaiter": "^1.0.6", | ||
"cheerio": "^0.22.0", | ||
"commander": "^2.15.0", | ||
"country-list": "^2.1.0", | ||
"http-headers-validation": "^0.0.1", | ||
"jsonpath": "^1.0.2", | ||
"lodash": "^4.17.19", | ||
"moment": "^2.17.0", | ||
"lodash": "^4.17.21", | ||
"p-limit": "^3.1.0", | ||
"quickselect": "^2.0.0", | ||
"randomstring": "^1.1.5", | ||
"superagent": "^3.8.2", | ||
"tslib": "^1.3.0", | ||
"urijs": "^1.18.1", | ||
"tslib": "^2.2.0", | ||
"uuid": "^3.0.1", | ||
"validator": "^10.4.0", | ||
"xml": "^1.0.1" | ||
@@ -59,4 +50,4 @@ }, | ||
"mocha": "^7.0.0", | ||
"typescript": "^2.7.2" | ||
"typescript": "^4.3.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127961
9
2476
+ Addedtslib@2.8.1(transitive)
- Removedcheerio@^0.22.0
- Removedcountry-list@^2.1.0
- Removedhttp-headers-validation@^0.0.1
- Removedjsonpath@^1.0.2
- Removedmoment@^2.17.0
- Removedquickselect@^2.0.0
- Removedrandomstring@^1.1.5
- Removedurijs@^1.18.1
- Removedvalidator@^10.4.0
- Removedboolbase@1.0.0(transitive)
- Removedcheerio@0.22.0(transitive)
- Removedcountry-list@2.3.0(transitive)
- Removedcss-select@1.2.0(transitive)
- Removedcss-what@2.1.3(transitive)
- Removeddeep-is@0.1.4(transitive)
- Removeddom-serializer@0.1.1(transitive)
- Removeddomelementtype@1.3.1(transitive)
- Removeddomhandler@2.4.2(transitive)
- Removeddomutils@1.5.1(transitive)
- Removedentities@1.1.2(transitive)
- Removedescodegen@1.14.3(transitive)
- Removedesprima@1.2.24.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedhtmlparser2@3.10.1(transitive)
- Removedhttp-headers-validation@0.0.1(transitive)
- Removedjsonpath@1.1.1(transitive)
- Removedlevn@0.3.0(transitive)
- Removedlodash.assignin@4.2.0(transitive)
- Removedlodash.bind@4.2.1(transitive)
- Removedlodash.defaults@4.2.0(transitive)
- Removedlodash.filter@4.6.0(transitive)
- Removedlodash.flatten@4.4.0(transitive)
- Removedlodash.foreach@4.5.0(transitive)
- Removedlodash.map@4.6.0(transitive)
- Removedlodash.merge@4.6.2(transitive)
- Removedlodash.pick@4.4.0(transitive)
- Removedlodash.reduce@4.6.0(transitive)
- Removedlodash.reject@4.6.0(transitive)
- Removedlodash.some@4.6.0(transitive)
- Removedmoment@2.30.1(transitive)
- Removednth-check@1.0.2(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedquickselect@2.0.0(transitive)
- Removedrandombytes@2.0.3(transitive)
- Removedrandomstring@1.3.0(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedstatic-eval@2.0.2(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedtslib@1.14.1(transitive)
- Removedtype-check@0.3.2(transitive)
- Removedunderscore@1.12.1(transitive)
- Removedurijs@1.19.11(transitive)
- Removedvalidator@10.11.0(transitive)
- Removedword-wrap@1.2.5(transitive)
Updatedlodash@^4.17.21
Updatedtslib@^2.2.0