fix(tests): prevent v8 coverage segfault on large codebase#877
Merged
mikolalysenko merged 2 commits intomainfrom Nov 5, 2025
Merged
fix(tests): prevent v8 coverage segfault on large codebase#877mikolalysenko merged 2 commits intomainfrom
mikolalysenko merged 2 commits intomainfrom
Conversation
5cfcfda to
d9d6f85
Compare
Fixes segmentation fault when running `pnpm cover` by adding memory management and processing concurrency options. Changes: - Hoist logger to module scope in cover.mjs to fix ReferenceError - Use NODE_OPTIONS with --max-old-space-size=8192 for vitest coverage - Add processingConcurrency: 1 to vitest config to prevent v8 crashes - Add reportOnFailure: true and explicit reportsDirectory The segfault occurred because v8 coverage was processing too much data at once without sufficient memory. These changes allow the coverage command to complete successfully with 2,255 tests and 196 test files. Test Results: - 196 test files passed - 2,255 tests passed, 2 skipped - Type Coverage: 98.16% - Code Coverage: 37.17% - Cumulative: 67.66%
Updates coverage badges to reflect actual test results: - Code Coverage: 37.17% (yellow badge) - Type Coverage: 98.16% (green badge) Based on test run with: - 196 test files passed - 2,255 tests passed (2 skipped) - Duration: 11.91s
d9d6f85 to
8767731
Compare
mikolalysenko
approved these changes
Nov 5, 2025
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
Fixes segmentation fault when running
pnpm coverby implementing memory management and processing concurrency options for v8 coverage on our large test suite.Requires #875.
Changes
1. Logger Hoisting (
scripts/cover.mjs)const logger = getDefaultLogger()to module scope2. Memory Management (
package.json)test:unit:coveragescript to useNODE_OPTIONSenvironment variable--max-old-space-size=8192to increase Node.js heap memory limit3. V8 Coverage Configuration (
vitest.config.mts)processingConcurrency: 1to prevent parallel processing overloadreportOnFailure: truefor better error reportingreportsDirectory: './coverage'path4. Updated Coverage Badges (
README.md)Problem
The v8 coverage provider was segfaulting with
SIGSEGVwhen processing our test suite:Root Cause
V8 coverage was attempting to process too much data simultaneously without sufficient memory allocation, causing the Node.js process to crash with a segmentation fault.
Solution
processingConcurrency: 1)Test Results
✓ Coverage now completes successfully:
Related
This fix enables reliable coverage reporting for our large test suite and unblocks future coverage tracking improvements.