browser disconnection when debugging tests
See original GitHub issueReproduced with karma@0.9.3
- Start karma server in the console.
- Capture Chrome browser.
- Run tests using
karma run
command. - Switch to the browser and open Developer Tools. Open Sources tab and place a breakpoint somewhere in a spec or source under test file.
- Run tests again using
karma run
command. - Switch to the browser. The breakpoint is hit as expected.
- Do nothing for a minute or two.
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:
- Created 10 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
@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.