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: improve loose assertion message #22155

Closed

Conversation

BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Aug 6, 2018

So far the error message from a loose assertion is not always very
informative and could be misleading. This is fixed by:

  • showing more from the actual error message
  • having a better error description
  • not using custom inspection
  • inspecting a higher depth
  • inspecting the full array instead of up to 100 entries
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

So far the error message from a loose assertion is not always very
informative and could be misleading. This is fixed by:

* showing more from the actual error message
* having a better error description
* not using custom inspection
* inspecting a higher depth
* inspecting the full array instead of up to 100 entries
@nodejs-github-bot nodejs-github-bot added the assert Issues and PRs related to the assert subsystem. label Aug 6, 2018
@BridgeAR
Copy link
Member Author

BridgeAR commented Aug 6, 2018

@mcollina
Copy link
Member

mcollina commented Aug 8, 2018

Code LGTM. But isn't assert.deepEqual  deprecated?https://nodejs.org/api/assert.html#assert_assert_deepequal_actual_expected_message

Is this something we need?

@BridgeAR
Copy link
Member Author

BridgeAR commented Aug 9, 2018

@mcollina it is doc deprecated but the problem is that it is still used relatively often. It is also not likely or currently intended to change the doc deprecation to a runtime deprecation. This is mainly a hot fix for some of the issues that the old version has for the case that people still use that.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 9, 2018
BridgeAR added a commit to BridgeAR/node that referenced this pull request Aug 9, 2018
So far the error message from a loose assertion is not always very
informative and could be misleading. This is fixed by:

* showing more from the actual error message
* having a better error description
* not using custom inspection
* inspecting a higher depth
* inspecting the full array instead of up to 100 entries

PR-URL: nodejs#22155
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@BridgeAR
Copy link
Member Author

BridgeAR commented Aug 9, 2018

Landed in 1d859ef

@rvagg
Copy link
Member

rvagg commented Aug 13, 2018

@BridgeAR if this isn't semver-major (is it?) would you mind backporting to v10.x-staging please? There's a bit too much churn in there for this to apply nicely.

@targos targos removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 19, 2018
@targos
Copy link
Member

targos commented Aug 19, 2018

Ping @BridgeAR

1 similar comment
@targos
Copy link
Member

targos commented Aug 29, 2018

Ping @BridgeAR

@targos
Copy link
Member

targos commented Sep 2, 2018

Ping

oyyd pushed a commit to oyyd/node that referenced this pull request Sep 25, 2018
So far the error message from a loose assertion is not always very
informative and could be misleading. This is fixed by:

* showing more from the actual error message
* having a better error description
* not using custom inspection
* inspecting a higher depth
* inspecting the full array instead of up to 100 entries

PR-URL: nodejs#22155
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@oyyd oyyd mentioned this pull request Sep 26, 2018
2 tasks
@BridgeAR
Copy link
Member Author

BridgeAR commented Oct 2, 2018

This relies on a semver-major change and should not be backported.

@BridgeAR BridgeAR deleted the improve-loose-assert-message branch January 20, 2020 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert Issues and PRs related to the assert subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants