-
Notifications
You must be signed in to change notification settings - Fork 96
Can't debug Karma tests launched in PhantomJS #33
Comments
@aides VSCode 0.9.1 is rather old. Could you please try with a more recent version, e.g. 0.10.3. |
@weinand Thanks for chiming in here. Yes, I am on 0.10.6 now and see the same behavior (breakpoints in tests are not hit). |
+1 |
@aides Since I'm not familiar with a Karma/Phantom setup, it would be great if you could help me reproducing this problem. Is there a repository sample that I can use? Thanks. |
@weinand thanks for coming back here. I've created a repo with a minimal set up for reproducing here https://github.com/aides/vscodekarma After cloning, one should do
Expected: breakpoint is hit and I recall I definitely saw this working on pre v0.9.1 Notes: I've managed to find VSCode v0.8.0 and saw that breakpoint was not hit either and that is strange. I did not manage to find v0.7.0 installer for another check. If you could provide me with 0.7.0 installer or a link I could do more checks on my own. Also, if you think that the case is not realistic, please let me know why it should not work as I would expect. |
@aides thanks for creating this setup for me. I suspect that Could it be that the |
@aides Yes, BTW you can find previous releases here: |
@aides if you find a way to pass the debug flag to the correct process (where |
Did anyone had any luck with debugging his/her karma unit tests? VSCode version 1.8.1, launch.json:
karma.conf.js
VSCode internal debug console shows:
test.spec.js:
0 chance to debug. |
Were you able to get this working? |
Sadly, I did not. I still hope on one of the devs to appear here :) |
I'm not really familiar with Karma but the test runs in phantomJS, not in Node, right? So how could it be debugged with the node debugger, unless there's some way to run them in Node instead? http://stackoverflow.com/questions/16660670/how-to-test-nodejs-backend-code-with-karma-testacular |
Karma runs as a node process and then uses one or more browser launchers to inject the tests to the desired browser. The launcher for PhantomJS karma-phantomjs-launcher spawns a phantomjs and then injects the tests. Over at the VSC phantomjs debug extension, you can directly invoke a phantomjs process and debug in VSC. This is closer to what we want, but not quite there. In fact, issue 1 on the extension's github is asking for this very thing. So anyone know how to attach to a phantomjs process that was launched in debug mode via karma? |
This is obviously a rather old thread, but you can just use chrome with the headless option. This won't spawn a browser window but will show output in your console terminal. Additionally, you can attach to the debug process in VS Code to get breakpoints. |
Using headless chrome yields different results than phantomjs. |
In pre 0.9.1 versions I had the following configuration and it worked fine, I could set breakpoints in the VSCode and they were hit when tests executed. After the 0.9.1 update the tests are executed however breakpoints are not hit anymore.
It could be awesome if this capability returned again.
As for alternatives, I see that I could switch to using new chrome-debug extension, and run tests in a chrome window, but this is not ideal. Keeping everything in the console output windows makes things clearer.
Karma v0.13.14
PhantomJS v1.9.18
launch.json:
karma.conf.js:
The text was updated successfully, but these errors were encountered: