-
Notifications
You must be signed in to change notification settings - Fork 43
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.