Is it possible to debug a function callback that's passed into executeWorkbench()?
jeffb-sfdc opened this issue · comments
The vscode
instance/object can't be directly called, and I read that the preferred pattern is to do this:
import vscodeType from 'vscode'
const openFile = async (vscode: typeof vscodeType, file: string) => {
const fsPath = vscode.Uri.parse(file).fsPath;
const doc = await vscode.workspace.openTextDocument(fsPath);
const editor = await vscode.window.showTextDocument(doc);
}
it('opens a file', async () => {
await browser.executeWorkbench(openFile, '/Users/my-user-name/temp/test.txt');
});
This works, however, I'd like to be able to step into the callback function and debug it. (this example is pretty simple, but I have another one which isn't working and I would like to be able to debug it)
I've tried adding breakpoints, and I've tried adding debugger
. I know the code is getting executed (in this situation the file is getting opened), but I'm not able to actually debug the code. I was wondering if anyone here has any tips or suggestions on how to do this?
Thanks!
Jeff
Thanks for raising the issue.
I don't think this is possible. The code executed in executeWorkbench
is run within a different process as the test which means it is not possible to attach a debugger to it.