This commit is contained in:
+17
-17
@@ -676,7 +676,7 @@ local function detect_js_framework(file)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local pkg_path = vim.fs.joinpath(root, "package.json")
|
local pkg_path = vim.fs.joinpath(root, "package.json")
|
||||||
local stat = vim.loop.fs_stat(pkg_path)
|
local stat = vim.uv.fs_stat(pkg_path)
|
||||||
if not stat or stat.type ~= "file" then
|
if not stat or stat.type ~= "file" then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@@ -776,11 +776,11 @@ apply_border_kind = function(win, kind)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if kind == "pass" then
|
if kind == "pass" then
|
||||||
vim.api.nvim_win_set_option(target, "winhighlight", "FloatBorder:TestSamuraiBorderPass")
|
vim.wo[target].winhighlight = "FloatBorder:TestSamuraiBorderPass"
|
||||||
elseif kind == "fail" then
|
elseif kind == "fail" then
|
||||||
vim.api.nvim_win_set_option(target, "winhighlight", "FloatBorder:TestSamuraiBorderFail")
|
vim.wo[target].winhighlight = "FloatBorder:TestSamuraiBorderFail"
|
||||||
else
|
else
|
||||||
vim.api.nvim_win_set_option(target, "winhighlight", "")
|
vim.wo[target].winhighlight = ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -900,8 +900,8 @@ local function create_output_win(initial_lines)
|
|||||||
local buf = state.last_buf
|
local buf = state.last_buf
|
||||||
if not (buf and vim.api.nvim_buf_is_valid(buf)) then
|
if not (buf and vim.api.nvim_buf_is_valid(buf)) then
|
||||||
buf = vim.api.nvim_create_buf(false, true)
|
buf = vim.api.nvim_create_buf(false, true)
|
||||||
vim.api.nvim_buf_set_option(buf, "bufhidden", "hide")
|
vim.bo[buf].bufhidden = "hide"
|
||||||
vim.api.nvim_buf_set_option(buf, "filetype", "test-samurai-output")
|
vim.bo[buf].filetype = "test-samurai-output"
|
||||||
state.last_buf = buf
|
state.last_buf = buf
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1402,10 +1402,10 @@ local function ensure_detail_buf(lines)
|
|||||||
local buf = state.detail_buf
|
local buf = state.detail_buf
|
||||||
if not (buf and vim.api.nvim_buf_is_valid(buf)) then
|
if not (buf and vim.api.nvim_buf_is_valid(buf)) then
|
||||||
buf = vim.api.nvim_create_buf(false, true)
|
buf = vim.api.nvim_create_buf(false, true)
|
||||||
vim.api.nvim_buf_set_option(buf, "bufhidden", "hide")
|
vim.bo[buf].bufhidden = "hide"
|
||||||
vim.api.nvim_buf_set_option(buf, "buftype", "nofile")
|
vim.bo[buf].buftype = "nofile"
|
||||||
vim.api.nvim_buf_set_option(buf, "swapfile", false)
|
vim.bo[buf].swapfile = false
|
||||||
vim.api.nvim_buf_set_option(buf, "filetype", "test-samurai-output")
|
vim.bo[buf].filetype = "test-samurai-output"
|
||||||
state.detail_buf = buf
|
state.detail_buf = buf
|
||||||
end
|
end
|
||||||
set_detail_maps(buf)
|
set_detail_maps(buf)
|
||||||
@@ -2118,7 +2118,7 @@ run_command = function(command, opts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
local cmd = command.cmd
|
local cmd = command.cmd
|
||||||
local cwd = command.cwd or vim.loop.cwd()
|
local cwd = command.cwd or vim.uv.cwd()
|
||||||
|
|
||||||
local header = "$ " .. table.concat(cmd, " ")
|
local header = "$ " .. table.concat(cmd, " ")
|
||||||
local buf = nil
|
local buf = nil
|
||||||
@@ -2147,8 +2147,8 @@ run_command = function(command, opts)
|
|||||||
local result_counts = make_summary_tracker(true)
|
local result_counts = make_summary_tracker(true)
|
||||||
state.last_border_kind = "default"
|
state.last_border_kind = "default"
|
||||||
local start_time = nil
|
local start_time = nil
|
||||||
if vim.loop and vim.loop.hrtime then
|
if vim.uv and vim.uv.hrtime then
|
||||||
start_time = vim.loop.hrtime()
|
start_time = vim.uv.hrtime()
|
||||||
end
|
end
|
||||||
|
|
||||||
local output_lines = {}
|
local output_lines = {}
|
||||||
@@ -2302,8 +2302,8 @@ run_command = function(command, opts)
|
|||||||
end
|
end
|
||||||
if summary_enabled then
|
if summary_enabled then
|
||||||
local elapsed = nil
|
local elapsed = nil
|
||||||
if start_time and vim.loop and vim.loop.hrtime then
|
if start_time and vim.uv and vim.uv.hrtime then
|
||||||
elapsed = (vim.loop.hrtime() - start_time) / 1000000000
|
elapsed = (vim.uv.hrtime() - start_time) / 1000000000
|
||||||
end
|
end
|
||||||
ensure_output_started()
|
ensure_output_started()
|
||||||
local summary_lines = format_summary_lines(summary, elapsed)
|
local summary_lines = format_summary_lines(summary, elapsed)
|
||||||
@@ -2321,8 +2321,8 @@ run_command = function(command, opts)
|
|||||||
end
|
end
|
||||||
if summary_enabled then
|
if summary_enabled then
|
||||||
local elapsed = nil
|
local elapsed = nil
|
||||||
if start_time and vim.loop and vim.loop.hrtime then
|
if start_time and vim.uv and vim.uv.hrtime then
|
||||||
elapsed = (vim.loop.hrtime() - start_time) / 1000000000
|
elapsed = (vim.uv.hrtime() - start_time) / 1000000000
|
||||||
end
|
end
|
||||||
ensure_output_started()
|
ensure_output_started()
|
||||||
local summary_lines = format_summary_lines(summary, elapsed)
|
local summary_lines = format_summary_lines(summary, elapsed)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ end
|
|||||||
|
|
||||||
function M.find_root(file, markers)
|
function M.find_root(file, markers)
|
||||||
if not file or file == "" then
|
if not file or file == "" then
|
||||||
return vim.loop.cwd()
|
return vim.uv.cwd()
|
||||||
end
|
end
|
||||||
local dir = vim.fs.dirname(file)
|
local dir = vim.fs.dirname(file)
|
||||||
local found = vim.fs.find(markers, { path = dir, upward = true })
|
local found = vim.fs.find(markers, { path = dir, upward = true })
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
local cwd = vim.loop.cwd()
|
local cwd = vim.uv.cwd()
|
||||||
vim.opt.runtimepath:append(cwd)
|
vim.opt.runtimepath:append(cwd)
|
||||||
package.path = table.concat({
|
package.path = table.concat({
|
||||||
cwd .. "/lua/?.lua",
|
cwd .. "/lua/?.lua",
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -159,7 +159,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -272,7 +272,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -358,7 +358,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -499,7 +499,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -576,7 +576,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -655,7 +655,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -750,7 +750,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -831,7 +831,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
local build_specs = {}
|
local build_specs = {}
|
||||||
@@ -929,7 +929,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -1031,7 +1031,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestA" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestA" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -1151,7 +1151,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestB" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestB" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -1256,7 +1256,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestC" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestC" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
@@ -1369,7 +1369,7 @@ describe("test-samurai core (no bundled runners)", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function runner.find_nearest(bufnr, _row, _col)
|
function runner.find_nearest(bufnr, _row, _col)
|
||||||
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.loop.cwd(), test_name = "TestJump" }
|
return { file = vim.api.nvim_buf_get_name(bufnr), cwd = vim.uv.cwd(), test_name = "TestJump" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function runner.build_command(spec)
|
function runner.build_command(spec)
|
||||||
|
|||||||
Reference in New Issue
Block a user