question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

clearContext:true and watch mode causes "Some of your tests did a full page reload!"

See original GitHub issue

I’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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kamilchlebekcommented, Apr 22, 2020

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 emit beforeunload event. Otherwise will it ever succeed? reloadingContext is always false (with clearContext: true) just before executing navigateContextTo(constant.CONTEXT_URL)

Important note: I was using an iframe mode

Outdated: btw. As I’m still getting DisconnectedClient disconnected from CONNECTED state (ping timeout). Should it ever happen in watch mode? It’s not a big issue when running karma in console, but it’s inconvenient when using karma inside Webstorm. I have to trigger test twice when this error occurs.

Update

I think I’ve found a workaround for DisconnectedClient disconnected from CONNECTED state (ping timeout). I’ve set pingTimeout to be quite big number. It used to be 60s ( 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 blocking heartbeat communication.

0reactions
karmarunnerbotcommented, Jan 13, 2021

🎉 This issue has been resolved in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

karma-runner - Bountysource
When launching the karma test with chrome already running, three karma tabs open, connect, lose the connection again and then karma crashes. When...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found