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

loadmill

Package Overview
Dependencies
Maintainers
3
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 4.1.4 to 4.2.0

10

lib/index.js

@@ -45,3 +45,3 @@ "use strict";

testResult = toTestResult(testDef, webUrl, body);
redactData(testResult, body, testingServer);
redactData(testResult, body);
if (callback) {

@@ -202,4 +202,4 @@ callback(null, testResult);

}
function redactData(testResult, body, testingServer) {
testResult.testSuitesRuns = reductTestSuitesRuns(body.testSuitesRuns, testingServer);
function redactData(testResult, body) {
testResult.testSuitesRuns = reductTestSuitesRuns(body.testSuitesRuns);
}

@@ -241,3 +241,3 @@ function isTestInFinalState(body, runType) {

}
function reductTestSuitesRuns(suitesRuns, testingServer) {
function reductTestSuitesRuns(suitesRuns) {
if (suitesRuns) {

@@ -250,3 +250,3 @@ return suitesRuns.map(function (s) {

status: s.status,
url: getTestWebUrl({ id: s.id, type: Loadmill.TYPES.SUITE }, testingServer),
url: s.url,
passed: s.status === "PASSED",

@@ -253,0 +253,0 @@ startTime: s.startTime,

@@ -26,3 +26,4 @@ "use strict";

.option("-v, --verbose", "Print out extra information for debugging.")
.option("-r, --report", "Print out Test Suite Flow Runs report when the suite has ended.")
.option("-r, --report", "Print out Test Suite Flow Runs report when the plan has ended.")
.option("--errors-report", "Print out Test Suite Flow Runs errors report when the plan has ended.")
.option("-j, --junit-report", "Create Test Suite (junit style) report when the suite has ended.")

@@ -45,7 +46,7 @@ .option("--junit-report-path <junitReportPath>", "Save junit styled report to a path (defaults to current location).")

return tslib_1.__awaiter(this, void 0, void 0, function () {
var wait, bail, quiet, token, verbose, colors, report, junitReport, junitReportPath, mochawesomeReport, mochawesomeReportPath, parallel, loadTest, testPlan, additionalDescription, labels, labelsExpression, pool, tags, branch, retryFailedFlows, parametersFile, inlineParameterOverride, apiCatalogService, _a, input, rawParams, logger, parameters, loadmill, testFailed, testStopped, res, planLabels, planTags, running, e_1, extInfo, configFile, res_1, id;
var wait, bail, quiet, token, verbose, colors, report, errorsReport, junitReport, junitReportPath, mochawesomeReport, mochawesomeReportPath, parallel, loadTest, testPlan, additionalDescription, labels, labelsExpression, pool, tags, branch, retryFailedFlows, parametersFile, inlineParameterOverride, apiCatalogService, _a, input, rawParams, logger, parameters, loadmill, testFailed, testStopped, res, planLabels, planTags, running, e_1, extInfo, configFile, res_1, id;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
wait = program.wait, bail = program.bail, quiet = program.quiet, token = program.token, verbose = program.verbose, colors = program.colors, report = program.report, junitReport = program.junitReport, junitReportPath = program.junitReportPath, mochawesomeReport = program.mochawesomeReport, mochawesomeReportPath = program.mochawesomeReportPath, parallel = program.parallel, loadTest = program.loadTest, testPlan = program.testPlan, additionalDescription = program.additionalDescription, labels = program.labels, labelsExpression = program.labelsExpression, pool = program.pool, tags = program.tags, branch = program.branch, retryFailedFlows = program.retryFailedFlows, parametersFile = program.parametersFile, inlineParameterOverride = program.inlineParameterOverride, apiCatalogService = program.apiCatalogService, _a = program.args, input = _a[0], rawParams = _a.slice(1);
wait = program.wait, bail = program.bail, quiet = program.quiet, token = program.token, verbose = program.verbose, colors = program.colors, report = program.report, errorsReport = program.errorsReport, junitReport = program.junitReport, junitReportPath = program.junitReportPath, mochawesomeReport = program.mochawesomeReport, mochawesomeReportPath = program.mochawesomeReportPath, parallel = program.parallel, loadTest = program.loadTest, testPlan = program.testPlan, additionalDescription = program.additionalDescription, labels = program.labels, labelsExpression = program.labelsExpression, pool = program.pool, tags = program.tags, branch = program.branch, retryFailedFlows = program.retryFailedFlows, parametersFile = program.parametersFile, inlineParameterOverride = program.inlineParameterOverride, apiCatalogService = program.apiCatalogService, _a = program.args, input = _a[0], rawParams = _a.slice(1);
logger = utils_1.getLogger({ verbose: verbose, colors: colors });

@@ -67,2 +68,3 @@ if (!token) {

report: report,
errorsReport: errorsReport,
junitReport: junitReport,

@@ -142,2 +144,5 @@ junitReportPath: junitReportPath,

}
if (errorsReport && res.testSuitesRuns) {
utils_1.printOnlyFailedFlowRunsReport(res.testSuitesRuns, logger, colors);
}
if (!res) return [3 /*break*/, 7];

@@ -144,0 +149,0 @@ if (!junitReport) return [3 /*break*/, 5];

"use strict";
exports.__esModule = true;
exports.TESTING_HOST = exports.getLogger = exports.Logger = exports.sleep = exports.readRawParams = exports.toLoadmillParams = exports.isUUID = exports.isString = exports.isEmptyObj = exports.filterTags = exports.filterLabels = exports.convertArrToLabelQueryParams = exports.convertStrToArr = exports.printTestSuitesRunsReport = exports.printFlowRunsReport = exports.getObjectAsString = void 0;
exports.TESTING_HOST = exports.getLogger = exports.Logger = exports.sleep = exports.readRawParams = exports.toLoadmillParams = exports.isUUID = exports.isString = exports.isEmptyObj = exports.filterTags = exports.filterLabels = exports.convertArrToLabelQueryParams = exports.convertStrToArr = exports.printTestSuitesRunsReport = exports.printOnlyFailedFlowRunsReport = exports.getObjectAsString = void 0;
var tslib_1 = require("tslib");

@@ -9,2 +9,21 @@ var fs = require("fs");

var util = require("util");
var CLI_COLORS = {
RED: '\x1b[31m',
GREEN: '\x1b[32m',
YELLOW: '\x1b[33m',
GREY: '\x1b[90m',
DEFAULT: '\x1b[0m'
};
var STATUSES = {
PASSED: "PASSED",
FAILED: "FAILED",
STOPPED: "STOPPED",
FLAKY: "FLAKY"
};
var HALF_TAB = " ";
function failedFlowLine(f, colors) {
return "" + HALF_TAB + HALF_TAB + "Flow " + f.description + " - " + coloredFlowLine(f.status, colors);
}
var FAILED_STATUS_LINE = "status: '" + CLI_COLORS.RED + "FAILED" + CLI_COLORS.DEFAULT + "'";
var PASSED_STATUS_LINE = "status: '" + CLI_COLORS.GREEN + "PASSED" + CLI_COLORS.DEFAULT + "'";
var getObjectAsString = function (obj, colors) {

@@ -15,3 +34,9 @@ // trim response body to length of 255

}
return util.inspect(obj, { showHidden: false, depth: null, colors: colors, compact: false });
var str = util.inspect(obj, { showHidden: false, depth: null, compact: false });
if (colors) {
str = str
.replace(/status:\s*'FAILED'/g, FAILED_STATUS_LINE)
.replace(/status:\s*'PASSED'/g, PASSED_STATUS_LINE);
}
return str;
};

@@ -25,14 +50,38 @@ exports.getObjectAsString = getObjectAsString;

};
var printFlowRunsReport = function (suiteDescription, suiteFlowRuns, logger, colors) {
if (suiteFlowRuns) {
logger.log("");
logger.log("Test Suite [" + suiteDescription + "] Flow Runs report:");
suiteFlowRuns.map(function (f) { return logger.log("Flow " + f.description + " - " + coloredFlowLine(f.status, colors)); });
var printOnlyFailedFlowRunsReport = function (testSuitesRuns, logger, colors) {
if (Array.isArray(testSuitesRuns) && testSuitesRuns.length > 0) {
var total_1 = 0;
var totalFailed_1 = 0;
var lines_1 = [];
testSuitesRuns.forEach(function (suiteRun) {
var flowRuns = suiteRun.flowRuns;
if (flowRuns && Array.isArray(flowRuns)) {
total_1 += flowRuns.length;
var suiteLines_1 = [];
flowRuns.forEach(function (f) {
if (f.status === STATUSES.FAILED) {
suiteLines_1.push(failedFlowLine(f, colors));
}
});
if (suiteLines_1.length > 0) {
lines_1.push("");
lines_1.push(HALF_TAB + "Test Suite " + suiteRun.description + " has failed flow:");
lines_1 = lines_1.concat(suiteLines_1);
lines_1.push(HALF_TAB + "More info can be found at " + suiteRun.url);
totalFailed_1 += suiteLines_1.length;
}
}
});
if (lines_1.length > 0) {
logger.log("");
logger.log("Test Plan errors report - " + CLI_COLORS.RED + totalFailed_1 + " flows have failed " + CLI_COLORS.DEFAULT + " (out of " + total_1 + " total).");
lines_1.forEach(function (l) { return logger.log(l); });
}
}
};
exports.printFlowRunsReport = printFlowRunsReport;
exports.printOnlyFailedFlowRunsReport = printOnlyFailedFlowRunsReport;
var printTestSuitesRunsReport = function (testPlanDescription, testSuitesRuns, logger, colors) {
if (testSuitesRuns) {
if (Array.isArray(testSuitesRuns) && testSuitesRuns.length > 0) {
logger.log("");
logger.log("Test Plan [" + testPlanDescription + "] Test Suites Runs report:");
logger.log("Test Plan [" + testPlanDescription + "] Suites Runs report:");
testSuitesRuns.map(function (ts) { return logger.log("Test Suite " + ts.description + " - " + coloredFlowLine(ts.status, colors)); });

@@ -163,9 +212,9 @@ }

switch (status) {
case "PASSED":
case STATUSES.PASSED:
return CLI_COLORS.GREEN;
case "FAILED":
case STATUSES.FAILED:
return CLI_COLORS.RED;
case "STOPPED":
case STATUSES.STOPPED:
return CLI_COLORS.GREY;
case "FLAKY":
case STATUSES.FLAKY:
return CLI_COLORS.YELLOW;

@@ -176,9 +225,2 @@ default:

};
var CLI_COLORS = {
RED: '\x1b[31m',
GREEN: '\x1b[32m',
YELLOW: '\x1b[33m',
GREY: '\x1b[90m',
DEFAULT: '\x1b[0m'
};
exports.TESTING_HOST = process.env.LOADMILL_SERVER_HOST || "app.loadmill.com";
{
"name": "loadmill",
"version": "4.1.4",
"version": "4.2.0",
"description": "A node.js module for running load tests and functional tests on loadmill.com",

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

@@ -176,3 +176,4 @@ # Loadmill

- `-v, --verbose` Print out extra information for debugging (trumps `-q`). In case of an error will print the entire test's requests otherwise will print only the failed request.
- `-r, --report` Print out Test Suite Flow Runs report when the suite has ended.
- `-r, --report` Print out Test Suite Flow Runs report when the plan has ended.
- `--errors-report` Print out Test Suite Flow Runs errors report when the plan has ended.
- `-j, --junit-report` Create Test Suite (junit style) report when the suite has ended.

@@ -179,0 +180,0 @@ - `--junit-report-path <path>` Save junit styled report to a path (defaults to current location) when `-j` flag is on.

@@ -54,3 +54,3 @@ import './polyfills'

redactData(testResult, body, testingServer);
redactData(testResult, body);

@@ -209,4 +209,4 @@ if (callback) {

function redactData(testResult: Loadmill.TestResult, body: any, testingServer: string) {
testResult.testSuitesRuns = reductTestSuitesRuns(body.testSuitesRuns, testingServer);
function redactData(testResult: Loadmill.TestResult, body: any) {
testResult.testSuitesRuns = reductTestSuitesRuns(body.testSuitesRuns);
}

@@ -251,3 +251,3 @@

function reductTestSuitesRuns(suitesRuns, testingServer) {
function reductTestSuitesRuns(suitesRuns) {
if (suitesRuns) {

@@ -261,3 +261,3 @@ return suitesRuns.map(s => {

status: s.status,
url: getTestWebUrl({ id: s.id, type: Loadmill.TYPES.SUITE }, testingServer),
url: s.url,
passed: s.status === "PASSED",

@@ -264,0 +264,0 @@ startTime: s.startTime,

@@ -11,2 +11,3 @@ import * as Loadmill from './index';

readRawParams,
printOnlyFailedFlowRunsReport,
} from './utils';

@@ -35,3 +36,4 @@ import { junitReport as createJunitReport, mochawesomeReport as createMochawesomeReport } from './reporter';

.option("-v, --verbose", "Print out extra information for debugging.")
.option("-r, --report", "Print out Test Suite Flow Runs report when the suite has ended.")
.option("-r, --report", "Print out Test Suite Flow Runs report when the plan has ended.")
.option("--errors-report", "Print out Test Suite Flow Runs errors report when the plan has ended.")
.option("-j, --junit-report", "Create Test Suite (junit style) report when the suite has ended.")

@@ -65,2 +67,3 @@ .option("--junit-report-path <junitReportPath>", "Save junit styled report to a path (defaults to current location).")

report,
errorsReport,
junitReport,

@@ -106,2 +109,3 @@ junitReportPath,

report,
errorsReport,
junitReport,

@@ -157,3 +161,3 @@ junitReportPath,

const planTags = convertStrToArr(tags);
try {

@@ -193,2 +197,6 @@ logger.verbose(`Executing test plan with id ${input}`);

if (errorsReport && res.testSuitesRuns) {
printOnlyFailedFlowRunsReport(res.testSuitesRuns, logger, colors);
}
if (res) {

@@ -195,0 +203,0 @@ if (junitReport) {

@@ -6,2 +6,25 @@ import * as fs from "fs";

const CLI_COLORS = {
RED: '\x1b[31m',
GREEN: '\x1b[32m',
YELLOW: '\x1b[33m',
GREY: '\x1b[90m',
DEFAULT: '\x1b[0m'
}
const STATUSES = {
PASSED: "PASSED",
FAILED: "FAILED",
STOPPED: "STOPPED",
FLAKY: "FLAKY",
};
const HALF_TAB = " ";
function failedFlowLine(f: any, colors: any): string {
return `${HALF_TAB}${HALF_TAB}Flow ${f.description} - ${coloredFlowLine(f.status, colors)}`;
}
const FAILED_STATUS_LINE = `status: '${CLI_COLORS.RED}FAILED${CLI_COLORS.DEFAULT}'`;
const PASSED_STATUS_LINE = `status: '${CLI_COLORS.GREEN}PASSED${CLI_COLORS.DEFAULT}'`;
export const getObjectAsString = (obj, colors) => {

@@ -12,3 +35,10 @@ // trim response body to length of 255

}
return util.inspect(obj, { showHidden: false, depth: null, colors: colors, compact: false } as any);
let str = util.inspect(obj, { showHidden: false, depth: null, compact: false } as any);
if (colors) {
str = str
.replace(/status:\s*'FAILED'/g, FAILED_STATUS_LINE)
.replace(/status:\s*'PASSED'/g, PASSED_STATUS_LINE);
}
return str;
}

@@ -23,15 +53,38 @@

export const printFlowRunsReport = (suiteDescription, suiteFlowRuns, logger, colors) => {
if (suiteFlowRuns) {
logger.log("");
logger.log(`Test Suite [${suiteDescription}] Flow Runs report:`);
suiteFlowRuns.map(
f => logger.log(`Flow ${f.description} - ${coloredFlowLine(f.status, colors)}`));
}
export const printOnlyFailedFlowRunsReport = (testSuitesRuns, logger, colors) => {
if (Array.isArray(testSuitesRuns) && testSuitesRuns.length > 0) {
let total = 0;
let totalFailed = 0;
let lines: Array<string> =[]
testSuitesRuns.forEach(suiteRun => {
const { flowRuns } = suiteRun;
if (flowRuns && Array.isArray(flowRuns)) {
total += flowRuns.length;
const suiteLines: Array<string> =[]
flowRuns.forEach((f) => {
if (f.status === STATUSES.FAILED) {
suiteLines.push(failedFlowLine(f, colors))
}
});
if (suiteLines.length > 0) {
lines.push("");
lines.push(`${HALF_TAB}Test Suite ${suiteRun.description} has failed flow:`);
lines = lines.concat(suiteLines);
lines.push(`${HALF_TAB}More info can be found at ${suiteRun.url}`);
totalFailed += suiteLines.length;
}
}
});
if (lines.length >0) {
logger.log("");
logger.log(`Test Plan errors report - ${CLI_COLORS.RED}${totalFailed} flows have failed ${CLI_COLORS.DEFAULT} (out of ${total} total).`)
lines.forEach(l=> logger.log(l));
}
}
}
export const printTestSuitesRunsReport = (testPlanDescription, testSuitesRuns, logger, colors) => {
if (testSuitesRuns) {
if (Array.isArray(testSuitesRuns) && testSuitesRuns.length > 0) {
logger.log("");
logger.log(`Test Plan [${testPlanDescription}] Test Suites Runs report:`);
logger.log(`Test Plan [${testPlanDescription}] Suites Runs report:`);
testSuitesRuns.map(

@@ -143,9 +196,9 @@ ts => logger.log(`Test Suite ${ts.description} - ${coloredFlowLine(ts.status, colors)}`));

switch (status) {
case "PASSED":
case STATUSES.PASSED:
return CLI_COLORS.GREEN;
case "FAILED":
case STATUSES.FAILED:
return CLI_COLORS.RED;
case "STOPPED":
case STATUSES.STOPPED:
return CLI_COLORS.GREY;
case "FLAKY":
case STATUSES.FLAKY:
return CLI_COLORS.YELLOW;

@@ -157,10 +210,2 @@ default:

const CLI_COLORS = {
RED: '\x1b[31m',
GREEN: '\x1b[32m',
YELLOW: '\x1b[33m',
GREY: '\x1b[90m',
DEFAULT: '\x1b[0m'
}
export const TESTING_HOST = process.env.LOADMILL_SERVER_HOST || "app.loadmill.com";
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