rcarriga / vim-ultest

The ultimate testing plugin for (Neo)Vim
MIT License
385 stars 15 forks source link

Question about the relationship to vim-test #20

Closed farzadmf closed 3 years ago

farzadmf commented 3 years ago

Describe the bug For a go test file, the commands don't seem to work properly.

Let's say I open a ..._test.go file, when I run :TestFile, it runs all the tests, and when I do :TestNearest, it correctly run the test I'm in using the following command (I'm using richgo for my go tests):

richgo test -run '\''MyTest$'\'' ./parent/child/current'; richgo test -run 'MyTest$' ./parent/child/current

However, when I do :UltestNearest, I see no Go files in /parent

I open vim in ./parent directory and I go to the file ./parent/child/current/file_test.go, and that's where I'm trying to run the tests

Also, I'm not sure if I see this error because of what's happening above, but I thought I mention this too.

When I run :UltestSummary, I see the following error:

Error detected while processing function ultest#summary#toggle[4]..ultest#summary#open[2]..<SNR>484_OpenNewWindow[29]..<SNR>484_FullRender[2]..<SNR>484_Clear:
line    2:
E118: Too many arguments for function: clearmatches

To Reproduce I think the explanation covers this part

Expected behavior I was expecting for vim-ultest to mimic what vim-test does, with added features

Screenshots Here's a screenshot of the output. Maybe it's worth noting that the right border of the box seems to be missing inside tmux. when I run it outside of tmux, the box seems to be fine ....... actually, I lied! I exited and tried again and it was find inside of tmux, but I'm keeping the screenshot just in case 🙂 image


Sorry if I'm bothering you with all the issues I'm creating, but the plugin seems to be very promising and useful I'm doing my best to use it, but I'm not able to succeed

rcarriga commented 3 years ago

Thanks for the report, not too many at all! Delighted to be finding these issues!

So the issue with clearmatches has been resolved (see #19).

The issue with the border box has happened to me rarely but I can't seem to reproduce reliably, I will attempt again later.

The main issue with the runner is odd, it should be doing the exact same as vim-test. Can you post the logs after doing ULTEST_LOG_LEVEL=DEBUG ULTEST_LOG_FILE=ultest.log nvim <test-file> so I can see what is going on?

farzadmf commented 3 years ago

Thank you @rcarriga for your reply. I tried to debug a bit, and I think it has something to do with file paths.

I think vim-test will add a ./ at the beginning of the file, while ultest is passing the full path to it, so I think we end up with a file that's not existent. Let's say the file I'm on is in /data/temp/whatever/my_test.go, when the path is ultimately passed to vim-test, it's something like ./data/temp/..., which, of course, doesn't point to any existing file.

I tried to change expand("%:p") to expand("%") in the function ultest#run_nearest() (I was testing :UltestNearest), but it didn't help.

I didn't include the logs since I'm testing this with my company's code, so I don't want to get into any trouble, but if you think it helps, I can try to see if I can work out something (changing the names etc.)

rcarriga commented 3 years ago

OK no problem of course I understand with company code. Looking at it now you're right, vim-test does some odd handling of the file paths in go that doesn't happen anywhere else.... I will try and work around it

rcarriga commented 3 years ago

Switched to using relative paths, turns out there was also an issue with the go runners that don't build their arguments correctly but was able to compensate.

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 2.5.6 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

farzadmf commented 3 years ago

That's great, thank you @rcarriga

The issue with clearmatches seems to be still there for me :slightly_frowning_face: , when I run :UltestSummary, I see this:

Error detected while processing function ultest#summary#toggle[4]..ultest#summary#open[2]..<SNR>495_OpenNewWindow[29]..<SNR>495_FullRender[2]..<SNR>495_Clear:
line    3:
E118: Too many arguments for function: clearmatches
rcarriga commented 3 years ago

Oh sorry about that didn't realise there is an issue with 8.1 patch detection (found it here https://github.com/neovim/neovim/issues/9635), I've added a check for nvim 0.5.0 which should work

farzadmf commented 3 years ago

I appreciate it @rcarriga for you being super fast at replying and resolving these issues. Keep it up :+1: