fix TSamFailedOnly
All checks were successful
tests / test (push) Successful in 8s

This commit is contained in:
2026-01-03 15:18:19 +01:00
parent 5216378d3c
commit 58ab97f757
2 changed files with 33 additions and 16 deletions

View File

@@ -134,6 +134,17 @@ local function to_jest_full_name(name)
return table.concat(parts, " ")
end
local function last_segment(name)
if not name or name == "" then
return name
end
if not name:find("/", 1, true) then
return name
end
local parts = vim.split(name, "/", { plain = true, trimempty = true })
return parts[#parts] or name
end
local function find_tests(lines)
local tests = {}
local describes = {}
@@ -493,8 +504,8 @@ function runner.build_failed_command(last_command, failures, _scope_kind)
local pattern_parts = {}
for _, name in ipairs(failures or {}) do
if name and name ~= "" then
local jest_name = runner._last_jest_names[name] or to_jest_full_name(name)
table.insert(pattern_parts, "^" .. escape_regex(jest_name) .. "$")
local title = last_segment(name)
table.insert(pattern_parts, "^.*" .. escape_regex(title) .. "$")
end
end
local pattern = "(" .. table.concat(pattern_parts, "|") .. ")"
@@ -599,11 +610,11 @@ function runner.output_parser()
state.jest.failures_seen[data.name] = true
table.insert(state.jest.failures_all, data.name)
end
results.failures_all = vim.deepcopy(state.jest.failures_all)
else
results.skips = { data.name }
results.display.skips = { data.display or data.name }
end
results.failures_all = vim.deepcopy(state.jest.failures_all)
update_location_cache(data.name, data)
return results
end,