Skip to content

test_runner: fix quote escaping in JUnit - #65971

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
hanityx:test-runner-junit-quote
Sep 12, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
hanityx:test-runner-junit-quote

Conversation

@hanityx

@hanityx hanityx commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Double quotes in JUnit attribute values are escaped twice: first as
", then as ". An XML reader gets the text "
instead of a double quote.

Call escapeContent() before replacing quotes and newlines.

Add a snapshot test for repeated quotes, literal ", and quotes
mixed with &, <, or a newline.

Refs: #60274

Escape XML content before replacing double quotes and line feeds.

Add a snapshot test for repeated quotes, literal quote references,
and quotes mixed with ampersands, less-than signs, or a newline.

Signed-off-by: hanityx <hanityx@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Sep 10, 2026
@codecov

codecov Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.18%. Comparing base (fd6682c) to head (2652c0e).
⚠️ Report is 55 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65971      +/-   ##
==========================================
+ Coverage   90.16%   90.18%   +0.02%     
==========================================
  Files         771      771              
  Lines      265445   265470      +25     
  Branches    50455    50459       +4     
==========================================
+ Hits       239329   239421      +92     
+ Misses      17056    17002      -54     
+ Partials     9060     9047      -13     
Files with missing lines Coverage Δ
lib/internal/test_runner/reporter/junit.js 94.76% <100.00%> (ø)

... and 47 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@meixg meixg added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 11, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 11, 2026
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@panva panva added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Sep 11, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panva panva added the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 12, 2026
@nodejs-github-bot
nodejs-github-bot merged commit dc3b46f into nodejs:main Sep 12, 2026
87 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in dc3b46f

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 12, 2026
aduh95 pushed a commit that referenced this pull request Sep 16, 2026
Escape XML content before replacing double quotes and line feeds.

Add a snapshot test for repeated quotes, literal quote references,
and quotes mixed with ampersands, less-than signs, or a newline.

Signed-off-by: hanityx <hanityx@gmail.com>
PR-URL: #65971
Refs: #60274
Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Sep 22, 2026
Escape XML content before replacing double quotes and line feeds.

Add a snapshot test for repeated quotes, literal quote references,
and quotes mixed with ampersands, less-than signs, or a newline.

Signed-off-by: hanityx <hanityx@gmail.com>
PR-URL: #65971
Refs: #60274
Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Sep 25, 2026
Escape XML content before replacing double quotes and line feeds.

Add a snapshot test for repeated quotes, literal quote references,
and quotes mixed with ampersands, less-than signs, or a newline.

Signed-off-by: hanityx <hanityx@gmail.com>
PR-URL: #65971
Refs: #60274
Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
stranxik added a commit to stranxik/runward that referenced this pull request Nov 4, 2026
…t (RWD-2026-0187, RWD-2026-0188)

Node.js's junit reporter writes a `"` of a test name as `&amp;quot;` up to
24.21.x (and in 20.x, 22.x, 25.x) and as `&quot;` from 24.22.0
(nodejs/node#65971). Read as XML says, the old form is the literal text
`&quot;`, so `test:...::a "quoted" name` linked under one Node.js and was
refused under the other (exit 1), the unreleased junit-projection-v1 seal
broke on a regeneration and blamed the cases, and net-shrink counted 16
removed cases on runward's own report.

A JUnit document with no `&quot;` and at least one `&amp;quot;` now reads
`&amp;quot;` as `"` throughout (junitWritesQuotesTwice, decodeJUnitValue);
any other document is decoded once, never repeatedly. One reading for
junitTestCases, junitProjection (fixed before its first release), the
witness spec, the freshness recipe and, by a copy held equal by a test,
net-shrink, which now says "N case(s) differ only by the reporter's
escaping" and does not count them. A seal that only the other spelling of
the quotes reproduces says "changed only by the reporter's quote escaping
(nodejs/node#65971)", exit 1 still. The residual risk (a literal `&quot;`
in a name with no `"` anywhere) is declared, tested, and kept out of
runward's own suite by a test.

A quoted test name that stops at an inner `"` is refused as such, with the
entity form and the unquoted form; the echo of a name carrying a `"` reads
back as that name (RWD-2026-0188).

Claude-Session: https://claude.ai/code/session_01WCoXsECVp3PpZLgD5NEcoU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants