diff --git a/lua/test-samurai/core.lua b/lua/test-samurai/core.lua index 05a0251..04dc1ab 100644 --- a/lua/test-samurai/core.lua +++ b/lua/test-samurai/core.lua @@ -676,7 +676,7 @@ local function detect_js_framework(file) end 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 return nil end @@ -776,11 +776,11 @@ apply_border_kind = function(win, kind) return end if kind == "pass" then - vim.api.nvim_win_set_option(target, "winhighlight", "FloatBorder:TestSamuraiBorderPass") + vim.wo[target].winhighlight = "FloatBorder:TestSamuraiBorderPass" elseif kind == "fail" then - vim.api.nvim_win_set_option(target, "winhighlight", "FloatBorder:TestSamuraiBorderFail") + vim.wo[target].winhighlight = "FloatBorder:TestSamuraiBorderFail" else - vim.api.nvim_win_set_option(target, "winhighlight", "") + vim.wo[target].winhighlight = "" end end @@ -900,8 +900,8 @@ local function create_output_win(initial_lines) local buf = state.last_buf if not (buf and vim.api.nvim_buf_is_valid(buf)) then buf = vim.api.nvim_create_buf(false, true) - vim.api.nvim_buf_set_option(buf, "bufhidden", "hide") - vim.api.nvim_buf_set_option(buf, "filetype", "test-samurai-output") + vim.bo[buf].bufhidden = "hide" + vim.bo[buf].filetype = "test-samurai-output" state.last_buf = buf end @@ -1402,10 +1402,10 @@ local function ensure_detail_buf(lines) local buf = state.detail_buf if not (buf and vim.api.nvim_buf_is_valid(buf)) then buf = vim.api.nvim_create_buf(false, true) - vim.api.nvim_buf_set_option(buf, "bufhidden", "hide") - vim.api.nvim_buf_set_option(buf, "buftype", "nofile") - vim.api.nvim_buf_set_option(buf, "swapfile", false) - vim.api.nvim_buf_set_option(buf, "filetype", "test-samurai-output") + vim.bo[buf].bufhidden = "hide" + vim.bo[buf].buftype = "nofile" + vim.bo[buf].swapfile = false + vim.bo[buf].filetype = "test-samurai-output" state.detail_buf = buf end set_detail_maps(buf) @@ -2118,7 +2118,7 @@ run_command = function(command, opts) end end 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 buf = nil @@ -2147,8 +2147,8 @@ run_command = function(command, opts) local result_counts = make_summary_tracker(true) state.last_border_kind = "default" local start_time = nil - if vim.loop and vim.loop.hrtime then - start_time = vim.loop.hrtime() + if vim.uv and vim.uv.hrtime then + start_time = vim.uv.hrtime() end local output_lines = {} @@ -2302,8 +2302,8 @@ run_command = function(command, opts) end if summary_enabled then local elapsed = nil - if start_time and vim.loop and vim.loop.hrtime then - elapsed = (vim.loop.hrtime() - start_time) / 1000000000 + if start_time and vim.uv and vim.uv.hrtime then + elapsed = (vim.uv.hrtime() - start_time) / 1000000000 end ensure_output_started() local summary_lines = format_summary_lines(summary, elapsed) @@ -2321,8 +2321,8 @@ run_command = function(command, opts) end if summary_enabled then local elapsed = nil - if start_time and vim.loop and vim.loop.hrtime then - elapsed = (vim.loop.hrtime() - start_time) / 1000000000 + if start_time and vim.uv and vim.uv.hrtime then + elapsed = (vim.uv.hrtime() - start_time) / 1000000000 end ensure_output_started() local summary_lines = format_summary_lines(summary, elapsed) diff --git a/lua/test-samurai/util.lua b/lua/test-samurai/util.lua index 953119d..de8fbdd 100644 --- a/lua/test-samurai/util.lua +++ b/lua/test-samurai/util.lua @@ -14,7 +14,7 @@ end function M.find_root(file, markers) if not file or file == "" then - return vim.loop.cwd() + return vim.uv.cwd() end local dir = vim.fs.dirname(file) local found = vim.fs.find(markers, { path = dir, upward = true }) diff --git a/tests/minimal_init.lua b/tests/minimal_init.lua index 4022136..c166309 100644 --- a/tests/minimal_init.lua +++ b/tests/minimal_init.lua @@ -1,4 +1,4 @@ -local cwd = vim.loop.cwd() +local cwd = vim.uv.cwd() vim.opt.runtimepath:append(cwd) package.path = table.concat({ cwd .. "/lua/?.lua", diff --git a/tests/test_samurai_core_spec.lua b/tests/test_samurai_core_spec.lua index 66d5c85..87a640b 100644 --- a/tests/test_samurai_core_spec.lua +++ b/tests/test_samurai_core_spec.lua @@ -43,7 +43,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -159,7 +159,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -272,7 +272,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -358,7 +358,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -499,7 +499,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -576,7 +576,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -655,7 +655,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -750,7 +750,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -831,7 +831,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 local build_specs = {} @@ -929,7 +929,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -1031,7 +1031,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -1151,7 +1151,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -1256,7 +1256,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec) @@ -1369,7 +1369,7 @@ describe("test-samurai core (no bundled runners)", function() end 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 function runner.build_command(spec)