Currently, I am developing a custom VSCode extension that considers the path of the file being opened within the workspace.
To create a reproducible test scenario, I want to open the test folder itself in VSCode and then proceed to open the test file within it. The code snippet for this action is as follows:
import * as vscode from "vscode";
test("whatever", async function() {
let workspaceUri = vscode.Uri.file(__dirname);
// however, the execution halts at this point...
await vscode.commands.executeCommand("vscode.openFolder", workspaceUri);
await vscode.workspace.openTextDocument(__filename);
})
The issue arises when attempting this process, leading to the tests prematurely stopping before even testing my actual code. A similar problem is discussed here.
Is there a workaround or method through which I can safely open a workspace and utilize it during tests?