fix TSamFailedOnly and the output formatting for the jest-runner

This commit is contained in:
2025-12-25 18:53:31 +01:00
parent 20b8cf8009
commit a6e51f280f
10 changed files with 617 additions and 106 deletions

View File

@@ -311,20 +311,30 @@ local function run_cmd(cmd, cwd, handlers)
})
end
local function pick_display(results, key)
if type(results.display) == "table" and type(results.display[key]) == "table" then
return results.display[key]
end
return results[key]
end
local function format_results(results)
local lines = {}
if type(results.passes) == "table" then
for _, title in ipairs(results.passes) do
local passes = pick_display(results, "passes")
if type(passes) == "table" then
for _, title in ipairs(passes) do
table.insert(lines, "[ PASS ] - " .. title)
end
end
if type(results.skips) == "table" then
for _, title in ipairs(results.skips) do
local skips = pick_display(results, "skips")
if type(skips) == "table" then
for _, title in ipairs(skips) do
table.insert(lines, "[ SKIP ] - " .. title)
end
end
if type(results.failures) == "table" then
for _, title in ipairs(results.failures) do
local failures = pick_display(results, "failures")
if type(failures) == "table" then
for _, title in ipairs(failures) do
table.insert(lines, "[ FAIL ] - " .. title)
end
end