nvim-lua / plenary.nvim

plenary: full; complete; entire; absolute; unqualified. All the lua functions I don't want to write twice.
MIT License
2.7k stars 286 forks source link

Plenary Busted Testing breaks with usage of new `vim.cmd` syntax #453

Open ziontee113 opened 1 year ago

ziontee113 commented 1 year ago

Here I have an example:

describe("new vim.cmd syntax", function()
    it("doesn't work", function()
        vim.cmd.edit("/home/username/.config/nvim/init.lua")
    end)
end)

If I run this test, I will get the error

...username/.config/dev-nvim/MAGO/tests/MAGO/lib/sample_spec.lua:3: attempt to index field 'cmd' (a function value)

This code works just fine

describe("new vim.cmd syntax", function()
    it("works", function()
        local cmd = "e " .. "/home/username/.config/nvim/init.lua"
        vim.cmd(cmd)
    end)
end)

Is there a way to fix this? Thank you very much.

chipsenkbeil commented 5 months ago

@ziontee113 did you find out why this is happening? I'm writing tests for a plugin with another plugin as a dependency, and that plugin uses vim.cmd.edit, which throws this error.