Skip to content
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: fix deepStrictEqual on errors when cause is present #55406

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

geeksilva97
Copy link
Contributor

@geeksilva97 geeksilva97 commented Oct 16, 2024

Refs #55310
Fixes #55310

This PR fixes AssertionError reporting when cause is present.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Oct 16, 2024
@RedYetiDev RedYetiDev added the wip Issues and PRs that are still a work in progress. label Oct 16, 2024
@geeksilva97 geeksilva97 changed the title assert: fix deepStrictEqual on errors assert: fix deepStrictEqual on errors when cause is present Oct 19, 2024
@geeksilva97 geeksilva97 marked this pull request as ready for review October 19, 2024 19:41
@geeksilva97
Copy link
Contributor Author

geeksilva97 commented Oct 19, 2024

I tried to follow your suggestion @BridgeAR but doing that after inspection would turn expect and actual into strings which would make the process of removing stack frames, at least for me, complex.

Copy link

codecov bot commented Oct 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.43%. Comparing base (5633c62) to head (5ac53d2).
Report is 201 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55406      +/-   ##
==========================================
+ Coverage   87.93%   88.43%   +0.50%     
==========================================
  Files         654      654              
  Lines      187686   187697      +11     
  Branches    35819    36131     +312     
==========================================
+ Hits       165038   165991     +953     
+ Misses      15849    14946     -903     
+ Partials     6799     6760      -39     
Files with missing lines Coverage Δ
lib/internal/assert/assertion_error.js 95.27% <100.00%> (+0.13%) ⬆️

... and 89 files with indirect coverage changes

@geeksilva97 geeksilva97 force-pushed the issue-55310 branch 2 times, most recently from 80509ca to 055d6a6 Compare October 20, 2024 23:32
@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Oct 22, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 22, 2024
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for addressing this!

I just left a suggestion to match some further error types. Could you please also change the instanceof Error in the original call site? That way it's coherent.

lib/internal/assert/assertion_error.js Outdated Show resolved Hide resolved
lib/internal/assert/assertion_error.js Outdated Show resolved Hide resolved
@marco-ippolito marco-ippolito added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 28, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 28, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@RedYetiDev RedYetiDev removed the wip Issues and PRs that are still a work in progress. label Nov 5, 2024
@aduh95 aduh95 merged commit 4da8d11 into nodejs:main Nov 5, 2024
55 checks passed
@aduh95
Copy link
Contributor

aduh95 commented Nov 5, 2024

Landed in 4da8d11

aduh95 pushed a commit that referenced this pull request Nov 6, 2024
PR-URL: #55406
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
aduh95 pushed a commit that referenced this pull request Nov 6, 2024
PR-URL: #55406
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
tpoisseau pushed a commit to tpoisseau/node that referenced this pull request Nov 21, 2024
PR-URL: nodejs#55406
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@ruyadorno
Copy link
Member

This commit does not land cleanly on v22.x-staging and will need manual backport in case we want it in v22.x.

@ruyadorno ruyadorno added the backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. label Nov 27, 2024
aduh95 pushed a commit that referenced this pull request Nov 27, 2024
PR-URL: #55406
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@aduh95 aduh95 added backported-to-v22.x PRs backported to the v22.x-staging branch. and removed backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. labels Nov 27, 2024
@geeksilva97
Copy link
Contributor Author

geeksilva97 commented Nov 27, 2024

I can do that, folks.

EDIT: By the tags, it looks like @aduh95 backported it.

ruyadorno pushed a commit that referenced this pull request Nov 27, 2024
PR-URL: #55406
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backported-to-v22.x PRs backported to the v22.x-staging branch. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odd assertion error message when deep equality failed due to Error.cause
9 participants