bug(testrunner):๐ cannot open stacktrace
Closed this issue ยท 4 comments
Hi there
thanks a lot for this project.
I'm as well trying to get rid of rider and this plugin looks like it would be help a lot with that.
I really like the testrunner view but it looks like I cannot open the stacktrace on a failed test which forces me to still fallback to neotest.
Is there anything I am missing or I configured wrong ?
E5108: Error executing lua: Vim:E484: Cannot open file byte arrays- Without automatic conversion.at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message)at FluentAssertions.Executi
on.TestFrameworkProvider.Throw(String message)at FluentAssertions.Execution.CollectingAssertionStrategy.ThrowIfAny(IDictionary`2 context)at FluentAssertions.Execution.AssertionScope.Dispose()at F
luentAssertions.Equivalency.EquivalencyValidator.AssertEquality(Comparands comparands, EquivalencyValidationContext context)at FluentAssertions.Equivalency.EquivalencyValidator.AssertEquality(Com
parands comparands, EquivalencyValidationContext context)at FluentAssertions.Primitives.ObjectAssertions`2.BeEquivalentTo[TExpectation](TExpectation expectation, Func`2 config, String because, Ob
ject[] becauseArgs)at FluentAssertions.Primitives.ObjectAssertions`2.BeEquivalentTo[TExpectation](TExpectation expectation, String because, Object[] becauseArgs)at GiteaVersioning.Tests.GiteaClie
ntTests.GetRelease() in /home/crashdummy/coding/GiteaVersioning/tests/GiteaVersio
stack traceback:
[C]: in function 'readfile'
...easy-dotnet.nvim/lua/easy-dotnet/test-runner/keymaps.lua:266: in function 'open_stack_trace'
...easy-dotnet.nvim/lua/easy-dotnet/test-runner/keymaps.lua:378: in function 'value'
.../easy-dotnet.nvim/lua/easy-dotnet/test-runner/render.lua:240: in function <.../easy-dotnet.nvim/lua/easy-dotnet/test-runner/render.lua:234>
keymaps.lua:266 tries to find both the stacktrace and the line number from the source file to point to. This might be failing
local function get_path_from_stack_trace(stack_trace)
stack_trace = table.concat(stack_trace)
-- Pattern to match the file path and line number
local pattern = "in%s+(.-):line%s+(%d+)"
-- Search for the first match
local path, line = stack_trace:match(pattern)
-- Return the result as a table
if path and line then
return { path = path, line = tonumber(line) }
else
return nil -- Return nil if no match is found
end
end
I guess my error handling could be better. When running the test that fails there should be a <your_test_scope>.xml file written in /TestResults
. Could you find the Results.UnitTestResult.Output.ErrorInfo
node. Im assuming there is something in the path that causes this issue. Otherwise it might be a file permission issue
I dont know how comfortable you are with lua, but if you know how and want to. Could you go into keymaps.lua and on line 266. Add a print(vim.inspect(path))
. This will let us see the path and the line number resolved
nvm, I see now that the get_path_from_stack_trace
function is the old way I did things with trying to get the filepath from the stacktrace. I now have this information from the test discovery. Let me make a fix for this. We dont have to debug this further
Issue got closed automatically when I merged my fix. Can you update the plugin and check if the issue is resolved?
Issue got closed automatically when I merged my fix. Can you update the plugin and check if the issue is resolved?
It works now.
Thanks a lot for fixing it that fast :)