assert: avoid expensive diff for large values#62798
Open
semimikoh wants to merge 1 commit intonodejs:mainfrom
Open
assert: avoid expensive diff for large values#62798semimikoh wants to merge 1 commit intonodejs:mainfrom
semimikoh wants to merge 1 commit intonodejs:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62798 +/- ##
==========================================
- Coverage 91.55% 89.68% -1.87%
==========================================
Files 355 706 +351
Lines 149381 218286 +68905
Branches 23364 41790 +18426
==========================================
+ Hits 136765 195779 +59014
- Misses 12354 14408 +2054
- Partials 262 8099 +7837
🚀 New features to boost your workflow:
|
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.
This limits the input size used for simple assertion diffs.
When an assertion fails for large inspected values, such as
assert.strictEqual(Buffer.alloc(n), [buffer]),AssertionErrorcurrentlyruns the full line-based Myers diff over the inspected output. For large
Buffers this can make the failure path much slower than linear even though the
values are trivially different.
This change keeps the existing rich diff behavior for smaller values, but skips
the Myers diff for very large inspected outputs in the default
simplediffmode. In that case, the error message includes a truncated representation of
both sides and marks skipped lines instead.
diff: 'full'remains available for callers that explicitly request the fulldiff.
Refs: #62792
Test
test/parallel/test-assert-deep.js16.0, while this tree requires a newer macOS toolchain. Local build fails in
V8 because
std::atomic_refis unavailable.