-
Notifications
You must be signed in to change notification settings - Fork 3
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: wrong paths with local-lua-debugger-vscode #46
Comments
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):
|
A small update: I've successfully reproduced the issue with your repro and tried out a few things but so far I haven't been able to figure out what the issue is unfortunately. |
Nice to hear that you could reproduce the issue, it took me some time to narrow it down to reproducible steps. In any case, I've also dig in on it. First, as you say, the path was set by lazy here: package.path = package.path .. ";" .. vim.uv.cwd() .. "/tests/?.lua" Since that is working with the non-dap strategy, it seems that something is changing the As a workaround I've tried the add project path to the rtp, but doing it only for the dap debug strategy feels like a hack: -- in the tests/path/to/test/spec.lua module
package.path = package.path .. ";" .. vim.uv.cwd() .. "/?.lua" I've managed to debug the debugger through osv, and maybe the issue is related to how the I would try to dig a little further in case I found something more relevant. Thanks! |
After some checks, I've found that run the non-dap strategy tests execute the busted.lua module that I set in |
Thanks, that explains my confusion.
So that workaround worked? Ok, seems you're on the right path then.
Here is how it is resolved. So its value depends entirely on where you are in the filesystem and isn't related to a "project root" as one might otherwise believe. I tried printing the cwd from nvim-dap when running I want to try to run inside the
How did you verify this? As I've written here there is a difference between how the test process is run between neotest and the debug adapter so perhaps this is why? |
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: