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

bug: neotest-busted is checking for busted_command on non-lua busted projects #24

Closed
4 tasks done
polirritmico opened this issue Oct 11, 2024 · 1 comment · Fixed by #26
Closed
4 tasks done
Assignees
Labels
bug Something isn't working

Comments

@polirritmico
Copy link

Did you check docs and existing issues?

  • I have read the documentation
  • I have searched the existing issues
  • I have searched the existing issues of plugins related to this issue (if relevant)
  • I have tried setting log_level to vim.log.levels.debug in neotest.setup and examined the logs.

Neovim version (nvim -v)

NVIM v0.10.2 Build type: Release LuaJIT 2.1.1716656478

Operating system/version

Gentoo Linux

Describe the bug

Since neotest-busted is validating the busted_command path during setup, when it is set to a local relative path and neotest is loaded in a non-lua busted project dir (e.g. a python project), require("neotest").setup(...) throws this error:

[neotest-busted]: Invalid config: busted command in configuration is not executable

Maybe related to nvim-neotest/neotest#428

Config:

{
  "nvim-neotest/neotest",
  dependencies = {
    "nvim-neotest/nvim-nio",
    "nvim-lua/plenary.nvim",
    "antoinemadec/FixCursorHold.nvim",
    "nvim-treesitter/nvim-treesitter",
    -- Adapters
    "nvim-neotest/neotest-python",
    "MisanthropicBit/neotest-busted",
  },
  opts = {
    busted = { busted_command = ".tests/data/nvim/lazy/busted/bin/busted" },
    python = { dap = { justMyCode = true }, runner = "pytest" },
  },
  config = function(_, opts)
    opts.adapters = {
      require("neotest-python")(opts.python),
      require("neotest-busted")(opts.busted),
    }
    require("neotest").setup(opts)
  end,
  event = "VeryLazy", -- to trigger the error on startup
},

Expected Behavior

Don't check busted_command for non-lua busted projects or when the adapter is not used.

Output of :checkhealth neotest-busted if relevant

No response

neotest log output if relevant

No response

Steps To Reproduce

Set busted_command to a local relative path. Then require Neotest on a non-lua busted project.

@polirritmico polirritmico added the bug Something isn't working label Oct 11, 2024
@MisanthropicBit MisanthropicBit self-assigned this Oct 14, 2024
@MisanthropicBit
Copy link
Owner

MisanthropicBit commented Oct 14, 2024

Thanks for submitting another bug 🙂 I agree that this is annoying. I'm back from vacation now so I can get this fixed!

The linked neotest issue seems to suggest that there is no way to prevent it from loading an adapter and I recall this being true after having looked at many neotest logs.

Since it would be difficult to consistently detect if a project is a non-lua project and there might not be a way to detect when neotest-busted is not used, I think a more straight-forward solution is to simply remove the check and have users rely on :checkhealth neotest-busted instead.

Another fix might be to allow passing a function to busted_command and setting it programatically based on the current directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants