add TSamFailedOnly command and change test output within the floating window

This commit is contained in:
2025-12-25 16:40:50 +01:00
parent cbc3e201ae
commit 1e2e881acd
17 changed files with 1074 additions and 448 deletions

View File

@@ -49,7 +49,7 @@ describe("TSamLast", function()
vim.fn.jobstart = orig_jobstart
assert.equals(2, #calls)
assert.are.same({ "go", "test", "-v", "./", "-run", "^TestFoo/first$" }, calls[1].cmd)
assert.are.same({ "go", "test", "-json", "./", "-run", "^TestFoo/first$" }, calls[1].cmd)
assert.are.same(calls[1].cmd, calls[2].cmd)
assert.equals(calls[1].opts.cwd, calls[2].opts.cwd)
end)
@@ -79,48 +79,10 @@ describe("TSamLast", function()
assert.equals(2, #calls)
assert.are.same(
{ "npx", "jest", "/tmp/project/foo_last.test.ts", "-t", "inner 2" },
{ "npx", "jest", "--json", "/tmp/project/foo_last.test.ts", "-t", "inner 2" },
calls[1].cmd
)
assert.are.same(calls[1].cmd, calls[2].cmd)
assert.equals(calls[1].opts.cwd, calls[2].opts.cwd)
end)
it("reruns last Lua command", function()
local calls, orig_jobstart = capture_jobstart()
local bufnr = mkbuf("/tmp/project/foo_last_spec.lua", "lua", {
"describe('outer', function()",
" it('inner 1', function()",
" local x = 1",
" end)",
"",
" it('inner 2', function()",
" local y = 2",
" end)",
"end)",
})
vim.api.nvim_set_current_buf(bufnr)
vim.api.nvim_win_set_cursor(0, { 7, 0 })
core.run_nearest()
core.run_last()
vim.fn.jobstart = orig_jobstart
assert.equals(2, #calls)
assert.are.same({
"nvim",
"--headless",
"-u",
"/tmp/project/tests/minimal_init.lua",
"-c",
'PlenaryBustedFile /tmp/project/foo_last_spec.lua { busted_args = { "--filter", "inner 2" } }',
"-c",
"qa",
}, calls[1].cmd)
assert.are.same(calls[1].cmd, calls[2].cmd)
assert.equals(calls[1].opts.cwd, calls[2].opts.cwd)
end)
end)