lucono/karma-test-explorer

Timeout while debugging

Marklb opened this issue · 3 comments

Describe the Bug

The extension has been working great for running tests, but I can't use it to debug tests. When stepping through or checking multiple breakpoints, the debugging session ends after only 60s.

I am not sure if this is a missing feature, bug, or just a setting I am overlooking. When trying to figure out if I was missing a setting, the only thing I could find is that using the debug.html page seems to be necessary when debugging, but I didn't find anything confirming exactly why yet. My guess, based on various incomplete discussions, seemed to be that the page debugging can't communicate while the debugger has locked the tab's JS execution, so the debug.html page lets communication continue with the browser. I don't know enough about how it works to know if that is correct, yet.

Steps to Reproduce the Behavior

  1. Set a breakpoint.
  2. Step through each line or continue to other breakpoints for longer than 60s, in a single test.
  3. Session ends.

Describe the Expected Behavior

If I am on a breakpoint, I expect to be able to stay there and inspect variables or discuss with someone, instead of having to rush and think about how much time is left before I need to run the test again.

Provide Debug Logs

[2021-11-16 17:37:42.135] [ERROR] [KarmaTestEventListener]: Could not listen for Karma events - Test execution failed: Exceeded 60000 ms timeout while waiting for first test result
[2021-11-16 17:37:42.153] [ERROR] [Adapter]: Failed while debugging requested tests - Exceeded 60000 ms timeout while waiting for first test result
[2021-11-16 17:37:42.154] [INFO] [Adapter]:  Debug test run finished in 60.04 secs
[2021-11-16 17:37:42.670] [INFO] [Debugger]: Debug session 'Karma Test Explorer Debugging' has ended
System:
    OS: Windows 10 10.0.19043
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
  Binaries:
    Node: 14.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - C:\Program Files\nodejs\yarn.CMD
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD

For now, I use this extension to easily run specific tests. When I need to debug a test, I use the following launch config:

{
      "name": "Debug tests",
      "type": "chrome",
      "request": "launch",
      "url": "http://localhost:9876/debug.html",
      "webRoot": "${workspaceFolder}",
      "sourceMaps": true,
      "sourceMapPathOverrides": {
        "webpack:/*": "${webRoot}/*",
        "/./*": "${webRoot}/*",
        "/src/*": "${webRoot}/*",
        "/*": "*",
        "/./~/*": "${webRoot}/node_modules/*"
      }
}

@Marklb Acknowledging this issue. That timeout should not apply when debugging. Will look to fix in the next release.

@Marklb this should be fixed with the v0.4.0 release. Can you confirm?

@lucono It seems to be fixed for me. I had been working on another project the last few days, but planned to work on one that does use this tonight. I just started the debugger and let it sit for a few minutes then continued to be able to step through, so it seems to be fixed.

I did have some issues with the debugger ending before hitting a breakpoint and no error in the Karma Server or Karma Test Explorer panels, but I feel like it was probably a problem with my code.

I'll go on and close this issue, because it does seem to be fixed from just randomly sitting in tests for a few minutes. If I notice any problems after actually using it to debug problems then I'll reopen.