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

JUnit reporter emits invalid XML when there are logs in stdout or stderr #1144

Closed
6 tasks done
ciddan opened this issue Apr 12, 2022 · 1 comment
Closed
6 tasks done

Comments

@ciddan
Copy link
Contributor

ciddan commented Apr 12, 2022

Describe the bug

The escapeXML function in the junit reporter does not remove characters that are illegal in an XML document. This can cause issues when writing lines from stdout and stderr to the output xml file.

There is an MIT licensed gist that correctly scrubs illegal characters. That, or something similar, should be added to the junit reporter.

I could write up an MR if you'd like.

Reproduction

Reproduction StackBlitz.

Let the tests run and open test_result/junit.xml. The file contains disallowed characters, specifically in the <system-err> tag.

You can use any XML validator to check, such as the one from w3schools.

System Info

System:
    OS: Linux 5.17 Fedora Linux 36 (Workstation Edition Prerelease)
    CPU: (16) x64 AMD Ryzen 7 4800U with Radeon Graphics
    Memory: 6.38 GB / 15.06 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 1.22.18 - ~/.nvm/versions/node/v16.14.2/bin/yarn
    npm: 8.6.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
  Browsers:
    Chrome: 100.0.4896.75
    Firefox: 98.0.2
  npmPackages:
    vite: ^2.9.1 => 2.9.1 
    vitest: ^0.9.3 => 0.9.3

Used Package Manager

yarn

Validations

@ciddan
Copy link
Contributor Author

ciddan commented Apr 12, 2022

Opened PR #1145.

@antfu antfu closed this as completed in ab8e2b8 Apr 14, 2022
chaii3 pushed a commit to chaii3/vitest that referenced this issue May 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants