rcasia / neotest-java

Neotest adapter for Java.
MIT License
42 stars 23 forks source link

Setup funtion is buggy #89

Closed SOberhoff closed 6 months ago

SOberhoff commented 6 months ago

https://github.com/rcasia/neotest-java/blob/9af20dbc445f568b5f6b6f3241f07259ee95cfe8/plugin/neotest-java.lua#L12-L30

First, if the directory neotest-java doesn't exist, curl won't create it and will instead raise an error.

Second, curl writes some information to stderr even if it completes successfully, causing this function to raise an error regardless.

rcasia commented 6 months ago

The issue has been fixed in the code. Please review the changes. Thanks!

rcasia commented 6 months ago

I no longer get an error when the download is successful. But this still fails if the directory ~/.local/share/nvim/neotest-java hasn't been created beforehand.

I'm unable to reproduce it. Can you share the error message, please?

SOberhoff commented 6 months ago
Error while downloading:
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to open the file
Warning: ~/.local/share/nvim/neotest-java/junit-platform-console-
Warning: standalone-1.10.1.jar: No such file or directory
  0 2617k    0 16375    0     0   195k      0  0:00:13 --:--:--  0:00:13  197k
curl: (23) Failure writing output to destination

Besides running :NeotestJava setup this error can also be reproduced by running curl --output ~/.local/share/nvim/neotest-java/junit-platform-console-standalone-1.10.1.jar https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.10.1/junit-platform-console-standalone-1.10.1.jar. I'm using curl 8.4.0. Adding the --create-dirs flag overcomes this error.

rcasia commented 6 months ago

I merged a new patch. This should prevent the issue in any environment.

SOberhoff commented 6 months ago

Yeah, this does it.