Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Plenary's global `busted` definitions get picked up by LuaLS

Open
#593 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
lua
Domain
testing, tooling

Research direction

Start by locating Plenary's bundled busted implementation and the global assignments it exposes, then reproduce how LuaLS indexes those definitions. Decide on a solution that prevents the bundled globals from being selected while preserving existing plugin behavior; done means real busted definitions are used for navigation without breaking Plenary tests.

Written by the indexing model from the issue text.

Description

Hello.

Plenary has its own implementation of busted, and just like the real busted it defines a bunch of global variables. This is a problem when using LuaLS because these definitions will be added to the global namespace even if I never require their source file because LuaLS sees a global assignment and adds the variable regardless of whether the file is ever sourced. I use the real busted for my tests, so this means that jumping to the definition will jump to the wrong functions.

How can we fix this? I can think of two solutions:

  • Use string variables and indices to assign to _G, i.e. instead of describe = mod.describe use local name = 'describe'; _G[name] = mod.describe, this will stop the language server from adding the definition.
  • Move the plenary busted functionality to a separate plugin that plugin authors can packadd before running tests. Then I don't have to install the plenary busted plugin and everything is fine.

Personally I think the second option would be better because it does not disrupt any existing plugins that depend on it, but it is a bit uglier in the code. What do you think? Any other idea?

Dominant language
Lua
Stars
3.5k
Forks
340
PR merge metrics
No merged PRs in 30d

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nvim-lua/plenary.nvim

All issues in nvim-lua/plenary.nvim

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.