Skip to content

test(graphFormats): cover fromMermaid parser error paths#171

Merged
mellonis merged 1 commit into
v7from
chore/coverage-bump-v7
May 20, 2026
Merged

test(graphFormats): cover fromMermaid parser error paths#171
mellonis merged 1 commit into
v7from
chore/coverage-bump-v7

Conversation

@mellonis

Copy link
Copy Markdown
Owner

Summary

Three new tests in the existing fromMermaid error paths describe block, covering parser-error branches added during the v7 emit overhaul that were never exercised:

  • Read label with no bracketed list (graphFormats.ts:379)
  • Write/move cell-count mismatch (graphFormats.ts:396)
  • Backslash-escape branch in stripBrackets (graphFormats.ts:355-356)

Why

Coveralls reported a coverage drop on PR #167 (v7 β†’ master draft) after v7-alpha.1's emit overhaul landed. The new parser error paths were live but untested β€” locally clean (above the 97/90/95/97 floors in vitest.config.ts), but enough of a delta vs. master that Coveralls' no-drop check failed.

Coverage delta

Metric Before After Ξ”
Statements 98.29% 98.72% +0.43
Branches 95.35% 96.13% +0.78
Functions 100% 100% β€”
graphFormats.ts stmts 96.42% 98.8% +2.38
graphFormats.ts branches 90.62% 94.79% +4.17

What's NOT covered

Remaining uncovered branches in v7 code are defensive fallbacks not worth synthetic tests:

  • graph.ts:173, 209 β€” fallback returns in parsePatternString / parseWriteSymbolLabel for malformed inputs
  • State.ts:463-464 β€” catch for unbound Reference.ref throw during toGraph walk
  • introspection.ts:121 β€” if (node) guard in cycle detection

Test plan

  • npm test β€” all tests pass (425/425, +3)
  • npm run test:coverage β€” numbers above
  • npm run lint β€” clean
  • npm run typecheck β€” clean

Three new tests in the existing `fromMermaid error paths` block:

- Read label with no bracketed list (graphFormats.ts:379)
- Write/move cell-count mismatch (graphFormats.ts:396)
- Backslash-escape branch in `stripBrackets` (graphFormats.ts:355-356)

Coverage: statements 98.29 β†’ 98.72 (+0.43),
branches 95.35 β†’ 96.13 (+0.78), graphFormats.ts 96.42/90.62 β†’
98.8/94.79.

Addresses the Coveralls "coverage fell" status on PR #167 (v7 β†’ master
draft) after v7-alpha.1 work landed. Remaining uncovered branches in
v7 code are defensive fallbacks (graph.ts:173/209, State.ts:463-464,
introspection.ts:121) β€” not worth synthetic tests.
@mellonis mellonis merged commit b07d775 into v7 May 20, 2026
1 check passed
@mellonis mellonis deleted the chore/coverage-bump-v7 branch May 20, 2026 21:29
@github-project-automation github-project-automation Bot moved this from Todo to Done in @mellonis's machines May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant