olimorris / neotest-rspec

🧪 Neotest adapter for RSpec. Works in Docker containers too
MIT License
90 stars 26 forks source link

Plenary issue and no tests found #14

Closed prdanelli closed 2 years ago

prdanelli commented 2 years ago

Hello. I'm not sure what might have changed, but the plugin seem not to be working anymore. I'm seeing the following error when I try and run :lua require('neotest').run.run() on an Rspec file:

E5108: Error executing lua ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:14: The coroutine failed with this message: Vim:E117: Unknown function: test#test_file
stack traceback:
        [C]: in function 'error'
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:14: in function 'callback_or_next'
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:40: in function 'step'
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:43: in function 'execute'
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:103: in function 'run'
        ...te/pack/packer/opt/neotest/lua/neotest/consumers/run.lua:30: in function 'run'
        [string ":lua"]:1: in main chunk
Press ENTER or type command to continue

Then, if i run it again, i see "No tests found":

image

Just incase it helps, my config is:

-- packer
  use {
    "nvim-neotest/neotest",
    requires = {
      "nvim-lua/plenary.nvim",
      "olimorris/neotest-rspec",
      "nvim-treesitter/nvim-treesitter",
      "antoinemadec/FixCursorHold.nvim",
      "nvim-neotest/neotest-plenary",
      "nvim-neotest/neotest-vim-test",
    },
    config = function() require("plugins.config.neotest") end,
    event = "BufEnter",
    module = { "neotest" },
  }

-- plugin
local plugin_loaded, neotest = pcall(require, "neotest")
if not plugin_loaded then
  return
end

neotest.setup {
  adapters = {
    require "neotest-rspec",
    require "neotest-vim-test" {
      ignore_file_types = { "vim", "lua" },
    },
  },
  diagnostic = false
}

I realise that the plugin is a work in progress, so if you have any idea as to what might have caused the recent break i'd be grateful to know. Thank you for your hard work.

olimorris commented 2 years ago

This is most odd. I tried lua require('neotest').run.run() and then triggered a full test run and get the following:

Screen Shot 2022-06-20 at 22 12 44@2x

Can you confirm that you've pulled the latest version down? Also could share the neotest logs? Also care to share the test itself?

We also have tests now within the adapter which test the core functionality and they're running just fine.

prdanelli commented 2 years ago

Ok, thank you @olimorris for confirming. It must be something local. I'll try and debug and see if I can work it out.

olimorris commented 2 years ago

The no test files thing is odd. I can dig through the logs and see what it says though.

Edit: Do you have a Gemfile in the root folder?

compactcode commented 2 years ago

Could be related to https://github.com/olimorris/neotest-rspec/pull/15

I'm having trouble running specs using the common naming conventions for class methods e.g. describe '.new' do

olimorris commented 2 years ago

Yep can confirm this is definately an issue. I'm beginning to think we're running out of road with the JSON RSpec formatter. I've raised an enhancement in #17 and will begin to look at creating a better formatter which will match Treesitter. If I can get the line_number of the named test from Treesitter then we're onto a winner!

olimorris commented 2 years ago

@prdanelli - Could I ask you to try the rspec-formatter branch at some point? I think I may have solved our problems by way of a custom gem. Unfortunately it's a dependency in your Gemfile right now but working on that.

olimorris commented 2 years ago

Update...removed the dependency on the gem now so should just be able to use as-is with your current config.

olimorris commented 2 years ago

@prdanelli I think we may have solved this issue with the latest push to main. I'll leave the ticket open for now.

prdanelli commented 2 years ago

Hello @olimorris, sorry for the belated reply, its been a long week. After updating the plugins, it seems that everything is working again and also fixed a bug I saw a couple of days ago where the icons where not changing to show the result of the test. Great work! 🎉