Skip to content
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

chore: more debug logging #164

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions lua/neotest-golang/logging.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ local function clean_output(str)
return str
end

local function table_to_string(tbl)
local result = vim.inspect(tbl)
return clean_output(result)
end

---@param input any
---@return string
local function handle_input(input)
Expand All @@ -27,7 +22,7 @@ local function handle_input(input)
local result = ""
for _, v in ipairs(input) do
if type(v) == "table" then
result = result .. table_to_string(v) .. " "
result = result .. vim.inspect(v) .. " "
elseif type(v) == "string" then
result = result .. clean_output(v) .. " "
else
Expand Down
9 changes: 5 additions & 4 deletions lua/neotest-golang/process.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,14 @@ function M.test_results(spec, result, tree)
elseif runner == "gotestsum" then
raw_output = async.fn.readfile(context.test_output_json_filepath)
end
logger.debug({ "Raw 'go test' output: ", raw_output })

local gotest_output = lib.json.decode_from_table(raw_output)
logger.debug({ "Parsed 'go test' output: ", gotest_output })

--- The 'go list -json' output, converted into a lua table.
local golist_output = context.golist_data
logger.debug({ "Parsed 'go list' output: ", golist_output })

--- @type table<string, neotest.Result>
local neotest_result = {}
Expand Down Expand Up @@ -118,8 +121,7 @@ function M.test_results(spec, result, tree)
--- @type table<string, TestData>
local res = M.aggregate_data(tree, gotest_output, golist_output)

-- DEBUG: enable the following to see the internal test result data.
-- logger.debug(vim.inspect(res))
logger.debug({ "Final internal test result data", res })

-- show various warnings
M.show_warnings(res)
Expand All @@ -130,8 +132,7 @@ function M.test_results(spec, result, tree)
neotest_result[k] = v
end

-- DEBUG: enable the following to see the final Neotest result.
-- logger.debug(vim.inspect(neotest_result))
logger.debug({ "Final Neotest result data", neotest_result })

return neotest_result
end
Expand Down
Loading