@acot/reporter
Advanced tools
Comparing version 0.0.3-canary.1 to 0.0.3-canary.2
@@ -6,2 +6,8 @@ # Change Log | ||
## [0.0.3-canary.2](https://github.com/acot-a11y/acot/compare/@acot/reporter@0.0.3-canary.1...@acot/reporter@0.0.3-canary.2) (2020-12-19) | ||
### Features | ||
- Add rule result for pretty reporter ([f668f8a](https://github.com/acot-a11y/acot/commit/f668f8a56e730ea31ece53f23d7fd2629e456211)) | ||
## [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) | ||
@@ -8,0 +14,0 @@ |
@@ -12,3 +12,5 @@ "use strict"; | ||
const text_table_1 = __importDefault(require("text-table")); | ||
const cli_table_1 = __importDefault(require("cli-table")); | ||
const ora_1 = __importDefault(require("ora")); | ||
const pretty_ms_1 = __importDefault(require("pretty-ms")); | ||
const indent_string_1 = __importDefault(require("indent-string")); | ||
@@ -135,13 +137,15 @@ const log_update_1 = __importDefault(require("log-update")); | ||
let spinner; | ||
stdout.write('\n'); | ||
stdout.write(boxen_1.default([ | ||
chalk_1.default.bold.green('Audit by acot'), | ||
text_table_1.default([ | ||
[chalk_1.default.bold('acot core:'), `v${runner.version.core}`], | ||
[chalk_1.default.gray('acot core:'), `v${runner.version.core}`], | ||
[ | ||
chalk_1.default.bold('runner:'), | ||
chalk_1.default.gray('runner:'), | ||
`${runner.name} (v${runner.version.self})`, | ||
], | ||
[chalk_1.default.bold('origin:'), chalk_1.default.underline(`${config.origin}`)], | ||
[chalk_1.default.gray('origin:'), chalk_1.default.underline(`${config.origin}`)], | ||
], { stringLength }), | ||
].join('\n\n'), { borderColor: 'gray', padding: 1 }) + '\n\n'); | ||
].join('\n\n'), { borderColor: 'gray', padding: 1 })); | ||
stdout.write('\n\n'); | ||
let progress = null; | ||
@@ -250,13 +254,49 @@ runner.on('setup:start', () => { | ||
})); | ||
if (summary.errorCount > 0) { | ||
stdout.write(chalk_1.default.red(`${summary.errorCount} ${plur_1.default('error', summary.errorCount)}\n`)); | ||
} | ||
if (summary.warningCount > 0) { | ||
stdout.write(chalk_1.default.yellow(`${summary.warningCount} ${plur_1.default('warning', summary.warningCount)}\n`)); | ||
} | ||
if (summary.passCount > 0) { | ||
stdout.write(chalk_1.default.green(`${summary.passCount} ${plur_1.default('pass', summary.passCount)}\n`)); | ||
} | ||
stdout.write(heading('(Summary)') + '\n'); | ||
const cliTable = new cli_table_1.default({ | ||
head: ['', 'Rule', '', 'Pass', 'Error', 'Warning'], | ||
colAligns: ['middle', 'left', 'right', 'right', 'right', 'right'], | ||
chars: { | ||
'top-mid': '─', | ||
'bottom-mid': '─', | ||
'mid-mid': '─', | ||
middle: ' ', | ||
}, | ||
style: { | ||
head: ['gray', 'bold'], | ||
border: ['gray'], | ||
compact: true, | ||
}, | ||
}); | ||
const passCount = (n) => n > 0 ? chalk_1.default.green(n) : chalk_1.default.gray('-'); | ||
const errorCount = (n) => n > 0 ? chalk_1.default.red(n) : chalk_1.default.gray('-'); | ||
const warningCount = (n) => n > 0 ? chalk_1.default.yellow(n) : chalk_1.default.gray('-'); | ||
Object.entries(summary.rules).forEach(([rule, result]) => { | ||
let status = log_symbols_1.default.success; | ||
if (result.errorCount > 0) { | ||
status = log_symbols_1.default.error; | ||
} | ||
else if (result.warningCount > 0) { | ||
status = log_symbols_1.default.warning; | ||
} | ||
cliTable.push([ | ||
status, | ||
rule, | ||
chalk_1.default.gray(pretty_ms_1.default(result.duration)), | ||
passCount(result.passCount), | ||
errorCount(result.errorCount), | ||
warningCount(result.warningCount), | ||
]); | ||
}); | ||
cliTable.push([ | ||
'', | ||
'', | ||
pretty_ms_1.default(summary.duration), | ||
passCount(summary.passCount), | ||
errorCount(summary.errorCount), | ||
warningCount(summary.warningCount), | ||
]); | ||
stdout.write(`${cliTable.toString()}\n`); | ||
stdout.write('\n'); | ||
}); | ||
}); |
{ | ||
"name": "@acot/reporter", | ||
"version": "0.0.3-canary.1", | ||
"version": "0.0.3-canary.2", | ||
"description": "A reporter toolset and built-in reporters for @acot/cli.", | ||
@@ -19,3 +19,5 @@ "homepage": "https://github.com/acot-a11y/acot/tree/master/packages/reporter", | ||
"files": [ | ||
"lib" | ||
"lib", | ||
"!__mocks__", | ||
"!__tests__" | ||
], | ||
@@ -34,7 +36,8 @@ "scripts": { | ||
"dependencies": { | ||
"@acot/html-pickup": "0.0.2", | ||
"@acot/module-loader": "0.0.2", | ||
"@acot/utils": "0.0.2", | ||
"@acot/html-pickup": "0.0.3-canary.0", | ||
"@acot/module-loader": "0.0.3-canary.0", | ||
"@acot/utils": "0.0.3-canary.0", | ||
"boxen": "^4.2.0", | ||
"chalk": "^4.0.0", | ||
"cli-table": "^0.3.4", | ||
"figures": "^3.2.0", | ||
@@ -46,2 +49,3 @@ "indent-string": "^4.0.0", | ||
"plur": "^4.0.0", | ||
"pretty-ms": "^7.0.1", | ||
"strip-ansi": "^6.0.0", | ||
@@ -51,3 +55,4 @@ "text-table": "^0.2.0" | ||
"devDependencies": { | ||
"@acot/types": "0.0.3-canary.1", | ||
"@acot/types": "0.0.3-canary.2", | ||
"@types/cli-table": "^0.3.0", | ||
"@types/text-table": "^0.2.1" | ||
@@ -58,3 +63,3 @@ }, | ||
}, | ||
"gitHead": "332f7a9be2dcf5b6a7838d5f53d03d8cbdfaac32" | ||
"gitHead": "9e6e18956656849d3ac334de77f6081d701d7d98" | ||
} |
24459
489
15
3
13
+ Addedcli-table@^0.3.4
+ Addedpretty-ms@^7.0.1
+ Added@acot/html-pickup@0.0.3-canary.0(transitive)
+ Added@acot/module-loader@0.0.3-canary.0(transitive)
+ Added@acot/utils@0.0.3-canary.0(transitive)
+ Addedcli-table@0.3.11(transitive)
+ Addedcolors@1.0.3(transitive)
+ Addedparse-ms@2.1.0(transitive)
+ Addedpretty-ms@7.0.1(transitive)
- Removed@acot/html-pickup@0.0.2(transitive)
- Removed@acot/module-loader@0.0.2(transitive)
- Removed@acot/utils@0.0.2(transitive)
Updated@acot/utils@0.0.3-canary.0