jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 243 forks source link

Coffeescript source maps / stacktraces #254

Closed markburns closed 10 years ago

markburns commented 10 years ago

Example output currently looks like this

screen shot 2014-08-05 at 19 24 10

or

screen shot 2014-08-05 at 19 25 31

Here's a list of things that would be nice to have in approximate order of ascending awesomeness

Are any of these things

Apologies if this is more like a bunch of issues. I figured I can start off a discussion and separate out as necessary. Also if you understand my thinking, which is that I love to get rapid feedback from tests and minimal distraction in mapping between test failures and editing code, then you might have alternative or better solutions to suggest. I didn't want to focus too much on implementation specifics if there's something else I could do instead.

jejacks0n commented 10 years ago

I was unaware that you could easily map coffeescript source lines to those of javascript.

This question comes up from time to time, but the honest truth is that it's actually hard to get the javascript exception stack trace reliably, and so I find it hard to believe what you propose is technically possible or feasible.

With that being said, we'd happily take a (clean and tested) pull request that has a simple prototype of what you're looking to accomplish.

So, for a first pass, I'd be interested in seeing your idea to extract the source code surrounding the file location of a failed spec, and an exception. You can start with the command line reporter, or the browser runner, either is fine.

markburns commented 10 years ago

I have no idea how easy it is, but if you mean that you were unaware of mapping, then you may be interested in looking at https://github.com/markbates/coffee-rails-source-maps I've found it an indispensable tool whilst debugging in the browser.

I'll have to defer to your experience on the matter about reliable stacktraces, that being said, I still think there's a benefit to having the source code around them (and file links) for when the stacktrace is correct. But perhaps I've misunderstood your point here.

I've not looked into source code mapping or any of the other things at all yet, but will take a look into your suggestion.

markburns commented 10 years ago

@jejacks0n - not sure how github mentions work, so apologies if you've already seen my mention at https://github.com/markburns/teaspoon/pull/1 - anyway, I've proved the feasibility of extracting source code from an exception. I've not done a pull request here, as it's not worthy yet and more of an exploratory proof of concept.

I've got a couple of questions over there, that I wouldn't mind you taking a look at.

jejacks0n commented 10 years ago

Awesome! No, I haven't had time to look, but I've got a reminder. Will try to look at it this weekend or next week. Impressive effort from a glance though, so thumbs up.


Jeremy Jackson

On Aug 14, 2014, at 11:55 PM, Mark Burns notifications@github.com wrote:

@jejacks0n - not sure how github mentions work, so apologies if you've already seen my mention at markburns#1 - anyway, I've proved the feasibility of extracting source code from an exception. I've not done a pull request here, as it's not worthy yet and more of an exploratory proof of concept.

I've got a couple of questions over there, that I wouldn't mind you taking a look at.

— Reply to this email directly or view it on GitHub.