busted extends assert with extra functions such as assert.same, assert.equal, etc. These fail llscheck calls.
assert.same({ "foo" }, { "bar" })
Gets this error
file.lua:1:16-19: undefined-field: Undefined field `same`.
Busted also defines a number of functions such as describe, it, after_each, before_each, etc. To disable those, I use the following .luarc.json
{
"Lua.diagnostics.libraryFiles": "Disable",
"Lua.workspace.checkThirdParty": "Disable",
"Lua.workspace.library": [
"/home/runner/work/nvim-best-practices-plugin-template/nvim-best-practices-plugin-template/deps/neovim/runtime/lua",
"/home/runner/work/nvim-best-practices-plugin-template/nvim-best-practices-plugin-template/deps/neodev.nvim/types/stable"
],
"diagnostics.globals": [
"after_each",
"before_each",
"describe",
"it",
"vim"
],
"runtime.version": "LuaJIT",
"workspace.checkThirdParty": "Disable"
}
This works for describe, it, after_each, before_each but not for assert.same, assert.equal, etc. Probably I'm guessing because Busted is extending Lua's built-in assert and it isn't a "new" function.
How should I go about ignoring issues for just these assert.* functions? I tried adding assert, assert.same, etc to the diagnostics.globals with no luck.
Ideally I'd like to avoid adding --- @diagnostic disable: undefined-field to all of my test files but that is what I've been doing to get around this issue so far.
busted extends
assertwith extra functions such asassert.same,assert.equal, etc. These failllscheckcalls.assert.same({ "foo" }, { "bar" })Gets this error
Busted also defines a number of functions such as
describe,it,after_each,before_each, etc. To disable those, I use the following .luarc.json{ "Lua.diagnostics.libraryFiles": "Disable", "Lua.workspace.checkThirdParty": "Disable", "Lua.workspace.library": [ "/home/runner/work/nvim-best-practices-plugin-template/nvim-best-practices-plugin-template/deps/neovim/runtime/lua", "/home/runner/work/nvim-best-practices-plugin-template/nvim-best-practices-plugin-template/deps/neodev.nvim/types/stable" ], "diagnostics.globals": [ "after_each", "before_each", "describe", "it", "vim" ], "runtime.version": "LuaJIT", "workspace.checkThirdParty": "Disable" }This works for
describe,it,after_each,before_eachbut not forassert.same,assert.equal, etc. Probably I'm guessing because Busted is extending Lua's built-inassertand it isn't a "new" function.How should I go about ignoring issues for just these
assert.*functions? I tried addingassert,assert.same, etc to thediagnostics.globalswith no luck.Ideally I'd like to avoid adding
--- @diagnostic disable: undefined-fieldto all of my test files but that is what I've been doing to get around this issue so far.