Closed bartman closed 5 months ago
I made the following hack in neotest-gtest/report.lua
, mostly to see what would happen.
- vim.notify(message, vim.log.levels.WARN)
+ -- vim.notify(message, vim.log.levels.WARN)
+ print("[warn] " .. message)
then tried to run a simple tests case...
first of, good news -- this is the first time I've been able to run any tests using neotest. ~my test case passes, as expected.~ after closer inspection, it's not actually running anything.
but it seems that the test is marked with an :x: both in the code pane, and in the side pane:
previous post may have been due to a parameterized test case.
when I run a simple test I get:
neotest-gtest: ...nvim/lazy/nvim-nio/lua/nio/init.lua:119: The coroutine failed with this message:
...nvim/lazy/neotest-gtest/lua/neotest-gtest/utils.lua:82: attempt to index local 'path' (a nil value)
stack traceback:
...nvim/lazy/neotest-gtest/lua/neotest-gtest/utils.lua: in function 'normalize_path'
...nvim/lazy/neotest-gtest/lua/neotest-gtest/report.lua:25: in function 'position_id'
...nvim/lazy/neotest-gtest/lua/neotest-gtest/report.lua:18: in function 'new'
...nvim/lazy/neotest-gtest/lua/neotest-gtest/report.lua:219: in function 'results'
...nvim/lazy/neotest/lua/neotest/client/runner.lua:132: in function '_run_spec'
...nvim/lazy/neotest/lua/neotest/client/runner.lua:89: in function <...nvim/lazy/neotest/lua/neotest/client/runner.lua:88>
looks like the path is nil
Heey @bartman, this seems to be the same issue as #14. I'm quite confident it is so I'll close this one - feel free to reopen if you think otherwise. The main solution there is to update your gtest library.
There is a way to implement a workaround by memorizing the path in the context when it is created. There's some legwork that would also need to be done to set up tests in CI with multiple versions of gtest. Unfortunately, these days it's very hard for me to find the time for this, and on top of that I don't really write much C++ anymore :/ I don't know when that that will change, but meanwhile if you (or anyone else) can submit a PR with the pointer above.
When I try to
:ConfigureGtest
I get this error:Versions:
v0.10.0-dev-2754+g12240600f
v5.0.1
@e07fe82
6e794ac
At work, I have a setup similar to:
Reproduce:
:e lib/tests/test_foo.cpp
require("neotest").summary.open()
-- everything works correctly (I see a list of my tests, tests in current file are highlighted in purple)m
to mark my tests in the split window (now highlighted in orange):ConfigureGtest
and I get the messages pasted abovebuild/lib/tests/test_foo
require("neotest").run.run(vim.fn.expand("%"))