Running Karma tests with google maps module dependency












4















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










share|improve this question

























  • I suspect mocking is the way to go. Can you post a short test that is failing?

    – Michal Charemza
    Dec 12 '13 at 7:37











  • @MichalCharemza I have 1 extremely basic test setup. But it does not even get to run because of this Uncaught ReferenceError with the google object. Hence the 0 of 0 ERROR

    – user3093975
    Dec 12 '13 at 8:45
















4















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










share|improve this question

























  • I suspect mocking is the way to go. Can you post a short test that is failing?

    – Michal Charemza
    Dec 12 '13 at 7:37











  • @MichalCharemza I have 1 extremely basic test setup. But it does not even get to run because of this Uncaught ReferenceError with the google object. Hence the 0 of 0 ERROR

    – user3093975
    Dec 12 '13 at 8:45














4












4








4








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










share|improve this question
















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







javascript google-maps angularjs testing karma-runner






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 19:47









Nick

546515




546515










asked Dec 12 '13 at 5:29









user3093975user3093975

2313




2313













  • I suspect mocking is the way to go. Can you post a short test that is failing?

    – Michal Charemza
    Dec 12 '13 at 7:37











  • @MichalCharemza I have 1 extremely basic test setup. But it does not even get to run because of this Uncaught ReferenceError with the google object. Hence the 0 of 0 ERROR

    – user3093975
    Dec 12 '13 at 8:45



















  • I suspect mocking is the way to go. Can you post a short test that is failing?

    – Michal Charemza
    Dec 12 '13 at 7:37











  • @MichalCharemza I have 1 extremely basic test setup. But it does not even get to run because of this Uncaught ReferenceError with the google object. Hence the 0 of 0 ERROR

    – user3093975
    Dec 12 '13 at 8:45

















I suspect mocking is the way to go. Can you post a short test that is failing?

– Michal Charemza
Dec 12 '13 at 7:37





I suspect mocking is the way to go. Can you post a short test that is failing?

– Michal Charemza
Dec 12 '13 at 7:37













@MichalCharemza I have 1 extremely basic test setup. But it does not even get to run because of this Uncaught ReferenceError with the google object. Hence the 0 of 0 ERROR

– user3093975
Dec 12 '13 at 8:45





@MichalCharemza I have 1 extremely basic test setup. But it does not even get to run because of this Uncaught ReferenceError with the google object. Hence the 0 of 0 ERROR

– user3093975
Dec 12 '13 at 8:45












1 Answer
1






active

oldest

votes


















2














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






share|improve this answer


























  • the link is broken @nick

    – Vikas786
    Nov 21 '18 at 11:54













  • I re-enabled issues on the repo. Be nice if someone would like to enlighten me on how I can lock issue creation on a github repo but allow existing issues to be seen.

    – Nick
    Nov 21 '18 at 18:49











  • Looks like this would work, blog.github.com/2017-11-08-archiving-repositories .

    – Nick
    Nov 29 '18 at 16:23











  • Repo has been archived and all issues still exist.

    – Nick
    Nov 29 '18 at 16:29











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20535738%2frunning-karma-tests-with-google-maps-module-dependency%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














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






share|improve this answer


























  • the link is broken @nick

    – Vikas786
    Nov 21 '18 at 11:54













  • I re-enabled issues on the repo. Be nice if someone would like to enlighten me on how I can lock issue creation on a github repo but allow existing issues to be seen.

    – Nick
    Nov 21 '18 at 18:49











  • Looks like this would work, blog.github.com/2017-11-08-archiving-repositories .

    – Nick
    Nov 29 '18 at 16:23











  • Repo has been archived and all issues still exist.

    – Nick
    Nov 29 '18 at 16:29
















2














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






share|improve this answer


























  • the link is broken @nick

    – Vikas786
    Nov 21 '18 at 11:54













  • I re-enabled issues on the repo. Be nice if someone would like to enlighten me on how I can lock issue creation on a github repo but allow existing issues to be seen.

    – Nick
    Nov 21 '18 at 18:49











  • Looks like this would work, blog.github.com/2017-11-08-archiving-repositories .

    – Nick
    Nov 29 '18 at 16:23











  • Repo has been archived and all issues still exist.

    – Nick
    Nov 29 '18 at 16:29














2












2








2







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






share|improve this answer















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







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '18 at 18:49

























answered Mar 5 '14 at 4:09









NickNick

546515




546515













  • the link is broken @nick

    – Vikas786
    Nov 21 '18 at 11:54













  • I re-enabled issues on the repo. Be nice if someone would like to enlighten me on how I can lock issue creation on a github repo but allow existing issues to be seen.

    – Nick
    Nov 21 '18 at 18:49











  • Looks like this would work, blog.github.com/2017-11-08-archiving-repositories .

    – Nick
    Nov 29 '18 at 16:23











  • Repo has been archived and all issues still exist.

    – Nick
    Nov 29 '18 at 16:29



















  • the link is broken @nick

    – Vikas786
    Nov 21 '18 at 11:54













  • I re-enabled issues on the repo. Be nice if someone would like to enlighten me on how I can lock issue creation on a github repo but allow existing issues to be seen.

    – Nick
    Nov 21 '18 at 18:49











  • Looks like this would work, blog.github.com/2017-11-08-archiving-repositories .

    – Nick
    Nov 29 '18 at 16:23











  • Repo has been archived and all issues still exist.

    – Nick
    Nov 29 '18 at 16:29

















the link is broken @nick

– Vikas786
Nov 21 '18 at 11:54







the link is broken @nick

– Vikas786
Nov 21 '18 at 11:54















I re-enabled issues on the repo. Be nice if someone would like to enlighten me on how I can lock issue creation on a github repo but allow existing issues to be seen.

– Nick
Nov 21 '18 at 18:49





I re-enabled issues on the repo. Be nice if someone would like to enlighten me on how I can lock issue creation on a github repo but allow existing issues to be seen.

– Nick
Nov 21 '18 at 18:49













Looks like this would work, blog.github.com/2017-11-08-archiving-repositories .

– Nick
Nov 29 '18 at 16:23





Looks like this would work, blog.github.com/2017-11-08-archiving-repositories .

– Nick
Nov 29 '18 at 16:23













Repo has been archived and all issues still exist.

– Nick
Nov 29 '18 at 16:29





Repo has been archived and all issues still exist.

– Nick
Nov 29 '18 at 16:29


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20535738%2frunning-karma-tests-with-google-maps-module-dependency%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen