Skip to content

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
masterfrom
task-472-docs-package-has-no-test-runner
Open

test(docs): 472 — give the docs package a test runner, and fix the fenced-heading bug it found#105
randomdevpete wants to merge 1 commit into
masterfrom
task-472-docs-package-has-no-test-runner

Conversation

@randomdevpete

Copy link
Copy Markdown
Owner

Summary

Wire up vitest for the docs package (minimal config, no jsdom) so root npm test discovers and runs it. While writing the test suite, discovered a real bug: parseChangelogEntries tracked no fence state, so a release body showing an example ##/version-shaped line inside a md ``` 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:

  • A ## heading inside a fenced code block (the bug case)
  • semantic-release's linked heading format (## [2.5.0](<url>) (<date>))
  • An empty file
  • Content before the first heading

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.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant