adrigzr / neotest-mocha

Neotest runner for Mocha test framework
9 stars 9 forks source link

nvim_treesitter breaks neotest-mocha #17

Closed geoffcorey closed 1 month ago

geoffcorey commented 1 month ago

Using the latest Astrovim 4.20.1 it is running the latest release of nvim-treesetter which breaks neotest-mocha. Result of running a single test (Tt)

Error: No test files found: "test"

It appears this is an issue is being worked by other neotest- This seemed to fix neotest-jest

https://github.com/nvim-neotest/neotest-jest/issues/99

MisanthropicBit commented 1 month ago

Thanks for reporting the issue. It happens once in a while. I'll make a fix for it and add a note to the README, requiring nvim-treesitter v0.9.2+.

MisanthropicBit commented 1 month ago

Actually, the PR I linked above has already changed function to function_expression and the queries for matching on describe just match the second argument as anything (_).

I tried to run a test in a local test repo running v0.9.2-189-g8e1df60 (git describe) of nvim-treesitter, neovim v0.9.5, neotest v5.0.0 and it works fine. Can you post the test that is failing, verify that you are running v0.9.2 of nvim-treesitter (which you probably already did), and ensure you fulfil the requirements listed in the README?

geoffcorey commented 1 month ago

Ok, this prompted me to do a clean install of AstroVim and drive down on this more. I had an error in my neotest.lua config and needed .mocharc defined on my project. I added mocha as a global because the default npm test is doing multiple commands in the projects I work with.

Thank you for your help! You can close this ticket. For reference here are my AstroVim configs to use this plugin with a tweak to test execution in neotest.lua

https://github.com/geoffcorey/dotfiles/tree/main/.config/nvim