You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@acot/reporter

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.3-canary.0 to 0.0.3-canary.1

6

CHANGELOG.md

@@ -6,2 +6,8 @@ # Change Log

## [0.0.3-canary.1](https://github.com/acot-a11y/acot/compare/@acot/reporter@0.0.3-canary.0...@acot/reporter@0.0.3-canary.1) (2020-12-16)
### Features
- Improve progress display (pretty reporter) ([dc4e9e1](https://github.com/acot-a11y/acot/commit/dc4e9e1655408a499619a690798e06ef439844be))
## [0.0.3-canary.0](https://github.com/acot-a11y/acot/compare/@acot/reporter@0.0.2...@acot/reporter@0.0.3-canary.0) (2020-12-14)

@@ -8,0 +14,0 @@

68

lib/reporters/pretty.js

@@ -21,3 +21,24 @@ "use strict";

const readFile = util_1.promisify(fs_1.default.readFile);
const count = (s, n) => `${n} ${plur_1.default(s, n)}`;
const setCount = (arr, s, n) => {
if (n > 0) {
arr.push(`${n} ${plur_1.default(s, n)}`);
}
};
const summarize = (results) => {
const stat = results.reduce((acc, cur) => {
acc.pass += cur.status === 'pass' ? 1 : 0;
acc.pass += cur.status === 'error' ? 1 : 0;
acc.pass += cur.status === 'warn' ? 1 : 0;
return acc;
}, {
pass: 0,
error: 0,
warn: 0,
});
const msg = [];
setCount(msg, 'pass', stat.pass);
setCount(msg, 'error', stat.error);
setCount(msg, 'warning', stat.warn);
return msg.join(', ');
};
const stringLength = (s) => strip_ansi_1.default(s).length;

@@ -27,2 +48,3 @@ class AuditProgress {

this._current = 0;
this._total = 0;
this._timer = null;

@@ -36,3 +58,3 @@ this._text = 'Waiting...';

isComplete() {
return this._current >= this._urls.length;
return this._current >= this._total;
}

@@ -42,10 +64,8 @@ start() {

}
increment(result) {
const summary = [
count('error', result.errorCount),
count('warning', result.warningCount),
count('pass', result.passCount),
].join(', ');
this._text = `${result.url} (${summary})`;
add(total) {
this._total += total;
}
increment(url, id, results) {
this._current++;
this._text = `${url} - ${id} (${summarize(results)})`;
if (this.isComplete()) {

@@ -67,4 +87,3 @@ this.done();

_render() {
const total = this._urls.length;
const progress = this._current / total;
const progress = this._current / this._total;
const percent = `${Math.floor(progress * 100)}`.padStart(3);

@@ -82,3 +101,3 @@ const format = {

let output = [
chalk_1.default.bold(`Running on ${total} URLs:`),
chalk_1.default.bold(`Running on ${this._urls.length} URLs:`),
chalk_1.default `{cyan ${percent}%} ${bar} ${spinner}{gray ${this._text}}`,

@@ -98,15 +117,11 @@ ].join('\n');

class AuditLinearProgress extends AuditProgress {
increment(result) {
increment(url, id, results) {
this._current++;
const total = this._urls.length;
const current = this._current.toString().padStart(`${total}`.length, '0');
const summary = [
count('error', result.errorCount),
count('warning', result.warningCount),
count('pass', result.passCount),
].join(', ');
const current = this._current
.toString()
.padStart(`${this._total}`.length, '0');
const output = [
`[${current}/${total}]`,
chalk_1.default.bold(result.url),
chalk_1.default `{gray (${summary})}`,
chalk_1.default.gray(`[${current}/${this._total}]`),
chalk_1.default.bold(url),
chalk_1.default.gray(`${id} (${summarize(results)})`),
].join(' ');

@@ -171,5 +186,8 @@ this._stream.write(`${output}\n`);

});
runner.on('test:complete', ([, , result]) => {
progress.increment(result);
runner.on('test:start', ([, ids]) => {
progress.add(ids.length);
});
runner.on('testcase:complete', ([url, id, results]) => {
progress.increment(url, id, results);
});
runner.on('audit:complete', async ([summary]) => {

@@ -176,0 +194,0 @@ if (summary.results.length === 0) {

{
"name": "@acot/reporter",
"version": "0.0.3-canary.0",
"version": "0.0.3-canary.1",
"description": "A reporter toolset and built-in reporters for @acot/cli.",

@@ -48,3 +48,3 @@ "homepage": "https://github.com/acot-a11y/acot/tree/master/packages/reporter",

"devDependencies": {
"@acot/types": "0.0.3-canary.0",
"@acot/types": "0.0.3-canary.1",
"@types/text-table": "^0.2.1"

@@ -55,3 +55,3 @@ },

},
"gitHead": "c571c7f4be438578dc2dbd522013d2cac4f185a4"
"gitHead": "332f7a9be2dcf5b6a7838d5f53d03d8cbdfaac32"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc