angular-super-seed
angular-super-seed copied to clipboard
Tests failing when using google-maps directive
Hi,
I'm using Angular Google Maps (http://angular-google-maps.org/) in an experimental project, but when karma tests oftentimes fail with this error:
PhantomJS 1.9.7 (Mac OS X) ERROR
ReferenceError: Can't find variable: google
at /Users/netsensei/Workspace/myproject/app/bower_vendor/angular-google-maps/dist/angular-google-maps.js:3585
I've added this in the
of the index.html file: <script src='http://maps.googleapis.com/maps/api/js?sensor=false'></script>
and this in the build:js directive:
<script type="text/javascript" src="bower_vendor/angular-google-maps/dist/angular-google-maps.js"></script>
I tried wiping the .tmp folder to force rebuilding the app: one moment it works, but when I reload grunt, the error returns.
Any ideas?
Thanks!
If you just run grunt
it works? It just fails in the tests?
I'm guessing this is because Karma doesn't know about the maps.googleapis.com dependency yet. You can manually add 'external' dependencies like this in the karma config.
Try adding the dependency to karma in test/karma-unit.conf.js
Example:
files: [
'https://maps.googleapis.com/maps/api/js?sensor=false'
]
Let's keep it at: If I run grunt
it just doesn't work consistently. It fails on the tests with the "missing google reference" error;
I've tried adding the dependency as you described, but it keeps borking on the same error.
I've found this thread on the project itself, but it doesn't really provide an easy answer that I can translate to the Kunstmaan Superseed context:
https://github.com/nlaplante/angular-google-maps/issues/270
Have you already done GMap supporting projects in the past at Kunstmaan? I'll try to setup a mock project with the seed which spawns the error, so you can see what is actually happening.
Thanks!
I'm having this same error. Very unpredictable with grunt-karma.