Repository navigation
Description
Background: I'm using sourcemapped-stacktrace with jasmine 2.3.4 as suggested by https://gist.github.com/guncha/f45ceef6d483c384290a. After getting this set up, I was surprised to see that my coffeescript source lines - which are the ones I really care about - weren't being mapped at all. I wrote a simple example jasmine test to illustrate.
Here's a sample stack trace where i reproduced the problem:
"Error: Expected 5 to equal 4.
at stack (https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/external/jasmine/jasmine-vflDEVHASH.js:1201:27)
at buildExpectationResult (https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/external/jasmine/jasmine-vflDEVHASH.js:1176:20)
at Spec.expectationResultFactory (https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/external/jasmine/jasmine-vflDEVHASH.js:467:24)
at Spec.addExpectationResult (https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/external/jasmine/jasmine-vflDEVHASH.js:261:38)
at Expectation.addExpectationResult (https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/external/jasmine/jasmine-vflDEVHASH.js:428:29)
at Expectation.toEqual (https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/external/jasmine/jasmine-vflDEVHASH.js:1143:18)
at https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/tests/jasmine_tests/example-vflDEVHASH.js:5:24
at Object.arguments.(anonymous function) (https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/external/jasmine-promises-vflDEVHASH.js:71:47)
at attemptAsync (https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/external/jasmine/jasmine-vflDEVHASH.js:1501:32)
at QueueRunner.run (https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/external/jasmine/jasmine-vflDEVHASH.js:1456:17)"
In particular, the line at https://cf-servervm2.dev.corp.dropboxstatic.com/static/javascript/compiled/tests/jasmine_tests/example-vflDEVHASH.js:5:24 should be sourcemapped to a line in /static/coffee/tests/jasmine_tests/example.coffee. After debugging, I found that the regex chosen for Chrome (
| regex = /^ +at.+\((.*):([0-9]+):([0-9]+)/; |
example.coffee:
define [], ->
describe "example", ->
it "tries to test something", ->
expect(5).toEqual(4)
This repros for essentially all coffeescript files I've tried. It's worth noting, for those unfamiliar with coffeescript, that coffeescript tends to only use anonymous functions - not sure if that has something to do with it or not.
Activity
novocaine commentedon Jul 9, 2016
Hi,
Sorry to hear that it is not working for you.
The smst demo includes coffeescript: http://novocaine.github.io/sourcemapped-stacktrace-demo/public_html/smst.html
I'm not sure the regex itself is the problem, as this works for me:
Perhaps you could try to work out what is working correctly in the demo's coffeescript processing that isn't working for you?
Or put a jsfiddle or similar up reproducing the issue? Not sure how else I can help debug from afar.
dgoldstein0 commentedon Jul 9, 2016
That particular stack line - for the coffeescript file - has no parentheses
in it. I don't know how chrome decides to format it's stacks, but that's
what it gave me.
I guess I should check what version of chrome I'm using.
On Sat, Jul 9, 2016, 1:18 AM James Salter notifications@github.com wrote:
novocaine commentedon Jul 10, 2016
oh I see, your problem is with
but the other lines are fine. Sorry I didn't grok that. Okay, I guess we need to adjust the line parser. Do you get the same issue in firefox? Are you able to provide me with example-vflDEVHASH.js?
dgoldstein0 commentedon Jul 10, 2016
Right
On Sun, Jul 10, 2016, 9:33 AM James Salter notifications@github.com wrote:
novocaine commentedon Jul 25, 2016
Hey, sorry but I can't effectively fix this until you post the js source or the trace in firefox.
dgoldstein0 commentedon Aug 17, 2016
I actually didn't keep that original test case around, so here's a new one that should repro it:
/static/coffee/modules/example.test.coffee:
compiles to /static/javascript/compiled/modules/example.test.js:
sourcemap /static/javascript/compiled/modules/example.test.js.map:
When I run this under jasmine in Chrome, I get this stack trace:
And with Firefox I end up with a much longer stack trace with weirder issues:
in both cases the first line is not properly handled.