I have a weird problem. Whenever I'm trying to test something and the test fails, it always shows a stacktrace with line number 9.
I'm using AngularJS along with Jasmine and Karma. I found out that it doesn't depend on the browser. An error looks like this:
TypeError: 'undefined' is not an object (evaluating 'new google.maps.LatLng')
at /Users/user1/project1/test_ctrl.js:9
at /Users/user1/project1/spec/test_ctrl_spec.js:170
So, it tells me that the test fails on line 170 (this is correct), but the cause of the error is inside my test_ctrl.js
at a complete different line number than number 9. And this line number is shown on every test that fails.
Anyone an idea how to solve this?
Karma is essentially a tool which spawns a web server that executes source code against test code for each of the browsers connected. The results of each test against each browser are examined and displayed via the command line to the developer such that they can see which browsers and tests passed or failed.
Excluding Tests / Specs If you want to exclude a specific test, simply use xit() instead of it() . The x means exclude. describe('description', function () { xit('description', function () {}); }); If you want to exclude an entire describe block, use xdescribe() instead of describe() .
This appears to be an issue with using karma-coverage, since the istanbul code coverage tool minifies the source code. There is an open issue on the karma-coverage repo. If you temporarily disable the coverage reporter in your karma config file, it should work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With