File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed
Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ The format is based on [Keep a Changelog][kac] and this project adheres to
1313
1414### Fixed
1515
16- * avoid interference from env to junit formatter internals (#1175 )
16+ * junit formatter:
17+ * avoid interference between env and internals (#1175 )
18+ * remove control characters (\x00-\x08\x0B\x0C\x0E-\x1F) (#1176 )
1719
1820## [ 1.13.0] - 2025-11-07
1921
Original file line number Diff line number Diff line change @@ -282,4 +282,6 @@ main() {
282282 finish_suite # ensure we run this with the local variables still in scope
283283}
284284
285- main " $@ "
285+ # [\x00-\x08\x0B\x0C\x0E-\x1F] can't use $'\x00' as this terminates the string early
286+ BATS_JUNIT_FORMATTER_DELETE_CHARS_DEFAULT=' \000' $' \x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F '
287+ main " $@ " | tr -d " ${BATS_JUNIT_FORMATTER_DELETE_CHARS-$BATS_JUNIT_FORMATTER_DELETE_CHARS_DEFAULT } "
Original file line number Diff line number Diff line change 33}
44
55@test " Failed test with escape characters: \" '<>&[0m[K (0x1b)" {
6- echo " <>'&[0m[K" && false
6+ echo " <>'&[0m[K" $' \x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f stop ' && false
77}
88
99@test " Skipped test with escape characters: \" '<>&[0m[K (0x1b)" {
Original file line number Diff line number Diff line change @@ -56,9 +56,11 @@ TESTSUITES_REGEX="<testsuites time=\"$FLOAT_REGEX\">"
5656 [[ " ${lines[3]} " == " <testcase classname=\" $ESCAPED_TEST_FILE_NAME \" name=\" Successful test with escape characters: "'<>& (0x1b)\" time=\" " * " \" />" ]]
5757 [[ " ${lines[4]} " == " <testcase classname=\" $ESCAPED_TEST_FILE_NAME \" name=\" Failed test with escape characters: "'<>& (0x1b)\" " * ]]
5858 [[ " ${lines[5]} " == ' <failure type="failure">(in test file ' * " $ESCAPED_TEST_FILE_NAME , line 6)" ]]
59- [[ " ${lines[6]} " == ' `echo "<>'&" && false' failed' * ]]
60- [[ " ${lines[9]} " == " <testcase classname=\" $ESCAPED_TEST_FILE_NAME \" name=\" Skipped test with escape characters: "'<>& (0x1b)\" time=\" " * " \" >" ]]
61- [[ " ${lines[10]} " == " <skipped>"'<>&</skipped>" ]]
59+ [[ " ${lines[6]} " == ' `echo "<>'&"$'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1fstop' && false' failed' * ]]
60+ [[ " ${lines[7]} " == ' <>'&' ]]
61+ [[ " ${lines[8]} " == $' \x0D stop</failure>' ]]
62+ [[ " ${lines[10]} " == " <testcase classname=\" $ESCAPED_TEST_FILE_NAME \" name=\" Skipped test with escape characters: "'<>& (0x1b)\" time=\" " * " \" >" ]]
63+ [[ " ${lines[11]} " == " <skipped>"'<>&</skipped>" ]]
6264}
6365
6466@test " junit formatter: test suites" {
You can’t perform that action at this time.
0 commit comments