Skip to content

Commit a9516af

Browse files
committed
fix(reporter): sourcemap not working in windows
resolve #1200
1 parent 461571e commit a9516af

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

lib/reporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var createErrorFormatter = function(basePath, emitter, SourceMapConsumer) {
2424

2525
var URL_REGEXP = new RegExp('http:\\/\\/[^\\/]*\\/' +
2626
'(base|absolute)' + // prefix
27-
'([^\\?\\s\\:]*)' + // path
27+
'((?:[A-z]\\:)?[^\\?\\s\\:]*)' + // path
2828
'(\\?\\w*)?' + // sha
2929
'(\\:(\\d+))?' + // line
3030
'(\\:(\\d+))?' + // column

test/unit/reporter.spec.coffee

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,28 @@ describe 'reporter', ->
9494
ERROR = 'at http://localhost:123/base/b.js:2:6'
9595
expect(formatError ERROR).to.equal 'at /some/base/b.js:2:6 <- /original/b.js:4:8\n'
9696
done()
97+
98+
describe 'Windows', ->
99+
formatError = null
100+
servedFiles = null
101+
102+
beforeEach ->
103+
formatError = m.createErrorFormatter '/some/base', emitter, MockSourceMapConsumer
104+
servedFiles = [new File('C:/a/b/c.js')]
105+
servedFiles[0].sourceMap = 'SOURCE MAP b.js'
106+
107+
it 'should correct rewrite stack traces without sha', (done) ->
108+
emitter.emit 'file_list_modified', q(served: servedFiles)
109+
110+
scheduleNextTick ->
111+
ERROR = 'at http://localhost:123/absoluteC:/a/b/c.js:2:6'
112+
expect(formatError ERROR).to.equal 'at C:/a/b/c.js:2:6 <- /original/b.js:4:8\n'
113+
done()
114+
115+
it 'should correct rewrite stack traces with sha', (done) ->
116+
emitter.emit 'file_list_modified', q(served: servedFiles)
117+
118+
scheduleNextTick ->
119+
ERROR = 'at http://localhost:123/absoluteC:/a/b/c.js?da39a3ee5e6:2:6'
120+
expect(formatError ERROR).to.equal 'at C:/a/b/c.js:2:6 <- /original/b.js:4:8\n'
121+
done()

0 commit comments

Comments
 (0)