-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
assert: show the diff when deep comparing data with a custom message #54759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assert: show the diff when deep comparing data with a custom message #54759
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #54759 +/- ##
=======================================
Coverage 87.60% 87.61%
=======================================
Files 650 650
Lines 182829 182836 +7
Branches 35379 35381 +2
=======================================
+ Hits 160173 160185 +12
+ Misses 15928 15926 -2
+ Partials 6728 6725 -3
|
89cb67f to
0d996bc
Compare
|
@redyetidev, do you think we should tag someone or ask for a review from the assert/test group? Edit: Maybe @MoLow would be interested in reviewing this (I saw this #48465 (comment)) |
MoLow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM
|
CC @nodejs/assert |
|
Any news on this? is this ready to land? |
This comment was marked as outdated.
This comment was marked as outdated.
|
The PR is ready but the CI is flaky |
|
Landed in e1d8b4f |
|
The related commit introduces an issue when the const error = new AssertionError({
message: `Expected prompt validation message to equal ${inspect(message)}`,
expected: message,
operator: 'strictEqual',
})Throwing the above error object after some async operation. const result = await someAsyncOperation()
error.actual = result
if (error.expected !== error.actual) {
throw error
}In the above case, the |
|
On the side note: There should be a way to disable generating diffs for cases where I want to use a specific library to generate custom diffs |
Fixes: #48465
This PR allows some assertion methods to show the diff when 2 data are different and a custom error message is passed
From this:
To this: