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: strip ANSI escapes from message as well? #2032

Open
kevinushey opened this issue Nov 24, 2024 · 1 comment
Open

junit: strip ANSI escapes from message as well? #2032

kevinushey opened this issue Nov 24, 2024 · 1 comment

Comments

@kevinushey
Copy link
Collaborator

kevinushey commented Nov 24, 2024

E.g. here:

testthat/R/reporter-junit.R

Lines 116 to 119 in 886527d

first_line <- function(x) {
loc <- expectation_location(x, " (", ")")
paste0(strsplit(x$message, split = "\n")[[1]][1], loc)
}

Note that testthat is already stripping ANSI escapes for the regular message bodies.

xml2::xml_text(error) <- cli::ansi_strip(format(result))

Presumably because control characters aren't normally allowed in XML (well, XML 1.0) files?

@kevinushey
Copy link
Collaborator Author

It might also be sufficient to ask xml2 to generate an XML 1.1 file, since control characters are allowed in such files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant