test(docs): 472 — give the docs package a test runner, and fix the fenced-heading bug it found - #105
Open
randomdevpete wants to merge 1 commit into
Open
Conversation
Wire up vitest for packages/docs matching jarl-atoms/jarl-react's config (minimal, no jsdom), so root npm test discovers and runs the package's tests. While writing the test suite, discovered that parseChangelogEntries tracked no fence state: a release body showing an example ##/version-shaped line inside a ``` ```md ``` block was read as a real heading, truncating the entry or splitting it into two. Add fence tracking and skip heading detection while inside a fenced code block. Export parseChangelogEntries for unit tests to feed it fixtures directly rather than using the real CHANGELOG.md. Covers the required test cases: ## inside a fence, semantic-release's linked heading format, empty file, content before the first heading. Also exercises the real CHANGELOG.md for structural invariants that survive future semantic-release regeneration. Ticket: 472
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wire up vitest for the docs package (minimal config, no jsdom) so root
npm testdiscovers and runs it. While writing the test suite, discovered a real bug:parseChangelogEntriestracked no fence state, so a release body showing an example##/version-shaped line inside amd ``` block was read as a real heading. Added fence tracking and exported the parser for tests.Test coverage
The suite pins down four required cases:
##heading inside a fenced code block (the bug case)## [2.5.0](<url>) (<date>))Plus additional coverage for adjacent headings, non-version headings, and structural invariants on the real CHANGELOG.md that will survive future semantic-release regeneration (≥39 entries, semver versions, no duplicates).
All 12 tests pass. No CODING-STYLE.md violations.