Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not seem to work on Windows #17

Open
derekthecool opened this issue Mar 28, 2024 · 1 comment
Open

Does not seem to work on Windows #17

derekthecool opened this issue Mar 28, 2024 · 1 comment

Comments

@derekthecool
Copy link

I'm running windows 11 and this does not seem to work for me. I had success with dotnet and dart test plugins using neotest. So I know basic features of neotest are working.

However, there seems to be trouble getting anything to run. Test detection works great, but running the tests and getting output does not work.

I'm running trying to run it for my neovim plugins. I've created a simple simple project to try out this plugin. I'm including those files here for reference.

There is just a single test with these contents

describe("My test test group --", function()
	it("should work", function()
		assert.are.same(1, 1)
	end)
end)

Which should work every time.

Running this command to test from the terminal works for me

 Starting...Scheduling: .\lua\tests\test_spec.lua

  ========================================
  Testing:        D:/Programming/neovim/test_neotest_with_plenary_runner/lua/tests/test_spec.lua
  Success ||      My test test group -- should work

  Success:        1
  Failed :        0
  Errors :        0
  ========================================
     Date      Time    Attr         Size   Compressed  Name
  ------------------- ----- ------------ ------------  ------------------------
  2024-03-27 08:57:41 D....            0            0  test_neotest_with_plenary_runner
  2024-03-27 21:33:14 D....            0            0  test_neotest_with_plenary_runner\lua
  2024-03-27 21:33:14 ....A           23           23  test_neotest_with_plenary_runner\lua\minimal_init.lua
  2024-03-27 08:59:18 D....            0            0  test_neotest_with_plenary_runner\lua\myplugin
  2024-03-27 08:59:18 ....A           40           40  test_neotest_with_plenary_runner\lua\myplugin\init.lua
  2024-03-27 09:00:24 D....            0            0  test_neotest_with_plenary_runner\lua\tests
  2024-03-27 09:00:24 ....A          115           91  test_neotest_with_plenary_runner\lua\tests\test_spec.lua
  ------------------- ----- ------------ ------------  ------------------------
  2024-03-27 21:33:14                178          154  3 files, 4 folders

Here is an image of the test tree which just shows spinning loading bars forever
image

I've already started diving into the code and will create a pull request to help compare my work and get more suggestions.
I've found problems with getting the init.lua path and also trying to generate the new path to the run_tests.lua script.
But, even after these fixes I'm still stuck! What could be wrong? I'm not sure where to start debugging next.

@derekthecool
Copy link
Author

Unfortunately even after the recent updates this still does not work on my Windows setup.
I have no problems using my arch Linux computer setup.
The problems I'm seeing with Windows is the same as before - the tests are discovered but once you try to run any of them the cool backslash + forward slash spinner just goes and goes forever.

I'm running neovim version 0.10.2 and Lazy plugin manager shows I have commit 3523adc checked out from the master branch for this plugin.

Here is another screenshot
image

Running the command :PlenaryBustedFile % works fine and produces this output

Scheduling: C:/Users/dlomax/AdventOfCode\2024/lua/day_1_spec.lua

========================================
Testing:        C:/Users/dlomax/AdventOfCode/2024/lua/day_1_spec.lua
Home directory is: C:\Users\dlomax
Success ||      2024 day 1 Make sure test rig works
Success ||      2024 day 1 Data file exists
Success ||      2024 day 1 Input helper can be sourced
Success ||      2024 day 1 Input helper returns a non-empty table
Success ||      2024 day 1 Day 1 can be sourced
Success ||      2024 day 1 Day 1 line 1 input matches
Success ||      2024 day 1 Processing input returns 2 tables
Success ||      2024 day 1 Processing input returns 2 sorted tables
Success ||      2024 day 1 Caluculate the distance array for simple example
Success ||      2024 day 1 Calculate the total distance for simple example
Success ||      2024 day 1 Day 1 part 1 solution
Success ||      Day 1 part 2 Example similarity score
Success ||      Day 1 part 2 Example total similarity score
Success ||      Day 1 part 2 Part 2 solution

Success:        14
Failed :        0
Errors :        0
========================================

And running from the command-line has similar results

  ✗ nvim --headless -c "PlenaryBustedDirectory ."           
E576: Error while reading ShaDa file: last entry specified that it occupies 58 bytes, but file ended earlier
Starting...Scheduling: .\2024\lua\day_1_spec.lua

========================================
Testing:        C:/Users/dlomax/AdventOfCode/2024/lua/day_1_spec.lua
Home directory is: C:\Users\dlomax
Success ||      2024 day 1 Make sure test rig works
Success ||      2024 day 1 Data file exists
Success ||      2024 day 1 Input helper can be sourced
Success ||      2024 day 1 Input helper returns a non-empty table
Success ||      2024 day 1 Day 1 can be sourced
Success ||      2024 day 1 Day 1 line 1 input matches
Success ||      2024 day 1 Processing input returns 2 tables
Success ||      2024 day 1 Processing input returns 2 sorted tables
Success ||      2024 day 1 Caluculate the distance array for simple example
Success ||      2024 day 1 Calculate the total distance for simple example
Success ||      2024 day 1 Day 1 part 1 solution
Success ||      Day 1 part 2 Example similarity score
Success ||      Day 1 part 2 Example total similarity score
Success ||      Day 1 part 2 Part 2 solution

Success:        14
Failed :        0
Errors :        0
========================================

So something is still strange with the plugin.

I've already tried digging through the source without much success. I want to help resolve the problem but could use
some suggestions on where to to get started.
For example, I'm guessing there is logging some where because of the configuration value for log level, however I can't find where these logs would be.

Here is my entire configuration for reference

    {
        'nvim-neotest/neotest',
        enabled = true,
        -- stylua: ignore start
        keys = {
            { "<leader>tt", function() require("neotest").run.run(vim.fn.expand("%")) end,                      desc = "Run File" },
            { "<leader>tT", function() require("neotest").run.run(vim.uv.cwd()) end,                            desc = "Run All Test Files" },
            { "<leader>tr", function() require("neotest").run.run() end,                                        desc = "Run Nearest" },
            { "<leader>tl", function() require("neotest").run.run_last() end,                                   desc = "Run Last" },
            { "<leader>ts", function() require("neotest").summary.toggle() end,                                 desc = "Toggle Summary" },
            { "<leader>to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
            { "<leader>tO", function() require("neotest").output_panel.toggle() end,                            desc = "Toggle Output Panel" },
            { "<leader>tS", function() require("neotest").run.stop() end,                                       desc = "Stop" },
            -- stylua: ignore end
        },
        dependencies = {
            -- Plugin requirements
            'nvim-neotest/nvim-nio',
            'nvim-lua/plenary.nvim',
            'nvim-treesitter/nvim-treesitter',
            'antoinemadec/FixCursorHold.nvim',

            -- Test runners
            {
                'nvim-neotest/neotest-plenary',
                -- Working on solving an issue with this plugin right now. It does not work on windows.
                -- dev = true,
            },
            'nvim-neotest/neotest-python',
            'vim-test/vim-test',
            'Issafalcon/neotest-dotnet',
            'sidlatau/neotest-dart',
        },

        log_level = vim.log.levels.TRACE,
        config = function()
            require('neotest').setup({
                adapters = {
                    require('neotest-plenary'),
                    require('neotest-dotnet'),
                    require('neotest-python'),
                    require('neotest-dart')({
                        command = 'flutter',
                        use_lsp = true,
                    }),
                },
            })

            vim.keymap.set('n', '<leader>tt', function()
                require('neotest').run.run()
            end, { silent = true, desc = 'Run neotest' })
        end,
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant