lawrence-laz / neotest-zig

Test runner for Zig in Neovim using Neotest backend.
MIT License
21 stars 4 forks source link

Hang on non-zig repo #5

Closed folliehiyuki closed 8 months ago

folliehiyuki commented 9 months ago

Describe the bug

Inside a repository containing no zig file (and there are no zig files in any of its parent directories either), invoking neotest.run.run() hangs forever.

Steps To Reproduce

Minimal setup:

require('neotest').setup {
  adapters = {
    require('neotest-go'),
    require('neotest-zig'),
  },
}

Current behavior

neotest hangs on Parsing tests step. There is no log when debug logging is enabled. This seems to be caused by this line here https://github.com/lawrence-laz/neotest-zig/blob/5cdcd36a67a4338e83b402e2fd6196ecbd889aed/lua/neotest-zig/init.lua#L12

I changed the match pattern to just *.zig, and everything seems fine. It might hang because of the recursive searching inside each parent directory.

Expected behavior

neotest-zig shouldn't block other adapters from running.

Environment

lawrence-laz commented 8 months ago

Hi, thanks for the report!

Just switching to *.zig misses some tests in nested folders for me, so I also added .git as an option to find root folder, which seems to cover all scenarios I currently see and no longer freezes directories without .zig files.

Could try out the latest version and see if this resolves the issue?

folliehiyuki commented 8 months ago

Your resolve is reasonable to me. Let me close the issue now.

Thanks for the quick response!