Add Istanbul coverage checking to jest test runner#2283
Merged
hiroshinishio merged 1 commit intomainfrom Feb 19, 2026
Merged
Conversation
When impl_file_to_collect_coverage_from is set, run jest/vitest with Istanbul (babel/istanbul) instead of V8 for accurate single-file branch coverage. Parse coverage-final.json and surface uncovered statements, branches, functions, and lines. Also add target parameter to create_comment for issue vs PR commenting, move CREATE_COMMENT tool definition to create_comment.py, and add pull_number to BaseArgs for PR-targeted comments.
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.
Summary
run_jest_test- V8 inflates branch counts in single-file mode, Istanbul gives consistent AST-based resultscoverage-final.jsonand report uncovered statements, branches, functions, and lines back to the agent so it can fix gapstarget: Literal["issue", "pr"]tocreate_commentand moveCREATE_COMMENTtool definition tocreate_comment.pyformat_coverage_commentpull_numbertoBaseArgsfor PR-targeted comments fromverify_task_is_completeSocial Media Post (GitAuto)
When we asked our agent to write tests for uncovered branches, it ran them, they passed, and it called it done. But the tests didn't actually cover the target branches. V8's coverage inflates numbers in single-file mode. Switched to Istanbul's AST-based instrumentation. Now we parse the real coverage JSON and tell the agent exactly which lines and branches it missed.
Social Media Post (Wes)
Tests passed but coverage didn't improve. V8 counts branches differently when running a single test file vs the full suite. Istanbul doesn't have this problem - it instruments the AST directly. Now the agent gets a coverage report with specific uncovered lines after each test run. All green isn't enough if the target branches are still uncovered.