Tests start failing when upgrading from 1.5.0 to 1.5.1 or newer

69 views
Skip to first unread message

Arto Chydenius

unread,
Mar 22, 2016, 7:46:55 AM3/22/16
to AngularJS
Hi everyone,

I have an AngularJS project which has Jasmine tests that are run with Karma. When upgrading from 1.5.0 to 1.5.1+ my tests start to fail since they try to access my front page partial (Error: Unexpected request: GET partials/frontpage.html).

I get the tests to pass by preprocessing templates with karma-ng-html2js-preprocessor but even if the actual tests pass, at some point Karma still throws the same error not related to any individual test. The exact change that breaks the tests is this one.

Has anyone else been experiencing similar problems?

Alexandre Brasil

unread,
Mar 22, 2016, 2:02:09 PM3/22/16
to AngularJS
I'm experiencing the same problem since I updated my application from Angular 1.4 to 1.5.2.

Whenever my tests hit a $scope.$apply() or $httpBackend.flush(), the default route ('/') is resolved and it tries to fetch its data from the backend. In my case, this route has a 'resolve' property that calls a rest service before trying to load the template. If I comment out the 'resolve', then it tries to fetch the route template. Since my tests don't specify those http expectations, those tests fail.

I've managed to work around this issue by segregating the route config in another file and excluding it in my karma.conf.js config file, but I'd rather not have to do it. I'm still searching for a better (right?) way to do it, but no luck so far.

Alexandre Brasil

unread,
Mar 22, 2016, 2:10:01 PM3/22/16
to AngularJS
Just a small correction: my current Angular version is 1.5.1, not 1.5.2.

Arto Chydenius

unread,
Mar 23, 2016, 3:28:54 AM3/23/16
to AngularJS
Excluding route config from karma.conf.js seems to work for me too but as you said, it doesn't feel like a correct solution.

I was thinking of making a bug report about this in Github, but I'm not sure whether this is really a bug. On the other hand I'd guess that this affects quite a lot of projects.

Alexandre Brasil

unread,
Mar 23, 2016, 2:07:01 PM3/23/16
to ang...@googlegroups.com
I think we should open a bug in github. If it's not deemed a bug, then it should at least go into the "breaking changes" section. :)

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/3uMX8V4HWGo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Olivier Lemasle

unread,
Mar 28, 2016, 3:18:33 PM3/28/16
to AngularJS
Hi,

As someone opened a bug in GitHub finally? I did not find one but I don't want to create a duplicate.

I have encountered the same issue.

Thanks

Arto Chydenius

unread,
Mar 29, 2016, 5:27:44 AM3/29/16
to AngularJS
Reply all
Reply to author
Forward
0 new messages