Skip to content

Commit

Permalink
fix(reporter): sourcemap not working in windows
Browse files Browse the repository at this point in the history
resolve #1200
  • Loading branch information
maksimr committed Oct 23, 2014
1 parent 461571e commit a9516af
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var createErrorFormatter = function(basePath, emitter, SourceMapConsumer) {

var URL_REGEXP = new RegExp('http:\\/\\/[^\\/]*\\/' +
'(base|absolute)' + // prefix
'([^\\?\\s\\:]*)' + // path
'((?:[A-z]\\:)?[^\\?\\s\\:]*)' + // path
'(\\?\\w*)?' + // sha
'(\\:(\\d+))?' + // line
'(\\:(\\d+))?' + // column
Expand Down
25 changes: 25 additions & 0 deletions test/unit/reporter.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,28 @@ describe 'reporter', ->
ERROR = 'at http://localhost:123/base/b.js:2:6'
expect(formatError ERROR).to.equal 'at /some/base/b.js:2:6 <- /original/b.js:4:8\n'
done()

describe 'Windows', ->
formatError = null
servedFiles = null

beforeEach ->
formatError = m.createErrorFormatter '/some/base', emitter, MockSourceMapConsumer
servedFiles = [new File('C:/a/b/c.js')]
servedFiles[0].sourceMap = 'SOURCE MAP b.js'

it 'should correct rewrite stack traces without sha', (done) ->
emitter.emit 'file_list_modified', q(served: servedFiles)

scheduleNextTick ->
ERROR = 'at http://localhost:123/absoluteC:/a/b/c.js:2:6'
expect(formatError ERROR).to.equal 'at C:/a/b/c.js:2:6 <- /original/b.js:4:8\n'
done()

it 'should correct rewrite stack traces with sha', (done) ->
emitter.emit 'file_list_modified', q(served: servedFiles)

scheduleNextTick ->
ERROR = 'at http://localhost:123/absoluteC:/a/b/c.js?da39a3ee5e6:2:6'
expect(formatError ERROR).to.equal 'at C:/a/b/c.js:2:6 <- /original/b.js:4:8\n'
done()

0 comments on commit a9516af

Please sign in to comment.