You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I hope everything is going well. I love seeing the progress this project has made so far with the latest versions.
These days I've been trying the debugging capabilities with local-lua-debugger-vscode, and it has worked well except for some problems with the imports.
If I require the helpers module from the foo_spec test file, then depending if I'm running a normal test through neotest or a debug test through dap, I have to adjust the require path:
-- in foo_spec.lualocalfoo=require("foo")
localhelpers=require("tests.helpers") -- this fail
The above code would work fine using :lua require("neotest").run.run() or nvim -l tests/busted.lua tests from the command line, but it would fail using :lua require("neotest").run.run(strategy="dap").
It complains that it couldn't find the tests.helpers module with this error:
Error → /home/<user>/repro/case/tests/foo_spec.lua @ 2
local-lua-debugger-vscode should load helpers in the correct path
/home/<user>/repro/case/tests/foo_spec.lua:4: module 'tests.helpers' not found:
no field package.preload['tests.helpers']
cache_loader: module tests.helpers not found
cache_loader_lib: module tests.helpers not found
no file './src/tests/helpers.lua'
no file './src/tests/helpers/tests/helpers.lua'
no file './src/tests/helpers/init.lua'
no file 'lua/tests/helpers.lua'
no file 'lua/tests/helpers/init.lua'
no file '/home/<user>/tmp/local-lua-debugger-vscode//debugger/tests/helpers.lua'
no file '/home/<user>/repro/case/.tests//data/nvim/lazy-rocks/busted/share/lua/5.1/tests/helpers.lua'
no file '/home/<user>/repro/case/.tests//data/nvim/lazy-rocks/busted/share/lua/5.1/tests/helpers/init.lua'
no file '/home/<user>/repro/case/tests/tests/helpers.lua'
no file './csrc/tests/helpers.so'
no file './csrc/tests/helpers/tests/helpers.so'
no file '/home/<user>/repro/case/.tests//data/nvim/lazy-rocks/busted/lib/lua/5.1/tests/helpers.so'
no file '/home/<user>/repro/case/.tests//data/nvim/lazy-rocks/busted/lib64/lua/5.1/tests/helpers.so'
no file './csrc/tests.so'
no file './csrc/tests/tests.so'
no file '/home/<user>/repro/case/.tests//data/nvim/lazy-rocks/busted/lib/lua/5.1/tests.so'
no file '/home/<user>/repro/case/.tests//data/nvim/lazy-rocks/busted/lib64/lua/5.1/tests.so'
I don't completely rule out that it may be an issue in my config, but since the debug session itself is working fine, and the require calls are working outside the dap neotest session, maybe is something related to a path missing or not created properly. For example, this path seems very strange:
no file '/home/<user>/repro/case/tests/tests/helpers.lua'
Expected Behavior
require("tests.helpers") should work fine when using the dap session through neotest-busted.
Output of :checkhealth neotest-busted if relevant
No response
neotest log output if relevant
No response
Steps To Reproduce
Replicate the issue involve a lot of steps to fully set the environment, so I've made a repro repository here. Since local-lua-debugger-vscode is needed for all this, I've use a Makefile with git clone and npm for the build:
Clone and build the local-lua-debugger-vscode in the expected path by the config
Run the lazy/busted bootstrap
Open the case and set the breakpoints
Run the neotest dap session
I hope that the automation works, but in any case, I've also added a standard repro.lua file (try with nvim -u repro.lua). Beyond that, with the case folder itself it should be relatively straight forward to reproduce the issue after running the busted/lazy bootstrap.
Thanks!
The text was updated successfully, but these errors were encountered:
Hi, I hope everything is going well. I love seeing the progress this project has made so far with the latest versions.
Everything going good, thanks and likewise. That progress is in no small part thanks to you 😄 Glad to hear debugging is mostly working.
Thanks for the repro repository, that really helps! I'll take a look at it when I have time and see if I can reproduce it.
The paths should be the same for running neotest and running it through dap with the exception that passing arguments to the debug command requires quotes due to the way it is run.
Two things I notice after skimming the repro that might be worth investigating (I'll go through the repro in depth later):
neotest-busted sets up the path to look for modules in the lua/ folder but not in any tests/ folder so I'm a bit surprised that it even works in one case unless you are manually adding that to the path. One solution might be to just move the helpers to the lua/ folder. For example in one project, I have a test_helpers.lua file for the same purpose.
You are manually setting the busted_command option which, as per the warning in this section, makes neotest-busted not set up paths automatically since it won't know where they are located for certain. You would need to set them yourself but perhaps the test setup through lazy.nvim is setting up the paths to amend this (it looks like that's the case from the paths searched in the stack trace).
Did you check docs and existing issues?
log_level
tovim.log.levels.debug
inneotest.setup
and examined the logs.Neovim version (nvim -v)
NVIM v0.10.3 Build type: Release LuaJIT 2.1.1716656478
Operating system/version
Gentoo Linux 2.17
Describe the bug
Hi, I hope everything is going well. I love seeing the progress this project has made so far with the latest versions.
These days I've been trying the debugging capabilities with local-lua-debugger-vscode, and it has worked well except for some problems with the imports.
For example, I have this structure:
$ tree case case/ ├── lua │ └── foo │ └── init.lua ├── Makefile └── tests ├── busted.lua ├── foo_spec.lua └── helpers.lua
If I require the
helpers
module from thefoo_spec
test file, then depending if I'm running a normal test through neotest or a debug test through dap, I have to adjust the require path:The above code would work fine using
:lua require("neotest").run.run()
ornvim -l tests/busted.lua tests
from the command line, but it would fail using:lua require("neotest").run.run(strategy="dap")
.It complains that it couldn't find the
tests.helpers
module with this error:I don't completely rule out that it may be an issue in my config, but since the debug session itself is working fine, and the require calls are working outside the dap neotest session, maybe is something related to a path missing or not created properly. For example, this path seems very strange:
Expected Behavior
require("tests.helpers")
should work fine when using the dap session through neotest-busted.Output of
:checkhealth neotest-busted
if relevantNo response
neotest log output if relevant
No response
Steps To Reproduce
Replicate the issue involve a lot of steps to fully set the environment, so I've made a
repro
repository here. Sincelocal-lua-debugger-vscode
is needed for all this, I've use aMakefile
with git clone andnpm
for the build:git clone https://github.com/polirritmico/busted-repro.git
cd busted-repro
nvim -u repro-demo.lua
local-lua-debugger-vscode
in the expected path by the configI hope that the automation works, but in any case, I've also added a standard
repro.lua
file (try withnvim -u repro.lua
). Beyond that, with thecase
folder itself it should be relatively straight forward to reproduce the issue after running the busted/lazy bootstrap.Thanks!
The text was updated successfully, but these errors were encountered: