olimorris / neotest-phpunit

🧪 Neotest adapter for PHPUnit
MIT License
29 stars 22 forks source link

Cannot make it work #4

Closed haringsrob closed 2 years ago

haringsrob commented 2 years ago

Hi,

Very curious about using this. However I cannot seem to make it work. Always receiving No tests found

I have a composer(laravel) project with phpunit.xml and composer.json in the root.

Path to the test is tests/Unit/ExampleTest.php

Test content:

<?php

namespace Tests\Unit;

class ExampleTest extends TestCase
{
    /**
     * A basic test example.
     *
     * @return void
     */
    public function test_example()
    {
        $this->assertTrue(true);
    }
}

If you like more info let me know, can also setup screen sharing if it would help.

I tested dumping NeotestAdapter.is_test_file, and it does "see" the test.

olimorris commented 2 years ago

Firstly, if you open Neovim into the root of the adapter and try running the tests, does it work?

Secondly, could you paste the log files into this issue?

haringsrob commented 2 years ago

Hey @olimorris

Checked it in the package root but it seems to not work either.

Could you tell me which logs and where I can find them?

Thanks.

olimorris commented 2 years ago

That would suggest it's not configured. Can you share your full neotest config?

Neovim logs are in the ~/.cache/ folder.

haringsrob commented 2 years ago

Hey,

There's no additional logs being written when running anything.

My setup is like this:

    use {
        "nvim-neotest/neotest",
        requires = {
            "nvim-lua/plenary.nvim",
            "nvim-treesitter/nvim-treesitter",
            "antoinemadec/FixCursorHold.nvim",
            "olimorris/neotest-phpunit"
        },
        config = function ()
            require('neotest').setup({
                adapters = {
                    require('neotest-phpunit'),
                }
            })
        end
    }
olimorris commented 2 years ago

Weird. Your config is absolutely correct. And sorry, the log is located at: /Users/Oli/.local/state/nvim/neotest.log

Can you send over the logs when you try and run lua require('neotest').run.run() on a test?

haringsrob commented 2 years ago

There is quite a bit there but:

ERROR | 2022-07-19T15:24:18Z+0200 | ...te/pack/packer/start/neotest/lua/neotest/client/init.lua:240 | Couldn't find positions in path /Users/rob/.local/share/nvim/site/pack/packer/start/neotest-phpunit/tests/Examples/some/deep/nesting/NestingTest.php ...acker/start/neotest-phpunit/lua/neotest-phpunit/init.lua:29: stack overflow

Here is the full log https://pastebin.com/6ZWVq8Lm

haringsrob commented 2 years ago

hey @olimorris that error is unrelated.

The issue was due to treesitter somehow not having installed the language.

The error above is due to a debug line I added.

Everything works perfect out of the box.

Thanks you for helping me figure it out!

olimorris commented 2 years ago

Haha damnit! Should have spotted that.

🥳 . Well this is epic news anyway. I really hope you love the adapter and it improves your daily workflow with Neovim. I tend to write a lot of Ruby these days but have so much ❤️ for Laravel that I thought I should add to the community and create a PHPUnit adapter.

Any enhancements that you spot, please create an issue and we can discuss them. Enjoy!