Skip to content

Commit c20d651

Browse files
committed
fix: print more debug info
1 parent ca8d1e1 commit c20d651

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

Diff for: task-utils.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ function resolveRelativePaths(nycFilename) {
137137
})
138138

139139
if (changed) {
140-
debug('saving updated file %s', nycFilename)
140+
debug('resolveRelativePaths saving updated file %s', nycFilename)
141+
debug('there are %d keys in the file', coverageKeys.length)
141142
writeFileSync(
142143
nycFilename,
143144
JSON.stringify(nycCoverage, null, 2) + '\n',
@@ -225,7 +226,8 @@ function tryFindingLocalFiles(nycFilename) {
225226
})
226227

227228
if (changed) {
228-
debug('saving updated file %s', nycFilename)
229+
debug('tryFindingLocalFiles saving updated file %s', nycFilename)
230+
debug('there are %d keys in the file', coverageKeys.length)
229231
writeFileSync(
230232
nycFilename,
231233
JSON.stringify(nycCoverage, null, 2) + '\n',
@@ -307,7 +309,13 @@ function includeAllFiles(nycFilename, nycOptions) {
307309
const nycCoverage = JSON.parse(readFileSync(nycFilename, 'utf8'))
308310
const coverageKeys = Object.keys(nycCoverage)
309311
const coveredPaths = coverageKeys.map(key => nycCoverage[key].path)
310-
debug('coverage has the following paths %o', coveredPaths)
312+
313+
debug('coverage has %d record(s)', coveredPaths.length)
314+
// report on first couple of entries
315+
if (debug.enabled) {
316+
console.error('coverage has the following first paths')
317+
console.error(coveredPaths.slice(0, 4).join('\n'))
318+
}
311319

312320
let changed
313321
allFiles.forEach(fullPath => {
@@ -330,7 +338,9 @@ function includeAllFiles(nycFilename, nycOptions) {
330338
})
331339

332340
if (changed) {
333-
debug('saving updated file %s', nycFilename)
341+
debug('includeAllFiles saving updated file %s', nycFilename)
342+
debug('there are %d keys in the file', Object.keys(nycCoverage).length)
343+
334344
writeFileSync(
335345
nycFilename,
336346
JSON.stringify(nycCoverage, null, 2) + '\n',

Diff for: task.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,14 @@ function maybePrintFinalCoverageFiles(folder) {
5252

5353
debug('Final coverage in %s', jsonReportFilename)
5454
const finalCoverage = JSON.parse(readFileSync(jsonReportFilename, 'utf8'))
55-
Object.keys(finalCoverage).forEach(key => {
55+
const finalCoverageKeys = Object.keys(finalCoverage)
56+
debug(
57+
'There are %d key(s) in %s',
58+
finalCoverageKeys.length,
59+
jsonReportFilename
60+
)
61+
62+
finalCoverageKeys.forEach(key => {
5663
const s = finalCoverage[key].s || {}
5764
const statements = Object.keys(s)
5865
const totalStatements = statements.length

0 commit comments

Comments
 (0)