nvim-neotest / neotest-go

MIT License
125 stars 43 forks source link

Test summary marked as failed even if all test is succeded #41

Closed minizilla closed 1 year ago

minizilla commented 1 year ago
Screenshot 2023-04-06 at 12 18 36

As you can see all the test is passed, but in the summary the test file is marked as failed.

rstcruzo commented 1 year ago

I have seen this too. The cause of this is the following if statement https://github.com/nvim-neotest/neotest-go/blob/main/lua/neotest-go/init.lua#L192-L196 . The adapter won't find a test result for the whole file, so it assumes it failed.

sergii4 commented 1 year ago

Hi @minizilla, thank you for bringing this up! @rstcruzo you are absolutely right.

In Go itself we have package level summary then test function level summary and no file level in between.

We can set up unknown status or keep an eye on all nested statuses and set pass if all passed otherwise failed. I vote for file level be passed/failed depends on nested tests results. @akinsho WDYT?

@rstcruzo do you want to open a PR? I will have time this weekend and can contribute if there are no candidates

akinsho commented 1 year ago

@sergii4 I think checking the results of each test in a file and determining file level status based on the file's tests makes sense. I can't don't know of any edge cases right now but I'd also be inclined to find a way to have neotest omit file level info for go since I guess some other languages maybe work similarly and it might be better to work at the levels that are supported 🤷🏾‍♂️. Either way I think is fine.

Jomik commented 1 year ago

I personally think it makes senses to have it be failed if there is any failed test, unknown if there is a test that hasn't run yet, else we can assume that all tests beneath passed and show passed?

sergii4 commented 1 year ago

@minizilla @rstcruzo you are welcome to pull PR's branch to test it locally if you are interested in

minizilla commented 1 year ago

This looks good, now the file is marks as succeeded. Thanks for the good works.