Skip to content

Commit 466b95d

Browse files
bahmutovrndmerle
authored andcommitted
fix: print number of keys and few paths for simpler debugging
1 parent 8905419 commit 466b95d

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Diff for: task.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,26 @@ function saveCoverage(coverage) {
4444
*/
4545
function resolvePaths(nycFilename) {
4646
const nycCoverage = JSON.parse(readFileSync(nycFilename, 'utf8'))
47+
48+
const coverageKeys = Object.keys(nycCoverage)
49+
if (!coverageKeys.length) {
50+
console.error('⚠️ file %s has no coverage information', nycFilename)
51+
return
52+
}
53+
debug('NYC file %s has %d key(s)', nycFilename, coverageKeys.length)
54+
4755
let changed
48-
Object.keys(nycCoverage).forEach(key => {
56+
const maxPrintKeys = 3
57+
58+
Object.keys(nycCoverage).forEach((key, k) => {
4959
const coverage = nycCoverage[key]
60+
61+
// printing a few found keys and file paths from the coverage file
62+
// will make debugging any problems much much easier
63+
if (k < maxPrintKeys) {
64+
debug('%d key %s file path %s', k + 1, key, coverage.path)
65+
}
66+
5067
if (coverage.path && !isAbsolute(coverage.path)) {
5168
if (existsSync(coverage.path)) {
5269
debug('resolving path %s', coverage.path)

0 commit comments

Comments
 (0)