@vpalmisano/webrtcperf 4.1.11 → 4.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,7 +38,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.Stats = exports.FastStats = void 0;
40
40
  const axios_1 = __importDefault(require("axios"));
41
- const chalk_1 = __importDefault(require("chalk"));
42
41
  const events = __importStar(require("events"));
43
42
  const fast_stats_1 = require("fast-stats");
44
43
  Object.defineProperty(exports, "FastStats", { enumerable: true, get: function () { return fast_stats_1.Stats; } });
@@ -53,6 +52,8 @@ const zlib = __importStar(require("zlib"));
53
52
  const rtcstats_1 = require("./rtcstats");
54
53
  const utils_1 = require("./utils");
55
54
  const log = (0, utils_1.logger)('webrtcperf:stats');
55
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
56
+ const { default: chalk } = require('chalk-template');
56
57
  function calculateFailAmountPercentile(stat, percentile = 95) {
57
58
  return Math.round(stat.percentile(percentile));
58
59
  }
@@ -133,9 +134,9 @@ function formatStats(s, forWriter = false) {
133
134
  * @param name
134
135
  */
135
136
  function sprintfStatsTitle(name) {
136
- return (0, sprintf_js_1.sprintf)((0, chalk_1.default) `-- {bold %(name)s} %(fill)s\n`, {
137
+ return (0, sprintf_js_1.sprintf)(chalk `-- {bold %(name)s} %(fill)s\n`, {
137
138
  name,
138
- fill: '-'.repeat(100 - name.length - 4),
139
+ fill: '-'.repeat(110 - name.length - 4),
139
140
  });
140
141
  }
141
142
  /**
@@ -143,7 +144,7 @@ function sprintfStatsTitle(name) {
143
144
  */
144
145
  function sprintfStatsHeader() {
145
146
  return (sprintfStatsTitle(new Date().toUTCString()) +
146
- (0, sprintf_js_1.sprintf)((0, chalk_1.default) `{bold %(name)\' 30s} {bold %(length)\' 8s} {bold %(sum)\' 8s} {bold %(mean)\' 8s} {bold %(stddev)\' 8s} {bold %(p5)\' 8s} {bold %(p95)\' 8s} {bold %(min)\' 8s} {bold %(max)\' 8s}\n`, {
147
+ (0, sprintf_js_1.sprintf)(chalk `{bold %(name)\' 30s} {bold %(length)\' 8s} {bold %(sum)\' 8s} {bold %(mean)\' 8s} {bold %(stddev)\' 8s} {bold %(p5)\' 8s} {bold %(p95)\' 8s} {bold %(min)\' 8s} {bold %(max)\' 8s}\n`, {
147
148
  name: 'name',
148
149
  length: 'count',
149
150
  sum: 'sum',
@@ -166,15 +167,15 @@ function sprintfStats(name, stats, format = '.2f', unit = '', scale = 1, hideSum
166
167
  scale = 1;
167
168
  }
168
169
  const statsData = formatStats(stats.all);
169
- return (0, sprintf_js_1.sprintf)((0, chalk_1.default) `{red {bold %(name)\' 30s}}` +
170
- (0, chalk_1.default) ` {bold %(length)\' 8d}` +
171
- (hideSum ? ' ' : (0, chalk_1.default) ` {bold %(sum)\' 8${format}}`) +
172
- (0, chalk_1.default) ` {bold %(mean)\' 8${format}}` +
173
- (0, chalk_1.default) ` {bold %(stddev)\' 8${format}}` +
174
- (0, chalk_1.default) ` {bold %(p5)\' 8${format}}` +
175
- (0, chalk_1.default) ` {bold %(p95)\' 8${format}}` +
176
- (0, chalk_1.default) ` {bold %(min)\' 8${format}}` +
177
- (0, chalk_1.default) ` {bold %(max)\' 8${format}}%(unit)s\n`, {
170
+ return (0, sprintf_js_1.sprintf)(chalk `{red {bold %(name)\' 30s}}` +
171
+ chalk ` {bold %(length)\' 8d}` +
172
+ (hideSum ? ' ' : chalk ` {bold %(sum)\' 8${format}}`) +
173
+ chalk ` {bold %(mean)\' 8${format}}` +
174
+ chalk ` {bold %(stddev)\' 8${format}}` +
175
+ chalk ` {bold %(p5)\' 8${format}}` +
176
+ chalk ` {bold %(p95)\' 8${format}}` +
177
+ chalk ` {bold %(min)\' 8${format}}` +
178
+ chalk ` {bold %(max)\' 8${format}}%(unit)s\n`, {
178
179
  name,
179
180
  length: statsData.length,
180
181
  sum: statsData.sum * scale,
@@ -184,7 +185,7 @@ function sprintfStats(name, stats, format = '.2f', unit = '', scale = 1, hideSum
184
185
  p95: statsData.p95 * scale,
185
186
  min: statsData.min * scale,
186
187
  max: statsData.max * scale,
187
- unit: unit ? (0, chalk_1.default) ` {red {bold ${unit}}}` : '',
188
+ unit: unit ? chalk ` {red {bold ${unit}}}` : '',
188
189
  });
189
190
  }
190
191
  const promPrefix = 'wst_';
@@ -1260,7 +1261,7 @@ class Stats extends events.EventEmitter {
1260
1261
  });
1261
1262
  }
1262
1263
  else {
1263
- out += (0, sprintf_js_1.sprintf)((0, chalk_1.default) `{bold %(check)-${colSize}s} {bold %(total)-10s} {bold %(totalFailsTime)-15s} {bold %(totalFailsTimePerc)-15s} {bold %(failAmount)-15s}\n`, {
1264
+ out += (0, sprintf_js_1.sprintf)(chalk `{bold %(check)-${colSize}s} {bold %(total)-10s} {bold %(totalFailsTime)-15s} {bold %(totalFailsTimePerc)-15s} {bold %(failAmount)-15s}\n`, {
1264
1265
  check: 'Condition',
1265
1266
  total: 'Fails',
1266
1267
  totalFailsTime: 'Fail time (s)',
@@ -1282,7 +1283,7 @@ class Stats extends events.EventEmitter {
1282
1283
  });
1283
1284
  }
1284
1285
  else {
1285
- out += (0, sprintf_js_1.sprintf)((0, chalk_1.default) `{red {bold %(check)-${colSize}s}} {bold %(totalFails)-10s} {bold %(totalFailsTime)-15s} {bold %(totalFailsTimePerc)-15s} {bold %(failAmountPercentile)-15s}\n`, {
1286
+ out += (0, sprintf_js_1.sprintf)(chalk `{red {bold %(check)-${colSize}s}} {bold %(totalFails)-10s} {bold %(totalFailsTime)-15s} {bold %(totalFailsTimePerc)-15s} {bold %(failAmountPercentile)-15s}\n`, {
1286
1287
  check: `${key} ${reportDesc}`,
1287
1288
  totalFails,
1288
1289
  totalFailsTime: Math.round(totalFailsTime),
@@ -1303,7 +1304,7 @@ class Stats extends events.EventEmitter {
1303
1304
  }
1304
1305
  else {
1305
1306
  out += (0, sprintf_js_1.sprintf)(`%(fill)s\n`, { fill: '-'.repeat(colSize + 15) });
1306
- out += (0, sprintf_js_1.sprintf)((0, chalk_1.default) `{bold %(name)-${colSize}s} {bold %(failPerc)-15s}\n`, {
1307
+ out += (0, sprintf_js_1.sprintf)(chalk `{bold %(name)-${colSize}s} {bold %(failPerc)-15s}\n`, {
1307
1308
  name: 'Tag',
1308
1309
  failPerc: 'Fail %',
1309
1310
  });
@@ -1318,7 +1319,7 @@ class Stats extends events.EventEmitter {
1318
1319
  }
1319
1320
  else {
1320
1321
  const color = failPerc < 5 ? 'green' : failPerc < 25 ? 'yellowBright' : failPerc < 50 ? 'yellow' : 'red';
1321
- out += (0, sprintf_js_1.sprintf)((0, chalk_1.default) `{${color} {bold %(tag)-${colSize}s %(failPerc)-15s}}\n`, {
1322
+ out += (0, sprintf_js_1.sprintf)(chalk `{${color} {bold %(tag)-${colSize}s %(failPerc)-15s}}\n`, {
1322
1323
  tag,
1323
1324
  failPerc,
1324
1325
  });