wdio-vscode-service icon indicating copy to clipboard operation
wdio-vscode-service copied to clipboard

Debug vscode ts extension

Open Th3CracKed opened this issue 2 years ago • 8 comments

Is there any example how to setup a vscode debug configuration to debug extension running in wdio vscode environment. A typescript configuration example would be appreciated.

thanks

Th3CracKed avatar Aug 26 '22 08:08 Th3CracKed

For those having the same issue, check this thread to debug an installed vscode app https://stackoverflow.com/questions/39003860/how-can-i-debug-installed-vscode-extensions

I didn't manage to make the source map work to debug ts files, but it's a good start to be able to debug js files

Th3CracKed avatar Aug 30 '22 14:08 Th3CracKed

@Th3CracKed please check out the Marquee project where I use this package for e2e testing. When a test fails it shows me the correct ts lines.

Setting up a TypeScript project is not particular something this project is concerned about. Can you specify what improvements you like to see to have this issue closed?

christian-bromann avatar Aug 30 '22 18:08 christian-bromann

@christian-bromann thanks for your answer, The stack trace are showed correctly for ts files. I don't understand how wdio vscode service load/run the extension. Ideally I want to put the debugger on my extension code and run the e2e test to check if the things I mock are correctly mocked and debug failing tests faster. Currently I have really low visibility on the state of my extension when running with a wdio vscode service, I added logs to help me understand what happening. but it's not ideal DX.

Th3CracKed avatar Aug 30 '22 21:08 Th3CracKed

Currently I have really low visibility on the state of my extension when running with a wdio vscode service, I added logs to help me understand what happening. but it's not ideal DX.

Do you have any concrete suggestions how we can improve this?

christian-bromann avatar Nov 11 '22 01:11 christian-bromann

being able to debug extension in vscode launched by wdio vscode. Maybe if there's a way to automate the steps https://stackoverflow.com/questions/39003860/how-can-i-debug-installed-vscode-extensions combined with vscode chrome debug

Now I use logging to understand what's happening on the extension

Th3CracKed avatar Nov 11 '22 12:11 Th3CracKed

Setting breakpoints in your extension code and have the test stop at these points is surely possible in some way.

christian-bromann avatar Nov 11 '22 17:11 christian-bromann

@christian-bromann my observation is that when debugging with wdio-vscode-service, neither placing debugger statements in the extension's source code, or calling executeComand() work.

Placing debugger in the test suite code, or adding breakpoints to the test suit code works, but not in the extension itself (while being automated by wdio-vscode-service)

The issue is that on startup a socket to VS Code is opened, but once VS Code opens a folder/project, the socket is closed and executeComand() no longer works.

jeffb-sfdc avatar Mar 17 '23 22:03 jeffb-sfdc

Placing debugger in the test suite code, or adding breakpoints to the test suit code works, but not in the extension itself (while being automated by wdio-vscode-service)

Yeah, it would be very difficult to support breakpoints within the extension. Again, as mentioned before: probably possible, no idea how though.

christian-bromann avatar Mar 17 '23 23:03 christian-bromann