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.

browser disconnection when debugging tests

See original GitHub issue

Reproduced with karma@0.9.3

  1. Start karma server in the console.
  2. Capture Chrome browser.
  3. Run tests using karma run command.
  4. Switch to the browser and open Developer Tools. Open Sources tab and place a breakpoint somewhere in a spec or source under test file.
  5. Run tests again using karma run command.
  6. Switch to the browser. The breakpoint is hit as expected.
  7. Do nothing for a minute or two.
  8. karma run command exits unexpectedly. Karma server log:
...
DEBUG [karma]: Execution (fired by runner)
DEBUG [karma]: Refreshing all the files / patterns
DEBUG [karma]: List of files has changed, trying to execute
DEBUG [karma]: All browsers are ready, executing
DEBUG [watcher]: Resolved files:
    /home/segrey/stuff/temp/1/node_modules/karma-jasmine/lib/jasmine.js
    /home/segrey/stuff/temp/1/node_modules/karma-jasmine/lib/adapter.js
    /home/segrey/stuff/sample-js-tests/jasmine/evanhahn/src/helloWorld.js
    /home/segrey/stuff/sample-js-tests/jasmine/evanhahn/src/person.js
    /home/segrey/stuff/sample-js-tests/jasmine/evanhahn/spec/helloWorldSpec.js
    /home/segrey/stuff/sample-js-tests/jasmine/evanhahn/spec/personSpec.js
DEBUG [web server]: serving: /home/segrey/stuff/temp/1/node_modules/karma/static/context.html
Chrome 28.0.1500 (Linux): Executed 0 of 7 DISCONNECTED (1 min 12.787 secs / 0 secs)
WARN [Chrome 28.0.1500 (Linux)]: Disconnected

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vojtajinacommented, Jun 27, 2013

As for the first issue, I’m not sure what the exact reason is, but there might be some timeout and I assume the browser kills the websocket connection. The debugger pauses all JS execution. This is not a high priority for me, you should use http://localhost:9876/debug.html for debugging.

Ad second issue (with coverage), I fixed that: https://github.com/karma-runner/karma-coverage/commit/5eca4882ce4ea736283b0ac8e7c38f1051230a57

0reactions
vojtajinacommented, Jul 13, 2013

@segrey Maybe you can try different transports (instead of websocket, html-polling or jsonp-polling might be less sensitive to paused debugger). We can also fiddle with socket.io configuration, maybe we can set some longer timeout.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Karma: can't debug tests, browser is disconnected - YouTrack
run karma tests in debugger - the browser opens, servers is started, then the new browser instance starts, previous is disconnected and closed...
Read more >
Debugging DISCONNECTED issues - Google Groups
I am trying to setup running of tests on BrowserStack, and I am running into issues of Karma reporting a status of DISCONNECTED...
Read more >
Browser gets disconnected while executing karma test cases
And I am trying to run these test cases using ng test command. But every time browser gets disconnected at 390 testcase and...
Read more >
Karma Tests Disconnect, Particularly When Running Tests on ...
We occasionally get reports of Karma tests disconnecting, particularly when testing with Safari (or mobile Safari).
Read more >
How to Use Chrome DevTools to Debug Unit Test Cases
When npm run test:debug is running, the larger red box shows the target. You can click the link, inspect , above the dashed...
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