-
Notifications
You must be signed in to change notification settings - Fork 94
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
Running in node 12 generates an invalid XML when running using '--reporter cobertura' #149
Comments
@assaf-xm could you share a repo with a minimal reproduction? Out of curiosity does your repository use |
Sure, here is a short code that reproduces it: test-c8.js
To get the XML (use node v12.9.1 or similar):
Then the resulted XML in
|
👋 oh fascinating, should be a pretty simple fix; we'll want to make it upstream here: |
Any update regarding this issue? |
@assaf-xm I believe the fix should be fairly simple, just haven't had the cycles to work on it; I'm about to dive in to a few updates to c8 based on work that has been done in Node.js around source-maps. I'll update you soon. |
@bcoe , reminder regarding this issue |
Just one more friendly reminder, I had to deal with it today. UPD. Added an issue istanbuljs/istanbuljs#527 |
A quick and ugly workaround: sed -i 's/<computed>/\<computed\>/g' ./cobertura-coverage.xml |
Version: v12.9.1
Platform: 4.4.0-130-generic
We use c8 with the cobertura reporter.
Moving from node 10 to node 12 the generated XML was invalid and crashed the Jenkins Cobertura publisher.
It seems that node 12 the '(anonymous function)' now becomes '
<computed>
' and the '<' character is invalid inside an attribute (in the cobertura-coverage.xml).For example:
Node12
<method name="self.cam.<computed>.handler" hits="6" signature="()V">
Node10
<method name="self.cam.(anonymous function).handler" hits="6" signature="()V">
The Jenkins error:
FATAL: Unable to parse .../builds/3622/coverage.xml
09:17:48 hudson.util.IOException2: Cannot parse coverage results
09:17:48 at hudson.plugins.cobertura.CoberturaCoverageParser.parse(CoberturaCoverageParser.java:84)
09:17:48 at hudson.plugins.cobertura.CoberturaCoverageParser.parse(CoberturaCoverageParser.java:52)
09:17:48 at hudson.plugins.cobertura.CoberturaPublisher.perform(CoberturaPublisher.java:593)
09:17:48 at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:79)
09:17:48 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
09:17:48 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
09:17:48 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
09:17:48 at hudson.model.Build$BuildExecution.post2(Build.java:186)
09:17:48 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
09:17:48 at hudson.model.Run.execute(Run.java:1840)
09:17:48 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
09:17:48 at hudson.model.ResourceController.execute(ResourceController.java:97)
09:17:48 at hudson.model.Executor.run(Executor.java:429)
09:17:48 Caused by: org.xml.sax.SAXParseException; lineNumber: 47595; columnNumber: 42; The value of attribute "name" associated with an element type "method" must not contain the '<' character.
09:17:48 at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
09:17:48 at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
09:17:48 at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
09:17:48 at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
09:17:48 at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
09:17:48 at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:944)
09:17:48 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(XMLDocumentFragmentScannerImpl.java:1548)
09:17:48 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1315)
09:17:48 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
09:17:48 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
09:17:48 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
09:17:48 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
09:17:48 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
09:17:48 at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
09:17:48 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
09:17:48 at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
09:17:48 at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
09:17:48 at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
09:17:48 at hudson.plugins.cobertura.CoberturaCoverageParser.parse(CoberturaCoverageParser.java:76)
09:17:48 ... 12 more
09:17:48 ERROR: Step ‘Publish Cobertura Coverage Report’ failed: [Cobertura] Unable to parse .../builds/3622/coverage.xml
The text was updated successfully, but these errors were encountered: