Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maxcal/d2b7d3e5208648598343 to your computer and use it in GitHub Desktop.
Save maxcal/d2b7d3e5208648598343 to your computer and use it in GitHub Desktop.
sourceMapper = require 'source-map-support'
Dot = require '../../../node_modules/grunt-mocha/node_modules/mocha/lib/reporters/dot.js'
module.exports = Dot
##
parseLine = (line) ->
[_, file, row] = line.match /file:\/\/\/(.*):(\d*)/
frame =
getFileName: -> file
getLineNumber: -> row
getColumnNumber: -> 1
superEpilogue = Dot.prototype.epilogue
Dot.prototype.epilogue = ->
for test in @failures
test.err.stack = test.err.stack.split('\n').map((line)->
if line.match /^ at /
mapped = sourceMapper.wrapCallSite parseLine line
line.replace /file:\/\/\/(.*):(\d*)/,
"file:///#{mapped.getFileName()}:#{mapped.getLineNumber()}"
else
line
).join('\n')
superEpilogue.bind(@)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment