-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use default value that's safe with source-map@0.1.43 #1310
Use default value that's safe with source-map@0.1.43 #1310
Conversation
source-map@0.1.43 will throw an error if you pass a line number equal to 0. See: https://github.com/mozilla/source-map/blob/0.1.43/lib/source-map/source-map-consumer.js#L285-L287
@karma/owners ping |
I would put fix(***) in the commit message, but I'm not sure what to put in the parenthesis for this. |
@mtscout6 Thanks. When line is not defined or equal '0'?
|
I understand your sentiment about feeling like this is just fixing the symptom, so let me explain the issue a little deeper. I'm currently seeing this issue isolated to Firefox. For example without my fix I get the following output and the karma process crashes, it does not matter it the error is in a test or the code being tested. ➜ one-exchange git:(team-4) ✗ karma start
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [launcher]: Starting browser Firefox
INFO [launcher]: Starting browser PhantomJS
INFO [Firefox 34.0.0 (Mac OS X 10.10)]: Connected on socket z-Wd2IS8Ga2bGoA-4Djx with id 96357773
INFO [Chrome 40.0.2214 (Mac OS X 10.10.2)]: Connected on socket SWejfJH3UCtjk3Xw4Djw with id 61391085
INFO [PhantomJS 1.9.7 (Mac OS X)]: Connected on socket EY2QNttHkOjUIX4A4Djy with id 82304088
PhantomJS 1.9.7 (Mac OS X) Directive: addToCart toggles the text FAILED
ReferenceError: Can't find variable: test
at /mnt/Resources/dev/one-exchange/src/ExtendHealth.OneExchange/content/scripts/specs/test-main.js:218:0 <- webpack:///src/ExtendHealth.OneExchange/content/scripts/specs/add-to-cart-directive-spec.js:58:0
PhantomJS 1.9.7 (Mac OS X): Executed 1 of 2002 (1 FAILED) (skipped 2001) ERROR (0.609 secs PhantomJS 1.9.7 (Mac OS X): Executed 1 of 2002 (1 FAILED) (skipped 2001) ERROR (0.609 secs / 0.02 secs)
Firefox 34.0.0 (Mac OS X 10.10): Executed 0 of 2002 SUCCESS (0 secs / 0 secs)
ERROR [karma]: [TypeError: Line must be greater than or equal to 1, got 0]
TypeError: Line must be greater than or equal to 1, got 0
at SourceMapConsumer_findMapping [as _findMapping] (/mnt/Resources/dev/one-exchange/node_modules/source-map/lib/source-map/source-map-consumer.js:286:15)
at SourceMapConsumer_originalPositionFor [as originalPositionFor] (/mnt/Resources/dev/one-exchange/node_modules/source-map/lib/source-map/source-map-consumer.js:346:24)
at /mnt/Resources/dev/one-exchange/node_modules/karma/lib/reporter.js:49:28
at String.replace (native)
at /mnt/Resources/dev/one-exchange/node_modules/karma/lib/reporter.js:36:23
at /mnt/Resources/dev/one-exchange/node_modules/karma/lib/reporters/base.js:105:14
at Array.forEach (native)
at specFailure (/mnt/Resources/dev/one-exchange/node_modules/karma/lib/reporters/base.js:104:16)
at onSpecComplete (/mnt/Resources/dev/one-exchange/node_modules/karma/lib/reporters/base.js:85:12)
at null.<anonymous> (/mnt/Resources/dev/one-exchange/node_modules/karma/lib/events.js:15:22) With the fix:
I didn't realize it when I first submitted this pull request, but with my fix there's no Firefox exception details... Thoughts? |
After applying the patch from #1098 I'm seeing better results than I am with this. I'd rather see that one go through. |
Strange output... Are you use jasmine? |
Yes, and I'm sure it's an old version for this project.... |
@mtscout6 Thanks. |
source-map@0.1.43 will throw an error if you pass a line number equal to
0. See:
https://github.com/mozilla/source-map/blob/0.1.43/lib/source-map/source-map-consumer.js#L285-L287
Since Karma is not wrapping that in a try catch, the exception will just crash karma. Changing the default line number to 1 will not throw and a test exception stack trace will still output correctly.