-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: windows not supported #147
Comments
I'm actually not sure if it should run the nearest or the next one. According to neotest docs, |
Hey @santiagorendong and thanks for the bug report. I don't really have any control over what gets executed in terms of being "nearest". That's the responsibility of Neotest (the framework). But, like you say, a nil-check is definitively something we can do here. However, there should never be a nil-value for the https://github.com/fredrikaverpil/neotest-golang/blob/main/lua/neotest-golang/runspec/test.lua#L16 I don't have easy access to Windows and I'm currently also on vacation (no laptop) but I suspect more issues on that OS, as I haven't tested the adapter on it at all. But if you have the time, you can try editing that regex so that it works with backslashes and see if you can get a value for |
You could try something like this: string.match(pos.path, "(.+)[/\\]") Or perhaps better: local sep = package.config:sub(1,1)
string.match(pos.path, "(.+)" .. sep) |
I'll try and take a look. Don't worry about it for now, enjoy your vacations 🏖️ |
I haven't tested this myself on Windows yet, but if you like, you can give #149 a go by setting the branch and updating the plugin: {
"fredrikaverpil/neotest-golang",
branch = "windows",
}, It would also be super helpful if you could enable logging (see the README for details) and filter the log to only show neotest-golang entries and then post the log here. |
@santiagorendong I had a quick look at this today, and I've fixed some issues for running individual tests. For me on Windows 11 with Powershell, there's a bunch of weird ANSI codes and whatnot that gets printed and garbled into the command execution output. This does not happen on macOS (or Linux as far as I know). I've tried to mitigate some common ANSI codes by detecting them and stripping them out, but it's not perfect. Have a look at this to see what I mean:
Next, I'll have a look at running a directory of files, and a file of tests, as there's some issue there still remaining, preventing the test output to be parsed correctly... perhaps related to this ANSI code bonanza. |
Hi there, I didn't expect to you to get a draft going this quickly. I'll take a look now 😄 |
I ran some tests from a table (the one in the discussion related to this issue) and it still gave me the same error. Here are the logs after filtering... It does look like some ANSI codes are getting through as well as some weird stuff going on with the TestFunc name i.e. "TestLengthOfLastW', 'ord/single_word"`
|
Oh, I misread. I see you only worked on a single test as of right now, my bad. |
I'm not familiar with Lua nor building and using local packages in Neovim, but I'll try my best. |
I just fixed the remaining stuff. But there's a huge problem with this "Failed to decode JSON" as weird codes are injected at some point and garbles up the JSON output. I'll have a more thorough look a bit later. |
Here's a workaround for you, which on my end passes all my tests... First install # make gotestsum available on $PATH by installing it
go install gotest.tools/gotestsum@latest Then set the {
"nvim-neotest/neotest",
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
{
"fredrikaverpil/neotest-golang",
branch = "windows", -- set PR branch
},
},
config = function()
require("neotest").setup({
adapters = {
require("neotest-golang")({ runner = "gotestsum" }), -- Registration with config
},
})
end,
}, Instead of relying on the Neotest-provided mechanism of capturing output from stdout, |
On the other hand with the default test runner, I tried setting I think I'll stick with your suggestion of using |
That's great to hear! 🎉
Yes, I don't fully understand what is going on there either. I suspect that Windows terminals in general delegates processing to its "Console host". If this is true, this means different programs can behave differently. Did you ever try the Windows Terminal instead? Either way, I am going to merge this PR in, more or less as-is, since it enables the rudimental Windows support. But I'm going to hold off on adding docs to |
Did you check docs and existing issues?
Neovim version (nvim -v)
0.10.0
Operating system/version
Windows 10 Pro 22H2
Output from
:checkhealth neotest-golang
Describe the bug
When running the nearest test with
neotest.run.run()
and the cursor is under the definition of the last test in that file, it errors with the following output:Steps To Reproduce
func TestXxx
neotest.run.run()
Expected Behavior
Run the nearest test, no matter if it's under or above cursor.
Your Lua setup
The text was updated successfully, but these errors were encountered: