From e981cc156b447ce7a936114dafac591126fd65dd Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Fri, 22 Nov 2019 17:15:41 -0800 Subject: [PATCH] feat: adds special (empty-report) block (#74) --- lib/v8-to-istanbul.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/v8-to-istanbul.js b/lib/v8-to-istanbul.js index 30c50da2..1c53d0eb 100644 --- a/lib/v8-to-istanbul.js +++ b/lib/v8-to-istanbul.js @@ -82,8 +82,14 @@ module.exports = class V8ToIstanbul { startCol, endCol } = this._maybeRemapStartColEndCol(range) - const lines = this.source.lines.filter(line => { + // Upstream tooling can provide a block with the functionName + // (empty-report), this will result in a report that has all + // lines zeroed out. + if (block.functionName === '(empty-report)') { + line.count = 0 + return true + } return startCol <= line.endCol && endCol >= line.startCol }) const startLineInstance = lines[0]