-
Notifications
You must be signed in to change notification settings - Fork 2k
"Unexpected request: GET .../.html" on Karma tests #198
Comments
I was having the same issue. I have discovered by removing Angulartics from my site that my tests now pass. |
Hi @simon-at-angelsdice , thank you for the reply. I did not remove Angulartics. Instead, I solved this problem by doing exactly as described in http://stackoverflow.com/a/23670198/2859410 Now, I still have one pending issue (again due to |
I ran into this problem a while ago. I did have an abstract state like you as well. This karma preprocessor solved the problem for me: karma-ng-html2js-preprocessor. |
Thank you very much, @Potstickers . In this case, I would have to manually load the HTML views as modules into the test routine, correct? |
yes. If you're still on the pre-0.4 branch, once you've installed the dependency
//modify files option to cat the html files
files: applicationConfiguration.assets.lib.js.concat(applicationConfiguration.assets.js, applicationConfiguration.assets.tests,applicationConfiguration.assets.html),
//and add these 2 options
preprocessors: {
'public/modules/**/*.html': ['ng-html2js']
},
ngHtml2JsPreprocessor: {
stripPrefix: 'public/',
moduleName: 'ngTemplates' //you can name this whatever you want
}
Hope that helps. |
Thank you so much @Potstickers , it really helped. The warning still shows up, though. Maybe I made a mistake somewhere. Did the abstract state you mentioned you had also have a blank url ( |
No actually. My use was like this: $stateProvider.
state('home', {
abstract: true,
template: '<div data-ui-view=""></div>'
}).
state('home.loggedOut', {
url: '/',
templateUrl: 'home.logged-in.html'
}).
state('home.loggedIn', {
url: '/',
templateUrl: 'home.logged-out.html'
}); Here's the SO answer that pointed me in this direction: http://stackoverflow.com/questions/15214760/unit-testing-angularjs-directive-with-templateurl |
Hi,
It seems that few wrong commits has been made recently on KARMA/JASMINE, which are causing these issues, as mine old code base is working fine, only after installing fresh dependencies these test cases are failing now. I am using below dependencies - "devDependencies": { Please help me out. |
When trying to integrate tests into my project, an error in which the views (.html files) are requested happens when I call
$httpBackend.flush()
in each test. Something likes this:This issue has been discussed within the UI-router group (see angular-ui/ui-router#212). Did any of you had this and managed to solve?
The text was updated successfully, but these errors were encountered: