istanbuljs/istanbuljs

Error generating clover report

Closed this issue · 0 comments

Full error:

Error generating report clover Error: Attempt to close tag package when project was the one open

This looks to be a replica/dupe of:
#384

Except I'm on version: 3.1.5 of istanbul-reports. 384 mentions just upgrading so it seems like a new issue?

I did a little debugging on my side and found this doesn't always occur, and I'm not sure why yet. However the fix seems to simply be changing this line:

this.xml.closeTag('package');

To:

this.xml.closeTag(this.xml.stack[this.xml.stack.length - 1]);

This will bypass the issue, at least for the case I've seen in our private repos. I haven't tested other scenarios.

edit I was debugging this a little more, this seems to only appear if the context is setup with:

const libReport = require('istanbul-lib-report');

libReport.createContext({
  defaultSummarizer: 'nested',
  /**/
})

If the defaultSummarizer is set as nested this error is possible, all other settings seem to be ok.