I know how to load templates in my karma tests using the ng-html2js preprocessor. However, in our project we have a templates.js file already that looks like so:
angular.module("myApp").run(
["$templateCache", function($templateCache) {
$templateCache.put(
"app/directive-template.html",
"<span>Some fancy template.</span>");
...
});
It is generated with the gulp-angular-templatecache plugin. This works great for production but fails for tests. The file is included in the karma.conf.js and loads correctly, but the run-function is only executed after the tests have executed.
How can I make karma wait for the run phase so the templates are loaded before the tests are executed?