Skip to content

refactor(markdown_parser): deduplicate normalize_html test helper#9833

Merged
ematipico merged 2 commits intobiomejs:mainfrom
jfmcdowell:refactor/md-dedup-normalize-html
Apr 7, 2026
Merged

refactor(markdown_parser): deduplicate normalize_html test helper#9833
ematipico merged 2 commits intobiomejs:mainfrom
jfmcdowell:refactor/md-dedup-normalize-html

Conversation

@jfmcdowell
Copy link
Copy Markdown
Contributor

@jfmcdowell jfmcdowell commented Apr 6, 2026

Note

This PR was created with AI assistance (Claude Code).

Summary

Extracts the shared normalize_html test helper into tests/test_utils.rs. Both spec_test.rs and fuzz_differential.rs maintained identical local copies of this function, which could silently diverge if one is updated without the other.

Test Plan

  • just test-crate biome_markdown_parser — all 84 spec tests pass
  • just test-markdown-conformance — 652/652, 100% coverage, 0 panics

Docs

N/A

Extract shared `normalize_html` function into `tests/test_utils.rs`
and import from both `spec_test.rs` and `fuzz_differential.rs` to
prevent the two copies from silently diverging.
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 6, 2026

⚠️ No Changeset found

Latest commit: fd5f061

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added A-Parser Area: parser L-Markdown Language: Markdown labels Apr 6, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 6, 2026

Merging this PR will not alter performance

✅ 1 untouched benchmark
⏩ 255 skipped benchmarks1


Comparing jfmcdowell:refactor/md-dedup-normalize-html (fd5f061) with main (b6139b4)2

Open in CodSpeed

Footnotes

  1. 255 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (3cee636) during the generation of this report, so b6139b4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@github-actions github-actions bot added the A-Project Area: project label Apr 6, 2026
@jfmcdowell jfmcdowell marked this pull request as ready for review April 6, 2026 19:20
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 13fda33b-ebaa-4c50-98d4-f9290274e13d

📥 Commits

Reviewing files that changed from the base of the PR and between 3cee636 and fd5f061.

⛔ Files ignored due to path filters (1)
  • crates/biome_configuration/src/generated/linter_options_check.rs is excluded by !**/generated/**, !**/generated/** and included by **
📒 Files selected for processing (4)
  • crates/biome_markdown_parser/tests/fuzz_differential.rs
  • crates/biome_markdown_parser/tests/spec_test.rs
  • crates/biome_markdown_parser/tests/test_utils.rs
  • deny.toml

Walkthrough

The PR consolidates duplicate HTML normalisation logic from markdown parser test files into a centralised shared utility module. Two test files (fuzz_differential.rs and spec_test.rs) previously contained identical normalize_html implementations; these are now replaced with imports from a new test_utils.rs module. The normalisation function preserves whitespace within <pre> tags whilst trimming trailing whitespace elsewhere, then appends a final newline. A minor quote style adjustment in deny.toml rounds out the changes.

Possibly related PRs

Suggested reviewers

  • ematipico
  • dyc3
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: extracting a duplicated normalize_html function into a shared test utility module to prevent divergence.
Description check ✅ Passed The description clearly explains the refactoring effort, motivation (preventing silent divergence), testing approach, and results—all directly related to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@ematipico ematipico merged commit 8040ec2 into biomejs:main Apr 7, 2026
19 checks passed
@jfmcdowell jfmcdowell deleted the refactor/md-dedup-normalize-html branch April 13, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Parser Area: parser A-Project Area: project L-Markdown Language: Markdown

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants