Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't load JSON that does not look like coverage information #146

Merged
merged 1 commit into from
Sep 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,23 @@ class Report {
_getMergedProcessCov () {
const v8ProcessCovs = []
for (const v8ProcessCov of this._loadReports()) {
v8ProcessCovs.push(this._normalizeProcessCov(v8ProcessCov))
if (this._isCoverageObject(v8ProcessCov)) {
v8ProcessCovs.push(this._normalizeProcessCov(v8ProcessCov))
}
}
return mergeProcessCovs(v8ProcessCovs)
}

/**
* Make sure v8ProcessCov actually contains coverage information.
*
* @return {boolean} does it look like v8ProcessCov?
* @private
*/
_isCoverageObject (maybeV8ProcessCov) {
return maybeV8ProcessCov && Array.isArray(maybeV8ProcessCov.result)
}

/**
* Returns the list of V8 process coverages generated by Node.
*
Expand Down