From da45e638cc1b1a04c6ff891bd2390709843bf532 Mon Sep 17 00:00:00 2001 From: William Boman Date: Sat, 2 Aug 2025 06:17:24 +0200 Subject: [PATCH] refactor(tests): use vim.fs instead of vim.fn.fnamemodify While it's probably safe to call vim.fn here, we want to avoid doing so as much as possible because this can only be done when executing in the main event loop. mason.nvim, and its user callbacks, executes a large chunk of its code outside of the main event loop due to frequent async interactions with libuv. Oh, also better readability :P --- tests/action.yaml | 2 +- tests/test-runner.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/action.yaml b/tests/action.yaml index 32344aa..55aeaf6 100644 --- a/tests/action.yaml +++ b/tests/action.yaml @@ -103,7 +103,7 @@ runs: uses: rhysd/action-setup-vim@v1 with: neovim: true - # Minimum supported mason.nvim version + # Minimum version supported by mason.nvim version: v0.10.0 - if: ${{ steps.prepare.outputs.PACKAGES != '' }} diff --git a/tests/test-runner.lua b/tests/test-runner.lua index 9cc940f..c90826d 100644 --- a/tests/test-runner.lua +++ b/tests/test-runner.lua @@ -125,7 +125,7 @@ local ok, err = pcall(a.run_blocking, function() for __, pkg_path in ipairs(packages) do -- Turns "packages/rust-analyzer/package.yaml" into "rust-analyzer" - local pkg_name = vim.fn.fnamemodify(pkg_path, ":h:t") + local pkg_name = vim.fs.basename(vim.fs.dirname(pkg_path)) local pkg = registry.get_package(pkg_name) a.scheduler() get_targets(pkg)