Skip to content

Remove invalid characters in jest test report output that's breaking the XML parser

What does this MR do and why?

This MR changes the names of some of our jest tests so that the XML test report can be parsed without throwing an invalid character in attribute value error.

Screenshots or screen recordings

These errors show for all recent pipelines/MRs in the gitlab project where the full jest test suite ran, sometimes with different line numbers if tests have changed but always with the message JUnit XML parsing failed...FATAL: invalid character in attribute value:

error as shown in MR widget error as shown in pipelines
Screenshot_2023-06-20_at_18.06.48 Screenshot_2023-06-20_at_18.01.05

How to set up and validate locally

  1. find/make a project that generates test reports
  2. write a test that has a control character in its name - such as a unicode \u0001 or \u0003, or ascii \x15 or \x7f - and run a pipeline that runs this test
  • if the pipeline is the head pipeline or base pipeline of a merge request, a parsing error will appear in the test summary MR widget (see screenshot above)
  • a parsing error will also appear in the Tests tab on the pipeline page (see screenshot above)
  1. this MR removes these characters from our jest test names, so these errors should no longer appear in our MR widgets
  2. this MR's expanded widget should show a base report parsing error but no head report parsing error, meaning that there should be no parsing errors once it is merged:

Screenshot_2023-06-20_at_18.12.25

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #415587 (closed)

Edited by Miranda Fluharty

Merge request reports

Loading