pivotal/jasmine-gem — pull request #140 by dimacus (2013-03-08 21:32:45+00:00)
Title: Adding Jasmine-Parser gem to generate JS stack trace in Rspec

Hey guys,

Finally got some stuff together, think of this as a preview commit because i'm looking for your feedback on how to make this better. But here it goes.

I notice that stack traces in files were not supported at all in rspec, and especially on IE. So, to solve this issue, I've made a small gem that parses all of the spec files and creates a stack trace, which later gets injected into rspec's stack trace for a failure.

Here is what it looks like now on 2 tests, which I force to fail http://i.imgur.com/f7Bvjhv.jpg
![1 bash-1](https://f.cloud.github.com/assets/90026/238429/aa3d39cc-8837-11e2-96ca-13caab2c622a.jpg)

Couple of notes on the gem

1)	My next goal is to improve the performance of the parsing. Rkelly is not the fastest JS parser I know : ( However, making the parser go through the spec files while we wait for the browser tests to finish does save a lot of time. 3,700 tests take about 2 mins to parse, and only chrome which takes 2 mins to run has to wait on the parser
2)	This gem works pretty well in tracking down shared examples across many files and almost infinitely nested shared examples. I still have some work to do to make it recognize every way a shared example can be declared, but so far out of 3700 examples, parser cannot track down only about 300
3)	This was extensively tested on Rspec1 I need more help testing rspec 2
4)	Works like a charm on windows!!!!
5)	I’m horribly unhappy with how I’m inserting the JS stack trace into the Rspec’s backtrace… please please please let me know there is a better way
6)	I’ve tried to make this gem insert itself into jasmine as painlessly as possible, and tried to make it fail in a non-destructive way as possible.
7)	I need to add a couple of tests which make sure the failing tests are showing up in console properly. Any pointers on that are appreciated
8)	Sorry for 3 commits, my git hiccupped and forced me to do a merge… I’ll collapse it into a single commit after you give me some feedback.

Parser source code lives here: https://github.com/groupon/jasmine-parser
I’ll continue working on it, to make it better.

Finally, my hope is to use this gem to add future feature to jasmine, where user can run a single test or a folder. This way the full suite does not need to be loaded into the browser… my hope is to make it a little closer to rspec behavior

… jasmine… foo/bar_spec.js:13