pivotal/jasmine — pull request #196 by maxbrunsfeld (2012-03-05 01:59:59+00:00)
Title: smaller, more configurable pretty-printing of objects

This includes two changes to the pretty printer:

1. There's a new constant `jasmine.MAX_PRETTY_PRINT_DEPTH`, which controls how deeply the pretty-printer will recurse when stringifying an object. The depth was previously hard-coded to 40. When the limit is reached, rather than throwing an exception, the pretty printer will simply emit `Object` or `Array`. This allows you to set the recursion depth lower without breaking your tests. Personally I find that after a few levels of depth, the readability of the output decreases, so I would set MAX_PRETTY_PRINT_DEPTH to 4 or 5. Other people might want to leave it at 40 to see the entire structure.

2. When stringifying an object, the pretty-printer will now skip over its inherited properties. This one might be controversial. We hacked it in on our project because when one of our Backbone-derived model objects got printed out, the number of prototypal methods that was included made it hard to discern much about the actual object. I think the fact that the pretty-printer currently *includes* these properties is responsible for most of the too-long-to-read messages that jasmine produces.

Curious what you guys think of #2.