Skip to content

chore(deps-dev): Migrate to vitest 4 and fix what it surfaced - #7

Merged
korya merged 1 commit into
masterfrom
chore-vitest-4
Sep 2, 2026
Merged

chore(deps-dev): Migrate to vitest 4 and fix what it surfaced#7
korya merged 1 commit into
masterfrom
chore-vitest-4

Conversation

@korya

@korya korya commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Supersedes #5 and #3, which cannot pass individually: vitest and @vitest/coverage-v8 are peer-locked, so each PR fails npm ci on the other half of the upgrade. This does both at once.

vitest 4 remaps coverage from the AST, and that stricter accounting exposed three genuine problems hiding behind the previously-green 100%:

A literal NUL byte in src/engine/run.ts, where a space separator was intended in the dedup key .join(...). git and grep treat the file as binary and silently skip it, which is also why an earlier refactor of that same function silently never applied. It is now an explicit unicode escape, with a comment on why that separator was chosen.

A dead branch in mergeAcrossDialects. The duplicate-dialect check could never be false. A Set expresses the intent directly and removes the branch.

Dead code in parse.ts. YAMLError.pos is declared required by the yaml package, so the optional chain and its undefined guard were unreachable; removed. The genuinely optional node.range guard keeps its ignore hint, moved to the block form that AST-aware remapping honors.

On the empty coverage table

vitest 4 omits fully-covered files from the text table, printing only the summary. That looks alarmingly like a disabled gate, so I verified it rather than assuming: adding an uncovered function makes the file reappear in the table, the thresholds ERROR, and npm test exits 1. Restoring it returns exit 0. The gate still bites.

Full check green: 90 tests, 100% statements / branches / functions / lines, plus build and a CLI smoke run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RoMv1uCaJQPs44rFX5XWEm

vitest and @vitest/coverage-v8 are peer-locked, so Dependabot's split
PRs each failed npm ci on the other's half; this does both at once.
vitest 4 remaps coverage from the AST, and that stricter accounting
exposed three real problems behind the previously-green 100%:

- src/engine/run.ts held a literal NUL byte where a space separator was
  intended. git and grep treated the file as binary and silently skipped
  it, which is also why an earlier refactor of that function never
  applied. The separator is now an explicit escape with a comment.
- mergeAcrossDialects kept a duplicate-check branch no input can reach;
  a Set expresses the intent and drops the branch.
- parse.ts guarded firstError.pos, which yaml declares required, so the
  optional chain and its guard were dead code. The genuinely optional
  node.range guard keeps its ignore hint, now in block form, which is
  what AST-aware remapping honors.

The empty per-file coverage table under vitest 4 is the reporter hiding
fully-covered files, not a disabled gate: verified by adding uncovered
code and watching the thresholds fail with exit 1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RoMv1uCaJQPs44rFX5XWEm
@korya
korya merged commit 0bb672f into master Sep 2, 2026
1 check passed
@korya
korya deleted the chore-vitest-4 branch September 2, 2026 13:27
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