You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(I've also tried vim.normalModeKeyBindingsNonRecursive)
The command seems to get executed when using <leader>m (at the bottom status bar I see it running test-explorer.run-file), but then nothing happens. No tests get run. This only happens when triggering via the Vim key binding, as using the "Test Explorer: Run tests in current file" straight from command palette does not have this issue.
Triggering other commands like "test-explorer.run-all" and "test-explorer.run-test-at-cursor" do seem to work via Vim keybindings, so I'm wondering if there's something special about the run-file command that makes it incompatible with the way Vim keybindings work.
Any ideas?
EDIT: "Solved it". I did some further digging and it seems like the fileUri is passed as empty string to utils.runTestsInFile when run using the vim keybinding. Don't yet know why this happens, but as there is already a fallback to vscode.window.activeTextEditor.document.uri.toString() when fileUri is not defined, a quick fix for this issue is to change the condition to also check for fileUri being empty, e.g.:
Modifying the code in this way seems to fix the issue of the tests not running.
EDIT 2: It seems like there's another undocumented command test-explorer.run-this-file. Using this command in place of the test-explorer.run-file without the modifications above seems to work out-of-the-box. The only difference between these seems to be in the registration: (in main.ts)
I'm not sure what the difference for these two commands is intended to be, but it seems run-this-file is the right one, as triggering the action from command palette also triggers the run-this-file command. So maybe this could be as easy fix as changing the documentation to refer to test-explorer.run-this-file instead of test-explorer.run-file?
The text was updated successfully, but these errors were encountered:
a quick fix for this issue is to change the condition to also check for fileUri being empty
That's strange, this change shouldn't make any difference since the empty string is considered falsy by javascript, i.e. if fileUri is "" then !fileUri is true.
I'm not sure what the difference for these two commands is intended to be
test-explorer.run-this-file is added to the editor's context menu if testExplorer.addToEditorContextMenu is set to true. When the command is called from the context menu, its first argument is set to a vscode.Uri instead of a string, that's why I created a separate command for that.
I documented the commands for use in keybindings, assuming that they would be called without any arguments in that case. I'm a bit surprised that vscodevim calls them with an argument.
I have vscodevim extension installed and have mapped the test-explorer.run-file command in normal mode to
<leader>m
:(I've also tried
vim.normalModeKeyBindingsNonRecursive
)The command seems to get executed when using
<leader>m
(at the bottom status bar I see it running test-explorer.run-file), but then nothing happens. No tests get run. This only happens when triggering via the Vim key binding, as using the "Test Explorer: Run tests in current file" straight from command palette does not have this issue.Triggering other commands like "test-explorer.run-all" and "test-explorer.run-test-at-cursor" do seem to work via Vim keybindings, so I'm wondering if there's something special about the run-file command that makes it incompatible with the way Vim keybindings work.
Any ideas?
EDIT: "Solved it". I did some further digging and it seems like the
fileUri
is passed as empty string toutils.runTestsInFile
when run using the vim keybinding. Don't yet know why this happens, but as there is already a fallback tovscode.window.activeTextEditor.document.uri.toString()
whenfileUri
is not defined, a quick fix for this issue is to change the condition to also check forfileUri
being empty, e.g.:Modifying the code in this way seems to fix the issue of the tests not running.
EDIT 2: It seems like there's another undocumented command
test-explorer.run-this-file
. Using this command in place of thetest-explorer.run-file
without the modifications above seems to work out-of-the-box. The only difference between these seems to be in the registration: (in main.ts)I'm not sure what the difference for these two commands is intended to be, but it seems
run-this-file
is the right one, as triggering the action from command palette also triggers therun-this-file
command. So maybe this could be as easy fix as changing the documentation to refer totest-explorer.run-this-file
instead oftest-explorer.run-file
?The text was updated successfully, but these errors were encountered: