nvim-neotest / neotest

An extensible framework for interacting with tests within NeoVim.
MIT License
2.26k stars 110 forks source link

E5108: Error executing lua ...plenary/async/async.lua:14:The coroutine failed with this message: Vim:E117: Unknown function: test#test_file #37

Closed zeitchef closed 2 years ago

zeitchef commented 2 years ago

Hi there, migrating from vim-ultest and I'm stricken with the following error when calling lua require('neotest').run.run():

Screen Shot 2022-06-22 at 17 02 19

Here's my current config:

    use {
      'nvim-neotest/neotest',
      requires = {
        'nvim-lua/plenary.nvim',
        'nvim-treesitter/nvim-treesitter',
        'antoinemadec/FixCursorHold.nvim',
        'nvim-neotest/neotest-vim-test',
      },
      config = function()
        require('neotest').setup {
          adapters = {
            require 'neotest-vim-test',
          },
        }
      end,
    }

Any idea what I'm missing?

rcarriga commented 2 years ago

You need to install vim-test to use vim-test adapter :smile:

zeitchef commented 2 years ago

Missed that line in the docs - thanks! 😄

zeitchef commented 1 year ago

@rcarriga This has worked great for weeks, but recently a version of this error has cropped up:

Screen Shot 2022-10-15 at 14 00 16

And the config:

use({
    "nvim-neotest/neotest",
    requires = {
        "nvim-lua/plenary.nvim",
        "nvim-treesitter/nvim-treesitter",
        "antoinemadec/FixCursorHold.nvim",
        "haydenmeade/neotest-jest",
    },
    config = function()
        require("neotest").setup({
            adapters = {
                require("neotest-jest")({
                    jestCommand = "npm test --",
                    env = { CI = true },
                    cwd = function()
                        return vim.fn.getcwd()
                    end,
                }),
            },
            icons = {
                running = "↻",
            },
        })
    end,
})

I'm quite certain it's all in order. Any idea what's happening here?

rcarriga commented 1 year ago

It's unrelated to this issue. It looks like it's related to recent changes to use a second neovim instance for parsing. I've added better error handling so you won't see the error being raised. The underlying problem will still occur though, can you enable info logging by adding log_level = vim.log.levels.INFO to your setup table and paste it here after reproducing the issue? Also what version of neovim are you using?

zeitchef commented 1 year ago

NVIM v0.9.0-dev-47-gcfdb4cbad-dirty

This cleared up the error message, but when trying to reproduce the error there are no messages being logged in ~/.cache/nvim/neotest.lua which is where I would expect the logs to be.

rcarriga commented 1 year ago

With the newest release of neovim, the log file is moved to vim.fn.stdpath("log") which is usually in ~/.local/state/nvim

zeitchef commented 1 year ago

Thanks for that. Unfortunately, logs are not super useful:

INFO | 2022-10-17T16:42:35Z+0200 | ...te/pack/packer/start/neotest/lua/neotest/config/init.lua:270 | Configuration complete
INFO | 2022-10-17T16:43:36Z+0200 | ...te/pack/packer/start/neotest/lua/neotest/config/init.lua:270 | Configuration complete
INFO | 2022-10-17T16:44:52Z+0200 | ...te/pack/packer/start/neotest/lua/neotest/config/init.lua:270 | Configuration complete

In any case, I'm not hitting the error anymore so tests are running. I have a separate issue where neotest reports a failing test when in fact it's not, but I'll file a separate bug ticket.