Title: test_runner: junit reporter writes raw C0 control characters (e.g. ANSI color codes), producing invalid XML · Issue #67155 · nodejs/node · GitHub
Open Graph Title: test_runner: junit reporter writes raw C0 control characters (e.g. ANSI color codes), producing invalid XML · Issue #67155 · nodejs/node
X Title: test_runner: junit reporter writes raw C0 control characters (e.g. ANSI color codes), producing invalid XML · Issue #67155 · nodejs/node
Description: Version v24.20.0 (also present on main) Platform Linux x64 Subsystem test_runner What steps will reproduce the bug? // t.test.mjs import { test } from "node:test" import assert from "node:assert" test("diff", () => assert.deepEqual({ a: ...
Open Graph Description: Version v24.20.0 (also present on main) Platform Linux x64 Subsystem test_runner What steps will reproduce the bug? // t.test.mjs import { test } from "node:test" import assert from "node:assert" t...
X Description: Version v24.20.0 (also present on main) Platform Linux x64 Subsystem test_runner What steps will reproduce the bug? // t.test.mjs import { test } from "node:test" import assert from "...
Opengraph URL: https://github.com/nodejs/node/issues/67155
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test_runner: junit reporter writes raw C0 control characters (e.g. ANSI color codes), producing invalid XML","articleBody":"### Version\n\nv24.20.0 (also present on `main`)\n\n### Platform\n\nLinux x64\n\n### Subsystem\n\ntest_runner\n\n### What steps will reproduce the bug?\n\n```js\n// t.test.mjs\nimport { test } from \"node:test\"\nimport assert from \"node:assert\"\ntest(\"diff\", () => assert.deepEqual({ a: 1 }, { a: 2 }))\n```\n\n```sh\nFORCE_COLOR=1 node --test --test-reporter junit --test-reporter-destination r.xml t.test.mjs\nxmllint --noout r.xml\n```\n\n### What is the expected behavior?\n\n`r.xml` is well-formed XML 1.0.\n\n### What do you see instead?\n\n`xmllint` rejects the file: the `\u003cfailure>` message contains raw ANSI escape bytes (U+001B) from the colored assertion diff. XML 1.0 forbids C0 control characters other than tab, LF and CR, even as numeric character references (`` is also illegal), so JUnit consumers reject the whole report.\n\n### Additional information\n\n`lib/internal/test_runner/reporter/junit.js` escapes only `&`, `\u003c`, `\"` and newlines. Any C0 control character in a test name, failure message or stack is written as-is. Colored assertion diffs are the common trigger (child processes get `FORCE_COLOR=1` when the runner's destination is a color terminal), but a test name or error string containing `\\x1b` or `\\x00` produces the same invalid file. The reporter would need to strip or replace these characters rather than escape them.\n\nRelated: #67149 (a different junit reporter output defect, `\u003cundefined>` elements after truncated results).\n","author":{"url":"https://github.com/yasyf","@type":"Person","name":"yasyf"},"datePublished":"2026-10-31T03:43:35Z","url":"https://github.com/nodejs/node/issues/67155"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:82aff3d7-8e37-d224-e915-c67a726d1e25 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E66E:210448:64E38A:868F1B:6B0626D6 |
| html-safe-nonce | 32543a704e035828545eaf99ecf62f4547f48344d5c6b230926bde38e3f70730 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjZFOjIxMDQ0ODo2NEUzOEE6ODY4RjFCOjZCMDYyNkQ2IiwidmlzaXRvcl9pZCI6Ijg5ODQ0NDI0MzI0NDgyNDM0MTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c0ba1032c2f431463249217c5457a9ceb311d7fcff83e7191cc6bbff28db64ee |
| hovercard-subject-tag | issue:6130755788 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/67155/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a947afdef872c6357155cb9c08b015633498468e05ddd3be33466b912b35eedd/nodejs/node/issues/67155 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a947afdef872c6357155cb9c08b015633498468e05ddd3be33466b912b35eedd/nodejs/node/issues/67155 |
| og:image:alt | Version v24.20.0 (also present on main) Platform Linux x64 Subsystem test_runner What steps will reproduce the bug? // t.test.mjs import { test } from "node:test" import assert from "node:assert" t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yasyf |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9e10bb0ecc0bd0f8692aa89586ee9b54e498d7ab9f244a44cdb5b93653a125ce |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32e57d5cc2ce6ce92ec6dceb65858344750c27c2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width