Skip to content

test(theme): use raw string serializer for markdown snapshots - #238

Merged
avivkeller merged 1 commit into
webpack:mainfrom
moshams272:chore/readable-snapshots
Aug 11, 2026
Merged

test(theme): use raw string serializer for markdown snapshots#238
avivkeller merged 1 commit into
webpack:mainfrom
moshams272:chore/readable-snapshots

Conversation

@moshams272

@moshams272 moshams272 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

Improves Developer Experience (DX) by making generated markdown snapshots human-readable.

Details

By default, the node:test snapshot serializes strings by escaping \n. Because of this, the entire markdown output is compressed into a single line. When a snapshot test fails, the resulting line-diff is big and hard to read, looking like this:

image

By overriding the default serializer with (val) => val, we prevent this escaping behavior. The snapshots are now saved as raw multi-line strings. Now, when a test fails, the diff correctly highlights only the specific lines that changed, looking like this:

image

Summary by CodeRabbit

  • Tests
    • Updated snapshot comparisons to use consistent Markdown serialization.
    • Reformatted expected documentation output for improved readability while preserving the documented content.

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webpack-doc-kit Ready Ready Preview Aug 10, 2026 11:29pm

Request Review

@github-actions github-actions Bot added the tests Pull requests that update tests label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The theme snapshot test now passes an explicit identity serializer to the snapshot assertion. The expected TypeDoc output changed from an escaped single-line string to a multiline template literal. The rendered Markdown content, documented entities, annotations, examples, overloads, and types remain unchanged.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the raw string serializer change for theme Markdown snapshots.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@avivkeller
avivkeller merged commit f449367 into webpack:main Aug 11, 2026
12 checks passed
@moshams272
moshams272 deleted the chore/readable-snapshots branch August 11, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Pull requests that update tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants