karma-runner/karma — pull request #1098 by afischer-sfly (2014-06-11 17:07:40+00:00)
Title: fix: catch exceptions from SourceMapConsumer

The symptom of this issue is that the test runner will die with the following error:

Fatal error: Line must be7 greater than or equal to 1, got 0

The way the error happened:

1) One of my specs was failing when calling getComputedStyle(). In Firefox this resulted in an error message with some weird formatting: "TypeError: Argument 1 of Window.getComputedStyle does not implement interface Element. in http://172.20.132.80:8080/base/app/SilverApp/services/DragAvatarProducer.js?dc125e476a15c0e2f62b00901b3d0c1b6c407af8 (line 85)". The problem with that string is the line number is formatted "(line 85)" when it should be like ":85:7". This might be a bug against Firefox.
2) Karma's source-map support tried to parse the line & column, but couldn't because the formatting was weird. (see: https://github.com/karma-runner/karma/blob/master/lib/reporter.js#L36 )
3) Karma uses defaults of 0 for the line & column numbers. (see: https://github.com/karma-runner/karma/blob/master/lib/reporter.js#L45 )
4) The source-map library throws an exception if line or column is 0. (see: https://github.com/mozilla/source-map/blob/master/lib/source-map/source-map-consumer.js#L277 )

This pull request wraps `SourceMapConsumer.originalPositionFor` in a try-catch block.