Skip to content

test_runner: escape carriage returns in snapshot values - #66040

Open
hanityx wants to merge 1 commit into
nodejs:mainfrom
hanityx:test-runner-snapshot-cr
Open

hanityx wants to merge 1 commit into
nodejs:mainfrom
hanityx:test-runner-snapshot-cr

Conversation

@hanityx

@hanityx hanityx commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

CR and CRLF line endings from custom serializers such as
String are normalized to LF when the snapshot file is evaluated:

Saved value:       "a\r\nb"
Loaded snapshot:   "a\nb"

An unchanged value therefore fails comparison, while an LF-only value can incorrectly pass.
Escape carriage returns in snapshot values and add CR/CRLF round-trip tests.

Regenerate affected snapshots with --test-update-snapshots.

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 15, 2026
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.22%. Comparing base (c1e2478) to head (d01b5a6).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66040      +/-   ##
==========================================
- Coverage   90.23%   90.22%   -0.01%     
==========================================
  Files         785      789       +4     
  Lines      269670   270614     +944     
  Branches    51589    51798     +209     
==========================================
+ Hits       243325   244150     +825     
- Misses      16825    16933     +108     
- Partials     9520     9531      +11     
Files with missing lines Coverage Δ
lib/internal/test_runner/snapshot.js 98.10% <100.00%> (+<0.01%) ⬆️

... and 56 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants