diff --git a/packages/cypress/src/junit.ts b/packages/cypress/src/junit.ts index e36816c0..62af7e20 100644 --- a/packages/cypress/src/junit.ts +++ b/packages/cypress/src/junit.ts @@ -110,6 +110,10 @@ function addReplayLinkProperty(node: INode, replayUrls: string[]) { } } +function escapeForXml(content: string) { + return content.replace(/&/g, "&").replace(/>/g, ">").replace(/ ` * ${url}`).join("\n"); + const output = `${failure.children[0]}\n\nView in Replay\n${replayUrls + .map(url => ` * ${url}`) + .join("\n")}`; + + failure.children[0] = escapeForXml(output); }); } catch (e) { debug("Failed to add replay url to failure output: %s", e);