add TSamFailedOnly command and change test output within the floating window
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
local jest = require("test-samurai.runners.js-jest")
|
||||
local mocha = require("test-samurai.runners.js-mocha")
|
||||
local vitest = require("test-samurai.runners.js-vitest")
|
||||
local util = require("test-samurai.util")
|
||||
|
||||
describe("test-samurai js runner (jest)", function()
|
||||
@@ -51,7 +52,7 @@ describe("test-samurai js runner (jest)", function()
|
||||
assert.is_true(spec.cwd:match("tmp$") ~= nil)
|
||||
|
||||
local cmd_spec = jest.build_command(spec)
|
||||
assert.are.same({ "npx", "jest", spec.file, "-t", "inner 2" }, cmd_spec.cmd)
|
||||
assert.are.same({ "npx", "jest", "--json", spec.file, "-t", "inner 2" }, cmd_spec.cmd)
|
||||
end)
|
||||
|
||||
it("returns describe block when cursor is between it() calls", function()
|
||||
@@ -133,7 +134,7 @@ describe("test-samurai js runner (mocha)", function()
|
||||
local cmd_spec = mocha.build_command(spec)
|
||||
|
||||
assert.are.same(
|
||||
{ "npx", "mocha", "--fgrep", "outer inner 2", spec.file },
|
||||
{ "npx", "mocha", "--reporter", "json-stream", "--fgrep", "outer inner 2", spec.file },
|
||||
cmd_spec.cmd
|
||||
)
|
||||
assert.equals("/tmp/project", cmd_spec.cwd)
|
||||
@@ -154,7 +155,47 @@ describe("test-samurai js runner (mocha)", function()
|
||||
util.find_root = orig_find_root
|
||||
|
||||
assert.are.same(
|
||||
{ "npx", "mocha", "test/**/*.test.js" },
|
||||
{ "npx", "mocha", "--reporter", "json-stream", "test/**/*.test.js" },
|
||||
cmd_spec.cmd
|
||||
)
|
||||
assert.equals("/tmp/project", cmd_spec.cwd)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("test-samurai js runner (vitest)", function()
|
||||
it("builds vitest command with tap-flat reporter", function()
|
||||
local spec = {
|
||||
file = "/tmp/project/test/foo_nearest.test.ts",
|
||||
cwd = "/tmp/project",
|
||||
test_name = "inner 2",
|
||||
full_name = "outer inner 2",
|
||||
}
|
||||
|
||||
local cmd_spec = vitest.build_command(spec)
|
||||
|
||||
assert.are.same(
|
||||
{ "npx", "vitest", "--reporter", "tap-flat", spec.file, "-t", "inner 2" },
|
||||
cmd_spec.cmd
|
||||
)
|
||||
assert.equals("/tmp/project", cmd_spec.cwd)
|
||||
end)
|
||||
|
||||
it("builds vitest all command with tap-flat reporter", function()
|
||||
local bufnr = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_buf_set_name(bufnr, "/tmp/project/test/foo_all.test.ts")
|
||||
vim.bo[bufnr].filetype = "typescript"
|
||||
|
||||
local orig_find_root = util.find_root
|
||||
util.find_root = function(path, markers)
|
||||
return "/tmp/project"
|
||||
end
|
||||
|
||||
local cmd_spec = vitest.build_all_command(bufnr)
|
||||
|
||||
util.find_root = orig_find_root
|
||||
|
||||
assert.are.same(
|
||||
{ "npx", "vitest", "--reporter", "tap-flat" },
|
||||
cmd_spec.cmd
|
||||
)
|
||||
assert.equals("/tmp/project", cmd_spec.cwd)
|
||||
|
||||
Reference in New Issue
Block a user