jasmine / jasmine-gem

Jasmine ruby gem
682 stars 274 forks source link

Add the configuration option to show a full stack trace #236

Closed rrosenblum closed 9 years ago

rrosenblum commented 9 years ago

I want to add the ability to configure jasmine to show the full stack trace when running with phantomjs in the console. The short, 7 line, stack trace is not long enough to show information from files in your code. It only contains stack information from the jasmine framework.

Here is a basic example:

it('shows a stack trace', function() {
  var foo = true;
  var bar = false;

  expect(foo).toEqual(bar);
});

Console output:

jasmine server started.
F
          Jasmine__TopLevel__Suite shows a stack trace

          Expected true to equal false.
          Error: Expected true to equal false.
    at stack (http://localhost:8887/__jasmine__/jasmine.js:1439)
    at buildExpectationResult (http://localhost:8887/__jasmine__/jasmine.js:1416)
    at http://localhost:8887/__jasmine__/jasmine.js:533
    at http://localhost:8887/__jasmine__/jasmine.js:293
    at addExpectationResult (http://localhost:8887/__jasmine__/jasmine.js:477)
    at http://localhost:8887/__jasmine__/jasmine.js:1375
1 spec, 1 failure
slackersoft commented 9 years ago

This sounds like it would be a nice thing to have. I'd like to see the config object be injected into the Result instead of it groping out for the global config if possible though.

Thanks for using jasmine!

rrosenblum commented 9 years ago

I have made the change to use dependency injection for the configuration. Let me know what you think of the changes.