fix TSamFailedOnly and the output formatting for the go-runner
This commit is contained in:
@@ -178,6 +178,49 @@ describe("TSamFailedOnly", function()
|
||||
assert.are.same({ "go", "test", "-json", "./...", "-run", "^(TestFoo/first|TestBar)$" }, calls[2].cmd)
|
||||
end)
|
||||
|
||||
it("uses go parser for failed-only output (no raw JSON)", function()
|
||||
local json_line = vim.json.encode({
|
||||
Action = "fail",
|
||||
Test = "TestHandleGet/returns_200",
|
||||
})
|
||||
|
||||
local calls, orig_jobstart = stub_jobstart({
|
||||
exit_codes = { 1, 1 },
|
||||
stdout = { { json_line }, { json_line } },
|
||||
})
|
||||
|
||||
local bufnr = mkbuf("/tmp/project/foo_failed_only_output_test.go", "go", {
|
||||
"package main",
|
||||
"import \"testing\"",
|
||||
"",
|
||||
"func TestHandleGet(t *testing.T) {",
|
||||
" t.Run(\"returns_200\", func(t *testing.T) {",
|
||||
" -- inside test",
|
||||
" })",
|
||||
"}",
|
||||
})
|
||||
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
|
||||
core.run_all()
|
||||
core.run_failed_only()
|
||||
|
||||
local out_buf = vim.api.nvim_get_current_buf()
|
||||
local lines = vim.api.nvim_buf_get_lines(out_buf, 0, -1, false)
|
||||
|
||||
vim.fn.jobstart = orig_jobstart
|
||||
|
||||
assert.equals(2, #calls)
|
||||
local has_raw = false
|
||||
for _, line in ipairs(lines) do
|
||||
if line == json_line then
|
||||
has_raw = true
|
||||
break
|
||||
end
|
||||
end
|
||||
assert.is_false(has_raw)
|
||||
end)
|
||||
|
||||
it("does not affect TSamLast history", function()
|
||||
local json = vim.json.encode({
|
||||
testResults = {
|
||||
|
||||
Reference in New Issue
Block a user