I implemented a vscode extension and now I want to test it. My extension consists of 3 functions, I was able test 2 of them using vscode-test's runTest and mocha and this launch config:
{
"name": "Extension Test",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/extension/tests/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/extension/tests/**/*.js"
]
}
But I am stuck now, because the third function needs a vscode.TextEditor and I can't find a way to create or get one. Launching this doesn't give the test files any TextEditors, I tried to get one using:
let editor1 = vscode.window.visibleTextEditors; // --> length = 0
let editor2 = vscode.window.activeTextEditor; // --> undefined
Is there a way to test this?
Aucun commentaire:
Enregistrer un commentaire