Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

smaller, more configurable pretty-printing of objects, REBASED #290

merged 2 commits into from Oct 29, 2012
Commits on Oct 28, 2012
  1. When pretty-printing objects, don't include inherited properties.

    maxbrunsfeld committed Mar 5, 2012
    When making assertions about complex objects, Jasmine's
    failure message are sometimes gigantic and difficult
    to read because the string representation of an object
    contains all of the methods and properties in its
    prototype chain. This commit causes the pretty printer
    to only display on object's own properties.
  2. Allow users to set the pretty-printer's recursion depth

    maxbrunsfeld committed Mar 5, 2012
    Currently, jasmine's pretty printer traverses objects
    to 40 levels of nesting. If an object is more deeply
    nested than that, an exception is thrown. I find that
    after a few levels of nesting, the output becomes
    difficult to read. The process of serializing such
    deep objects also sometimes crashes the browser or
    causes a 'slow script' warning.
    This commit exposes a 'MAX_PRETTY_PRINT_DEPTH' option.
    It also causes the pretty printer to skip over
    parts of an object that are nested to deeply by simply
    printing out 'Object' or 'Array', rather than throwing
    an exception.