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

[v10.x] Backport assert PRs #23095

Closed
wants to merge 3 commits into from
Closed

Commits on Sep 25, 2018

  1. assert: multiple improvements

    1) Switched + / - and red / green in diffs. It seems like that style
       is more natural to most people.
    
    2) Short primitives do not use the diff anymore. Especially short
       numbers can be read well like 1 !== 2. Cases that can not be
       displayed like that (e.g., -0 and +0) use the regular diff output.
    
    3) Improved error descriptions. It was not always clear what the
       messages stood for. That should now be resolved.
    
    4) Added a position indicator for single lines in case a tty is used
       and the line is shorter than the visual columns.
    
    5) Color detection is now done by checking stderr instead of stdout.
    
    PR-URL: nodejs#21628
    Reviewed-By: Michaël Zasso <targos@protonmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
    BridgeAR authored and oyyd committed Sep 25, 2018
    Configuration menu
    Copy the full SHA
    f75e969 View commit details
    Browse the repository at this point in the history
  2. assert: improve loose assertion message

    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 <jasnell@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    BridgeAR authored and oyyd committed Sep 25, 2018
    Configuration menu
    Copy the full SHA
    7f54071 View commit details
    Browse the repository at this point in the history
  3. assert: improve diff output

    The output is now a tiny bit improved by sorting object properties
    when inspecting the values that are compared with each other. That
    reduces the overall diff for identical objects with a different
    property insertion order.
    
    PR-URL: nodejs#22788
    Refs: nodejs#22763
    Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    BridgeAR authored and oyyd committed Sep 25, 2018
    Configuration menu
    Copy the full SHA
    1c429cf View commit details
    Browse the repository at this point in the history