Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Patch for better stack traces #46

Closed
wants to merge 1 commit into from
@jrsacks

No longer rewriting the stack trace from jasmine.ExpectationResult which results in much more detailed stack traces.

@infews
Owner

Does the trace property come through in the reporter page?

I am running Jasmine using jasmine-node and am only looking at the spec results in the console. The only piece of the trace that had been showing up was in the Jasmine code rather than the trace through my code where the specs were failing.

@sconover

This is a big deal for us node folks, stack traces through jasmine are useless without this patch.

+1

@muhqu

+1 I have the same issue with jasmine-node.

@sconover

Hi pivotal could you please merge this?

@truelson

I have to pile on with this one as well. jasmine-node needs this patch. With this patch, jasmine-node becomes the PERFECT means to test javascript applications (like Titanium apps). And jasmine-node won't take this patch since it's a patch to the jasmine library itself.

@fabiomcosta

This should really go in, +1

@abierbaum

+1. This commit takes jasmine from being great to being awesome.

@timoxley

+1 Agreed

@sconover

+1000 PLEASE MERGE THIS, I'M BEGGING YOU

@alexch

+1 HULK SMASH PUNY STACK TRACE

@rafaelcaricio

+1, please!

@dcrec1

+1

@plentz

+1

@avelino

+1

@infews
Owner

To clarify - this provides more useful stack traces for Node. Understood. A little more digging and I found this: https://github.com/eriwen/javascript-stacktrace/blob/master/stacktrace.js which suggests that e.stack is available in Chrome and Firefox as well, though the acutal info is different. Safari and IE are (possibly) better served by the existing implementation (which remains in this patch).

@infews
Owner

Closing as a version of this is now on master.

@infews infews closed this
@timoxley

whoo thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 26, 2011
  1. Patch for better stack traces

    Jeff Sacks authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/jasmine.js
View
8 lib/jasmine.js
@@ -91,7 +91,10 @@ jasmine.ExpectationResult = function(params) {
this.actual = params.actual;
this.message = this.passed_ ? 'Passed.' : params.message;
- this.trace = this.passed_ ? '' : new Error(this.message);
+ this.trace = this.passed_ ? '' : params.trace;
+ if (!this.trace) {
+ this.trace = this.passed_ ? '' : new Error(this.message);
+ }
};
jasmine.ExpectationResult.prototype.toString = function () {
@@ -1962,7 +1965,8 @@ jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessag
jasmine.Spec.prototype.fail = function (e) {
var expectationResult = new jasmine.ExpectationResult({
passed: false,
- message: e ? jasmine.util.formatException(e) : 'Exception'
+ message: e ? jasmine.util.formatException(e) : 'Exception',
+ trace: {stack : e.stack}
});
this.results_.addResult(expectationResult);
};
Something went wrong with that request. Please try again.