Skip to content

test: add regression tests for $ tokens without math plugin (#136) - #615

Merged
farnabaz merged 1 commit into
mainfrom
pr-pov/add-regression-tests-for-tokens-without-d18f
Nov 18, 2026
Merged

farnabaz merged 1 commit into
mainfrom
pr-pov/add-regression-tests-for-tokens-without-d18f

Conversation

@farnabaz

@farnabaz farnabaz commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

The auto-close bug from #136 (a trailing $skill-name treated as an unclosed inline math opener, producing $skill-name$) was fixed in #394 (v0.7.0): math auto-close now only runs when the math plugin is registered. These tests lock that fix in place. No source changes.

  • test/auto-close.test.ts: autoCloseMarkdown with default options leaves the reporter's three inputs unchanged.
  • test/math.test.ts: end-to-end through parseMarkdown/renderMarkdown. Without the math plugin, the inputs parse to plain text or a link with $imagegen text and the correct href, and render back to the source. With math(), a trailing Value $x is still auto-closed into inline math. This checks the math: hasPlugin('math') wiring in index.ts in both directions.

Closes #136

Summary by CodeRabbit

  • Tests
    • Added coverage confirming dollar-prefixed text and dollar signs in links remain unchanged when math handling is disabled.
    • Added coverage for rendering an unclosed inline math expression with a closing dollar delimiter when math handling is enabled.

The auto-close bug from #136 (a trailing `$skill-name` treated as an unclosed inline math opener, producing `$skill-name$`) was fixed in #394 (v0.7.0): math auto-close now only runs when the math plugin is registered. These tests lock that fix in place. No source changes.

- `test/auto-close.test.ts`: `autoCloseMarkdown` with default options leaves the reporter's three inputs unchanged.
- `test/math.test.ts`: end-to-end through `parseMarkdown`/`renderMarkdown`. Without the math plugin, the inputs parse to plain text or a link with `$imagegen` text and the correct href, and render back to the source. With `math()`, a trailing `Value $x` is still auto-closed into inline math. This checks the `math: hasPlugin('math')` wiring in `index.ts` in both directions.

Closes #136
@farnabaz
farnabaz marked this pull request as ready for review November 18, 2026 19:00
@coldtea-pr-lens

Copy link
Copy Markdown

Note

The title starts with test:, so PR Lens left this pull request undrawn. Comment @pr-lens draw to draw it

github.comment.notice: false in .github/pr-lens.yml turns this note off

@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
comark Ready Ready Preview Nov 18, 2026 7:03pm UTC
comark-binding Ready Ready Preview Nov 18, 2026 7:03pm UTC
comark-json-render Ready Ready Preview Nov 18, 2026 7:03pm UTC
comark-nextjs Ready Ready Preview Nov 18, 2026 7:03pm UTC
comark-nuxt Ready Ready Preview Nov 18, 2026 7:03pm UTC
comark-svelte Ready Ready Preview Nov 18, 2026 7:03pm UTC
comark-sveltekit Ready Ready Preview Nov 18, 2026 7:03pm UTC
comark-twoslash Ready Ready Preview Nov 18, 2026 7:03pm UTC
comark-vue Ready Ready Preview Nov 18, 2026 7:03pm UTC

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request adds regression tests for dollar-prefixed tokens and links without math handling, and for parsing and rendering an unclosed inline-math delimiter when the math plugin is enabled.

Changes: Dollar-prefixed Markdown tests

Layer / File(s) Summary
Dollar-prefixed text and math tests
packages/comark/test/auto-close.test.ts, packages/comark/test/math.test.ts
The tests check that dollar-prefixed tokens remain unchanged without math handling. They also check that an unclosed inline-math delimiter parses and renders with the math plugin enabled.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: atinux, onmax

Merge Risk: Minimal · up to 55f94

This change only adds tests for dollar-prefixed text and inline math, so it does not affect runtime behavior. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title says the PR adds regression tests for $ tokens without the math plugin, referencing #136. The changeset adds only test code in packages/comark/test (auto-close.test.ts and math.test.ts), w…
Linked Issues check Passed Issue #136 is the only active direct link. Its coding requirement is that $skill-name and [$imagegen](path) render as plain text or links, without broken output. The PR adds only tests and no sour…
Out of Scope Changes check Passed All changes are test additions in packages/comark/test/math.test.ts and packages/comark/test/auto-close.test.ts. Both target the $-prefixed token and auto-close behavior described in #136. No so…
Full details: Title check

Explanation

The title says the PR adds regression tests for $ tokens without the math plugin, referencing #136. The changeset adds only test code in packages/comark/test (auto-close.test.ts and math.test.ts), which covers dollar-prefixed tokens such as $skill-name and $imagegen with and without the math plugin. No source code changes are present, and the objectives confirm this is a tests-only PR. The title names the main change accurately and specifically.

Full details: Linked Issues check

Explanation

Issue #136 is the only active direct link. Its coding requirement is that $skill-name and [$imagegen](path) render as plain text or links, without broken output. The PR adds only tests and no source changes. In packages/comark/test/math.test.ts, the new describe block (#136) asserts for parsing without the math plugin: $skill-name yields ['p', {}, '$skill-name'] and renders back to the source; [$imagegen](href) yields a link with text $imagegen and renders back to the source; and Codex uses [$imagegen](href) and $skill-name. keeps the link and the trailing text intact. The source wiring that enables this exists at the reviewed head. In packages/comark/src/index.ts, math: hasPlugin('math') gates math auto-close, and math is registered only when the plugin is present. The test Value $x with math() checks the opposite direction. The auto-close test diff (packages/comark/test/auto-close.test.ts) could not be read because changed blobs were unavailable, so its contents rest on the supplied summary only. The math tests alone cover the stated behavior. The tests were not executed, so pass status depends on the assertions being correct against the existing implementation.

Full details: Out of Scope Changes check

Explanation

All changes are test additions in packages/comark/test/math.test.ts and packages/comark/test/auto-close.test.ts. Both target the $-prefixed token and auto-close behavior described in #136. No source, configuration, or documentation files are changed according to the PR summary. The auto-close test file content was not directly readable, so its scope relies on the supplied summary, which states it covers the same #136 cases.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0cd115c4-85bc-4b37-b00f-21540e5e5c81
Commits

Reviewing files that changed from the base of the PR and between a3cbfba and 55f94ee.

Files selected for processing: 2

  • packages/comark/test/auto-close.test.ts
  • packages/comark/test/math.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@pkg-pr-new

pkg-pr-new Bot commented Nov 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark

npm i https://pkg.pr.new/comark@615

@comark/angular

npm i https://pkg.pr.new/@comark/angular@615

@comark/ansi

npm i https://pkg.pr.new/@comark/ansi@615

@comark/html

npm i https://pkg.pr.new/@comark/html@615

@comark/nuxt

npm i https://pkg.pr.new/@comark/nuxt@615

@comark/react

npm i https://pkg.pr.new/@comark/react@615

@comark/svelte

npm i https://pkg.pr.new/@comark/svelte@615

@comark/vue

npm i https://pkg.pr.new/@comark/vue@615

commit: 55f94ee

@codspeed

codspeed Bot commented Nov 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 44 untouched benchmarks


Comparing pr-pov/add-regression-tests-for-tokens-without-d18f (55f94ee) with main (a3cbfba)

Open in CodSpeed

@farnabaz
farnabaz merged commit a320fbf into main Nov 18, 2026
18 checks passed
@farnabaz
farnabaz deleted the pr-pov/add-regression-tests-for-tokens-without-d18f branch November 18, 2026 19:20
@github-actions github-actions Bot mentioned this pull request Nov 18, 2026

This branch was successfully deployed

8 active deployments
Preview – comark-nuxt — 55f94ee1 Deployed Nov 18, 2026 by vercel[bot]
Preview – comark-sveltekit — 55f94ee1 Deployed Nov 18, 2026 by vercel[bot]
Preview – comark-nextjs — 55f94ee1 Deployed Nov 18, 2026 by vercel[bot]
Preview – comark-twoslash — 55f94ee1 Deployed Nov 18, 2026 by vercel[bot]
Preview – comark-vue — 55f94ee1 Deployed Nov 18, 2026 by vercel[bot]
Preview – comark-json-render — 55f94ee1 Deployed Nov 18, 2026 by vercel[bot]
Preview – comark-svelte — 55f94ee1 Deployed Nov 18, 2026 by vercel[bot]
Preview – comark-binding — 55f94ee1 Deployed Nov 18, 2026 by vercel[bot]
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.

Markdown rendering is broken for special patterns like [$imagegen](...) and $skill-name

1 participant