user3093975
user3093975

Reputation: 43

Running Karma tests with google maps module dependency

So i included this module into my Angular app https://github.com/angular-ui/angular-google-maps

Now the question is: How to I run Karma tests that integrate it?

Running "karma:unit" (karma) task
INFO [karma]: Karma v0.10.6 server started at http://localhost:8080/
INFO [launcher]: Starting browser Chrome
WARN [watcher]: Pattern "/Users/Work/status/test/mock/**/*.js" does not match any file.
INFO [Chrome 31.0.1650 (Mac OS X 10.8.4)]: Connected on socket iLYLgPcHaw8HVJjNNafq
Chrome 31.0.1650 (Mac OS X 10.8.4) ERROR
    Uncaught ReferenceError: google is not defined
    at /Users/Work/status/app/scripts/angular-google-maps.min.js:6
Chrome 31.0.1650 (Mac OS X 10.8.4): Executed 0 of 0 ERROR (0.509 secs / 0 secs)
Warning: Task "karma:unit" failed. Used --force, continuing.

Done, but with warnings.

So it is the global google object that is missing

I see a couple of solutions but do not know how to implement them:

-Inject the google script everytime we run tests (although inefficient). Question is, how and where do I inject it?

<script src="http://maps.googleapis.com/maps/api/js?sensor=false&language=en"></script>

-i read a suggestion somewhere that we could mock the google API

Upvotes: 4

Views: 7348

Answers (1)

Nick
Nick

Reputation: 1274

This has been asked a few times already in the issues list on the project. Here is one of the q/a. https://github.com/angular-ui/angular-google-maps/issues/270

Upvotes: 2

Related Questions