Skip to content

Commit

Permalink
refactor: no need to record panics
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed May 22, 2024
1 parent 8a11fcb commit 2e42066
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions lua/neotest-golang/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,10 @@ function M.Adapter.results(spec, result, tree)
---@type List<table>
local jsonlines = M.process_json(raw_output)

local panic_detected = false

for _, line in ipairs(jsonlines) do
if line.Action == "output" and line.Output ~= nil then
-- record output, prints to output panel
table.insert(test_result, line.Output)

-- register panic found
local panic_match = string.match(line.Output, "panic:")
if panic_match ~= nil then
panic_detected = true
end
end

if result.code ~= 0 and line.Output ~= nil then
Expand All @@ -288,16 +280,6 @@ function M.Adapter.results(spec, result, tree)
end
end

if panic_detected then
-- remove all line numbers, as neotest diagnostics will crash if they are present
local new_errors = {}
for _, error in ipairs(errors) do
local new_error = { message = error.message }
table.insert(new_errors, new_error)
end
errors = new_errors
end

-- write json_decoded to file
local parsed_output_path = vim.fs.normalize(async.fn.tempname())
async.fn.writefile(test_result, parsed_output_path)
Expand Down

0 comments on commit 2e42066

Please sign in to comment.