clearContext:true and watch mode causes "Some of your tests did a full page reload!"
See original GitHub issueI’m not really sure if this is a bug or a feature.
I’m running karma in watch mode along with clearContext: true
(which in fact was set to true
by accident)
I was experiencing issues:
Disconnected (0 times) Client disconnected from CONNECTED state (ping timeout)
Some of your tests did a full page reload!
Only way to fix this was to restart karma.
I’ve debugged karma to see what’s going on and here are results.
Setting clearContext: false
solves the issue as https://github.com/karma-runner/karma/blob/6235e68bbf5a21b6723b652b3e9e09d627c2fad0/client/karma.js#L130-L132 error is never throw in this case
reloadingContext
depends on clearContext
here: https://github.com/karma-runner/karma/blob/6235e68bbf5a21b6723b652b3e9e09d627c2fad0/client/karma.js#L266
I’m still getting DisconnectedClient disconnected from CONNECTED state (ping timeout)
error in the console, but after karma receives command to execute tests it works fine.
What bothers me is - why execution of karma internals https://github.com/karma-runner/karma/blob/6235e68bbf5a21b6723b652b3e9e09d627c2fad0/client/karma.js#L267
causes Some of your tests did a full page reload!
to be thrown. Shouldn’t it be ignored same as navigateContextTo('about:blank')
?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
I saw this issue and PR. I didn’t want to pollute that discussion.
It seems related, especially that it happened to me randomly.
Assuming that leaving
about:blank
will not emitbeforeunload
event. Otherwise will it ever succeed?reloadingContext
is alwaysfalse
(with clearContext: true) just before executingnavigateContextTo(constant.CONTEXT_URL)
Important note: I was using an iframe mode
Update
I think I’ve found a workaround for
DisconnectedClient disconnected from CONNECTED state (ping timeout)
. I’ve setpingTimeout
to be quite big number. It used to be60s
( https://github.com/karma-runner/karma/issues/3354 ), now it’s only 5s which somehow is randomly not enough. I quess it may be related to angular compilation that happens before tests are executed or something else is blockingheartbeat
communication.🎉 This issue has been resolved in version 6.0.0 🎉
The release is available on:
Your semantic-release bot 📦🚀