-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some of your tests did a full page reload! #2373
Comments
@maruthi1255 Please try to do what is suggested in this comment: #1101 (comment) Running with the above suggestion can help you to find out which part is doing a page reload |
Usually this type of error can occur when one is doing something like |
@wesleycho Is there any idea to work around? |
This issue seems to be happening in the Chrome. Try configuring the headless browser, like PhantomJS in karma configuration and tests run. Yes, its hard to debug. But, that seems to be workaround. ( I have tried) Or as many pointed, that seems to be an issue with the window location, probably jasmine Spy objects can help to hook the fake listeners to events. I haven't tried this. |
@SarathChandraSVM I am using the headless chrome, wanting to navigate to a page and do some check, with the same problem |
I solved this like so: beforeEach(function(){
angular.mock.module('app', function ($provide) {
let $window = {location: {reload: sinon.spy()}};
$provide.value('$window', $window);
$window.onbeforeunload = sinon.spy();
});
}); the above just stubs it out. You have to inject $window into your codebase, so use:
instead of
|
I experienced this on Travis CI, despite the following:
'use strict';
jasmine.getEnv().topSuite().beforeEach({
fn: function() {
angular.mock.module('app', function ($provide) {
var $window = {location: { reload: jasmine.createSpy('reload') }};
$provide.value('$window', $window);
});
}
}); However, that didn't really help determine the root cause. What ended up fixing it as well was disabling concurrency in my
It's sad to disable concurrency. Maybe I'll just go back to using the Jasmine hack? Here's a minimal reproduction of the issue: |
I see this error as well, but only when running with more than one browser at a time (I'm using chromium + phantomjs). |
What platform are you on? Did you try the minimal example in the repo I posted? Do either of the "Jasmine before each" / "Angular mock" hacks change anything? |
It will solve this Karma redirect error! var html = '<script type="text/javascript">'; |
This is potentially resolved by #3560 |
@rooby Thanks for the heads up! The race condition causing the false positive errors was indeed resolved in the latest release of Karma. It worths noting that you may still see this error if your tests trigger navigation. If it is the case, you should update your test code to prevent it (by for example mocking Please open a new issue providing minimal reproduction if you still believe that there is a Karma bug involved here. |
Getting the following error while running karma test
Command: gulp test:unit "--browsers=Chrome"
This is happing most of the time.
There is no proper stack trace to find the root cause of the issue.
Using the following karma versions
Karma "version": "0.13.22"
karma-coverage: "version": "0.2.6"
karma-jasmine: "version": "0.3.8"
Error Log (Log):
1.Chrome 53.0.2785 (Mac OS X 10.11.6) ERROR
Some of your tests did a full page reload!
Chrome 53.0.2785 (Mac OS X 10.11.6): Executed 0 of 0 ERROR (3.638 secs / 0 secs)
2. Also getting the code coverage as
=============================== Coverage summary ===============================
Statements : 100% ( 0/0 )
Branches : 100% ( 0/0 )
Functions : 100% ( 0/0 )
Lines : 100% ( 0/0 )
Would you please suggest the versions in which the issue got resolved.
The text was updated successfully, but these errors were encountered: