mirror of
https://github.com/pnx/neotest-phpunit
synced 2026-06-18 04:10:01 +02:00
Add results collector
This commit is contained in:
parent
02bf4f2960
commit
258e9d4ea7
1 changed files with 17 additions and 17 deletions
|
|
@ -99,27 +99,27 @@ end
|
||||||
---@param tree neotest.Tree
|
---@param tree neotest.Tree
|
||||||
---@return neotest.Result[]
|
---@return neotest.Result[]
|
||||||
function NeotestAdapter.results(test, result, tree)
|
function NeotestAdapter.results(test, result, tree)
|
||||||
local output_file = test.context.results_path
|
local output_file = test.context.results_path
|
||||||
|
|
||||||
local ok, data = pcall(lib.files.read, output_file)
|
local ok, data = pcall(lib.files.read, output_file)
|
||||||
if not ok then
|
if not ok then
|
||||||
logger.error("No test output file found:", output_file)
|
logger.error("No test output file found:", output_file)
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local ok, parsed_data = pcall(lib.xml.parse, data)
|
local ok, parsed_data = pcall(lib.xml.parse, data)
|
||||||
if not ok then
|
if not ok then
|
||||||
logger.error("Failed to parse test output:", output_file)
|
logger.error("Failed to parse test output:", output_file)
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local ok, results = pcall(utils.get_test_results, parsed_data, output_file)
|
local ok, results = pcall(utils.get_test_results, parsed_data, output_file)
|
||||||
if not ok then
|
if not ok then
|
||||||
logger.error("Could not get test results", output_file)
|
logger.error("Could not get test results", output_file)
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
return results
|
return results
|
||||||
end
|
end
|
||||||
|
|
||||||
setmetatable(NeotestAdapter, {
|
setmetatable(NeotestAdapter, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue