test: cover collecting a subtree of errors and grouping a nested anyOf - #218
Merged
alexander-akait merged 1 commit intoSep 8, 2026
Merged
Conversation
`codecov` reported the instance path index was only exercised by errors that share a path or have none in common, so the branch that walks into the children of a node and the comparator that puts the collected errors back in the order they were reported were never reached. An error arriving after the errors nested inside it covers both. The second test covers `groupChildrenByFirstChild` putting the errors of an inner `anyOf` under it, which is the path that `findAllChildren` was changed for. `src/validate.js` goes from 97.84% to 100% of lines, what is left are the guards for environments without `process` or `globalThis`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #218 +/- ##
==========================================
+ Coverage 95.36% 95.78% +0.42%
==========================================
Files 9 9
Lines 949 949
Branches 387 387
==========================================
+ Hits 905 909 +4
+ Misses 40 36 -4
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alexander-akait
deleted the
claude/filter-errors-quadratic-sibling-dos-1tqe2l
branch
September 8, 2026 09:04
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.
Follow up to #217, which merged before this landed.
codecovreported 5 lines of #217 without coverage. Four of them are in the instance path indexthat
filterErrorsuses above 24 errors: it was only exercised by errors that share an instancepath or have none in common, so the branch that walks into the children of a node and the comparator
that puts the collected errors back in the order they were reported were never reached.
An error that arrives after the errors nested inside it collects a whole subtree at once and covers
both - a value failing an
anyOfwhose object branch reports an error per property:The second test covers
groupChildrenByFirstChildputting the errors of an inneranyOfunder itrather than listing every branch flat, which is the path
findAllChildrenwas changed for in #217.src/validate.jsgoes from 97.84% to 100% of lines, statements and functions. What is left there isbranch coverage for the guards of environments without
processorglobalThis, which cannot betaken on the Node.js the tests run on.
Tests only, no source changes.
🤖 Generated with Claude Code
https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK
Generated by Claude Code