A useful stack trace for Node etc -- a stab at issue #5 #39

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants

rhunter commented Dec 27, 2010

I've been using Jasmine with Node and CoffeeScript, and I've really wanted to see where my errors are.

With this change, any error raised by a Spec is kept and attached to the ExpectationResult. This changes the output dramatically. Compare the following two stack traces:

With this change:

  TypeError: number is not a function
    at Number.CALL_NON_FUNCTION (native)
    at Simulation.begin (lib/queuing-simulation.coffee:22:25)
    at [object Object].<anonymous> (spec/simulation_integration_spec.coffee:18:22)
    at [object Object].execute (vendor/jasmine/jasmine.js:972:15)
    at [object Object].next_ (vendor/jasmine/jasmine.js:1743:31)
    at [object Object].start (vendor/jasmine/jasmine.js:1696:8)
    at [object Object].execute (vendor/jasmine/jasmine.js:2023:14)
    at [object Object].next_ (vendor/jasmine/jasmine.js:1743:31)
    at [object Object].start (vendor/jasmine/jasmine.js:1696:8)
    at [object Object].execute (vendor/jasmine/jasmine.js:2168:14)

Before this change

  Error: TypeError: number is not a function
    at new <anonymous> (vendor/jasmine/jasmine.js:94:36)
    at [object Object].fail (vendor/jasmine/jasmine.js:1963:27)
    at [object Object].execute (vendor/jasmine/jasmine.js:970:15)
    at [object Object].next_ (vendor/jasmine/jasmine.js:1739:31)
    at [object Object].start (vendor/jasmine/jasmine.js:1692:8)
    at [object Object].execute (vendor/jasmine/jasmine.js:2018:14)
    at [object Object].next_ (vendor/jasmine/jasmine.js:1739:31)
    at [object Object].start (vendor/jasmine/jasmine.js:1692:8)
    at [object Object].execute (vendor/jasmine/jasmine.js:2163:14)
    at [object Object].next_ (vendor/jasmine/jasmine.js:1739:31)

(Apologies to anyone who gets this unnecessarily -- the README asked for pull requests to be sent only to the three maintainers, but I can't figure out how to change the recipient list.)

rhunter and others added some commits Dec 27, 2010

@rhunter rhunter Keep hold of errors as they happen so the stack traces stay useful
This is particularly useful on Node.js with CoffeeScript. You can
see the filename and line of the .coffee file with no translation.

Closes #5
bddd8bc
@Stanley Stanley + make sure we throw an object with a trace c5bc6dd

+1 can't happen soon enough :)

Contributor

infews commented Jun 2, 2011

Pulled a version of this into master.

infews closed this Jun 2, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment