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

k6-html-reporter

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

k6-html-reporter - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

dist/util.d.ts

2

dist/reporter.d.ts

@@ -1,2 +0,2 @@

import { Options } from './types';
import { Options } from "./types";
export declare function generate(options: Options): void;

@@ -11,2 +11,3 @@ "use strict";

const types_1 = require("./types");
const util_1 = require("./util");
function generate(options) {

@@ -26,15 +27,25 @@ const resolvedInputPath = path_1.default.resolve(process.cwd(), options.jsonFile);

const time = new Date().toLocaleString();
const templatePath = path_1.default.resolve(__dirname, '../templates/template.ejs');
const templatePath = path_1.default.resolve(__dirname, "../templates/template.ejs");
const checkRootGroupData = content["root_group"];
const metricsData = content["metrics"];
const { checkMetric, counterMetrics, trendMetrics, gaugeMetrics, rateMetrics, allThresholds, totalThresholdResult } = mapMetrics(metricsData);
const { checkMetric, counterMetrics, trendMetrics, gaugeMetrics, rateMetrics, allThresholds, totalThresholdResult, } = mapMetrics(metricsData);
const checks = getChecks(checkRootGroupData).map((data) => {
const splitedPath = data.path.split('::');
const splitedPath = data.path.split("::");
splitedPath.shift();
return {
...data,
pathArray: splitedPath.join(" \u21C0 ")
pathArray: splitedPath.join(" \u21C0 "),
};
});
ejs_1.default.renderFile(templatePath, { checks, rateMetrics, checkMetric, counterMetrics, trendMetrics, gaugeMetrics, allThresholds, totalThresholdResult, time }, {}, function (err, str) {
ejs_1.default.renderFile(templatePath, {
checks,
rateMetrics: rateMetrics.sort(util_1.compareNameAscending),
checkMetric,
counterMetrics: counterMetrics.sort(util_1.compareNameAscending),
trendMetrics: trendMetrics.sort(util_1.compareNameAscending),
gaugeMetrics: gaugeMetrics.sort(util_1.compareNameAscending),
allThresholds,
totalThresholdResult,
time,
}, {}, function (err, str) {
if (err) {

@@ -44,2 +55,5 @@ console.error(err);

let html = ejs_1.default.render(str);
if (!fs_1.default.existsSync(filePath)) {
fs_1.default.mkdirSync(filePath, { recursive: true });
}
fs_1.default.writeFileSync(`${filePath}/report.html`, html);

@@ -59,3 +73,3 @@ console.log(`Report is created at ${filePath}`);

fails: 0,
failedMetricsNum: 0
failedMetricsNum: 0,
};

@@ -67,3 +81,3 @@ Object.entries(data).forEach(([key, value]) => {

...totalThresholdResult,
...updatedThresholdResult
...updatedThresholdResult,
};

@@ -79,3 +93,3 @@ if (displayThreshold) {

...totalThresholdResult,
...updatedThresholdResult
...updatedThresholdResult,
};

@@ -87,7 +101,7 @@ if (displayThreshold) {

}
else if (key === 'checks') {
else if (key === "checks") {
const { updatedThresholdResult, displayThreshold, metric } = handleMetricValues(key, value, totalThresholdResult);
totalThresholdResult = {
...totalThresholdResult,
...updatedThresholdResult
...updatedThresholdResult,
};

@@ -103,3 +117,3 @@ if (displayThreshold) {

...totalThresholdResult,
...updatedThresholdResult
...updatedThresholdResult,
};

@@ -111,7 +125,7 @@ if (displayThreshold) {

}
else if (value.type === types_1.MetricsType.RATE && key !== 'checks') {
else if (value.type === types_1.MetricsType.RATE && key !== "checks") {
const { updatedThresholdResult, displayThreshold, metric } = handleMetricValues(key, value, totalThresholdResult);
totalThresholdResult = {
...totalThresholdResult,
...updatedThresholdResult
...updatedThresholdResult,
};

@@ -124,3 +138,11 @@ if (displayThreshold) {

});
return { checkMetric, counterMetrics, trendMetrics, gaugeMetrics, rateMetrics, allThresholds, totalThresholdResult };
return {
checkMetric,
counterMetrics,
trendMetrics,
gaugeMetrics,
rateMetrics,
allThresholds,
totalThresholdResult,
};
}

@@ -131,3 +153,3 @@ function handleMetricValues(key, value, currentTotalThresholdResult) {

...value,
thresholdFailed: undefined
thresholdFailed: undefined,
};

@@ -137,3 +159,3 @@ const updatedThresholdResult = { ...currentTotalThresholdResult };

const [passes, fails] = thresholdResult(value.thresholds);
if (fails > 0 && key !== 'checks') {
if (fails > 0 && key !== "checks") {
updatedThresholdResult.failedMetricsNum++;

@@ -147,4 +169,6 @@ }

name: key,
thresholds: value.thresholds
}, updatedThresholdResult, metric
thresholds: value.thresholds,
},
updatedThresholdResult,
metric,
};

@@ -157,3 +181,3 @@ }

const thresholdArr = Object.values(thresholds);
const passes = thresholdArr.filter(value => value.ok === true).length;
const passes = thresholdArr.filter((value) => value.ok === true).length;
const fails = thresholdArr.length - passes;

@@ -160,0 +184,0 @@ return [passes, fails];

{
"name": "k6-html-reporter",
"version": "1.0.3",
"version": "1.0.4",
"description": "A html reporter for k6",

@@ -20,3 +20,3 @@ "main": "dist/index.js",

"build": "rm -rf dist && tsc",
"dev": "tsc && cd dev && node index.js",
"dev": "rm -rf dist && tsc && cd dev && node index.js",
"start": "ts-node src/index.ts",

@@ -23,0 +23,0 @@ "test": "jest"

Sorry, the diff of this file is not supported yet

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