V13Axel / neotest-pest

Neotest adapter for Pest 2.0
MIT License
14 stars 4 forks source link

No test output file found #8

Closed Mourishitz closed 2 months ago

Mourishitz commented 2 months ago

Hey, I just installed the latest version of AstroNvim (which does support neotest on its community packages using Lazy).

I just overwrote the plugin like this: image

Check the full file here

All of a sudden, it does not work properly and gives this output:

image

I've saw the issue #5 with similar problems, but those did not work for me.

can I at least get a hint of what could be causing that to pop up?

noreason commented 2 months ago

In my experience, this is usually caused by the command you specified not actually running, or crashing.

In your config, you set the command as vendor/bin/pest (which is the default by the way so you don't have to set it) and explicitly set sail to disabled. So really nothing is wrong here that I can tell.

My guess, and sorry but I have to ask even if it sounds trivial, do you actually have pest installed in the project? Meaning, can you successfully run vendor/bin/pest from the root directory and see the tests run? Does it run to completion?

Let me know if the command runs fine or if it fails, then I can try to help you out a bit more.

Mourishitz commented 2 months ago

Sure! It is not trivial at all, could really be an issue if Pest was not configured properly..

Turns out it is a valid command image

Mourishitz commented 2 months ago

Also, I forgot to mention but I already tried variants of this command such as ./vendor/bin/pest

noreason commented 2 months ago

Ok thanks, my next guess is that there is an issue determining the project root maybe? I'm not familiar with AstroVims plugins, but maybe it has a projects style plugin or another plugin that is adjusting the working directory.

Check and see that your current working directory is the same as where you just ran that vendor/bin/pest --version command. You can check this by typing :pwd inside neovim with your test file open. It should output a path that should match the exact path that you are able to run vendor/bin/pest from.

Mourishitz commented 2 months ago

Yes sure, it may have something to do with it... I will read some of the Astrocore documentation but for now, the :pwd command prints the exact path it should have..

image

Maybe the project root variable or reference used in the plugin is not the same, I will find that out and return it here.

V13Axel commented 2 months ago

Also hate to ask what seems like a silly question: When you run just vendor/bin/pest via your shell to try and run your tests, does that work?

Mourishitz commented 2 months ago

Sure it does! Here is an example of it running image

V13Axel commented 2 months ago

Hmm. My next thought is to add log_level = vim.log.levels.DEBUG, to your neotest config, and then tail the contents of ~/.local/state/nvim/neotest.log to see what it says

Mourishitz commented 2 months ago

Here ya go! I just updated it like that: image image

I just spit out the entire log file (all clear, just ran the command once) and its available on this gits: https://gist.github.com/Mourishitz/ad8127f8ec0a04a25a4e3727f2dc3d53

noreason commented 2 months ago

I just reproduced this on my end.

You'll need to pull the most recent version of this plugin which has the PR i submitted that closed out #7...

That should™ solve your problem.


7, not #5, but either way you should pull the new change and be good

V13Axel commented 2 months ago

Ah, this makes it clear to me:

invalid node type at position 196 for language php

That's happening because you're using the latest tree-sitter and not the latest (as of a couple hours ago) version of this repo. Update to the latest and you ought to I think maybe be good to go.

However, if you're using any heredocs with language injections, you'll instead want to pin tree-sitter to the older commit (as described by another user in #7) and then pin this plugin to the commit just before latest.

To be clear, that's stuff like


$someValue = <<<JSON
    { 'some': 'json here' }
JSON;

^ There's a tree-sitter bug right now that will cause neovim to segfault if you do that. =]

V13Axel commented 2 months ago

Heh, just realized @noreason beat me to responding - Thank you sir. :slightly_smiling_face:

Mourishitz commented 2 months ago

Yeah, it kind of worked.. When I run it under cursor or file it goes perfect! image image image

Now, for some reason it still logs out errors when trying to run tests for the project.. What I mean by "run tests for the project" is running on this command: image

Mourishitz commented 2 months ago

This might be some problem with my vim config.. I can close the issue for now (if it is ok to you guys)

I would like to really thank you for helping me out! It is working great

V13Axel commented 2 months ago

I keep my tests under {projectroot}/tests, so I just have my "run project" keybind setup like this:

vim.keymap.set('n', '<leader>tr', function() require('neotest').run.run("tests") end)

Maybe using a relative path would work for you too? Either way, definitely seems outside of the scope of this issue, so I'm gonna call it closed.