sh33dafi / jest-sonar

A jest reporter that generates sonar reports
MIT License
50 stars 11 forks source link

Illegal character ((CTRL-CHAR, code 27)) #12

Closed tinovyatkin closed 4 years ago

tinovyatkin commented 5 years ago

Getting following error on generated file. Looks like some characters needs to be encoded:

15:48:56.168 ERROR: Error during SonarQube Scanner execution
Error during parsing of generic test execution report '/home/runner/work/engine/engine/reports/jest-reporter.xml'. Look at the SonarQube documentation to know the expected XML format.
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 27))
 at [row,col {unknown-source}]: [4,57]
    at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:674)
    at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:659)
    at com.ctc.wstx.sr.BasicStreamReader.parseAttrValue(BasicStreamReader.java:1918)
    at com.ctc.wstx.sr.BasicStreamReader.handleNonNsAttrs(BasicStreamReader.java:3139)
    at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2968)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2839)
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1073)
    at org.codehaus.staxmate.in.SMHierarchicCursor.getNext(SMHierarchicCursor.java:79)

Not related to #7, as testing with the fork version results in the same error.

tinovyatkin commented 5 years ago

That caused by ANSI characters in test name, resulting in invalid XML:

<testCase name="Line Items Creation One way transfer in USD on a Minivan" duration="125" />
sh33dafi commented 5 years ago

Thanks for reporting and making a PR I will try to merge it somewhere today

thiagotrentin commented 4 years ago

I'm still getting this issue but when failure message have ANSI caracteres.

In my case is something like this: expect(received).toBe(expected)

is it necessary to remove all te ANSI caracteres from the report?

sh33dafi commented 4 years ago

So if I understand you correctly @thiagotrentin you get this when a test that contains ANSI chars fails? I will try to fix it this evening. Thanks for reporting

thiagotrentin commented 4 years ago

you're right @ sh33dafi, but unlike the reported problem, in my case, the error occurs when the error message contains ANSI characters, as you can see in this example:

<testCase name="Testes unit&#xE1;rios para a classe CardUtils. Converte um n&#xFA;mero de cart&#xE3;o Elo e busca a imagem correspondente." duration="7">
<failure message="Error"><![CDATA[Error: expect(received).toBe(expected) // Object.is equality

Expected: "elo"
Received: null
sh33dafi commented 4 years ago

@tinovyatkin Should be fixed in v0.2.6 can you verify?

thiagotrentin commented 4 years ago

it works, thank you @sh33dafi !

github-actions[bot] commented 4 years ago

Locked due to an inactive of 90 days