unit testing - Conditionally load ngMock into app only if running karma jasmine tests -


i having issues loading app when including ngmock, load when running tests works fine. there flag or kind of istesting() function gets set when karma runs tests? can reference when creating array of dependencies app.

i ended checking existence of global variable set if test classes had loaded, suppose it's kind of obvious kind of hoping karma.isrunning property or something...

anyway solution looks kind of like:

var dependencies = [     'ui.router',     'nganimate',     'ngsanitize', ]; if (typeof app_test !== "undefined")     dependencies.push("ngmock");  angular.module('myapp', dependencies)... 

keep in mind test classes need loaded before main app files


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -