瀏覽代碼

refactor: clean up test env paths (#3318)

kylo252 2 年之前
父節點
當前提交
25c4241b07
共有 4 個文件被更改,包括 6 次插入10 次删除
  1. 1 4
      lua/lvim/bootstrap.lua
  2. 1 1
      lua/lvim/lsp/config.lua
  3. 1 1
      tests/minimal_init.lua
  4. 3 4
      utils/ci/run_test.sh

+ 1 - 4
lua/lvim/bootstrap.lua

@@ -10,7 +10,6 @@ end
 
 local uv = vim.loop
 local path_sep = uv.os_uname().version:match "Windows" and "\\" or "/"
-local in_headless = #vim.api.nvim_list_uis() == 0
 
 ---Join path segments that were passed as input
 ---@return string
@@ -96,9 +95,7 @@ function M:init(base_dir)
     vim.cmd [[let &packpath = &runtimepath]]
   end
 
-  -- FIXME: currently unreliable in unit-tests
-  if not in_headless then
-    _G.PLENARY_DEBUG = false
+  if not vim.env.LVIM_TEST_ENV then
     require "lvim.impatient"
   end
 

+ 1 - 1
lua/lvim/lsp/config.lua

@@ -39,7 +39,7 @@ local skipped_servers = {
   "vuels",
 }
 
-local skipped_filetypes = { "markdown", "rst", "plaintext" }
+local skipped_filetypes = { "markdown", "rst", "plaintext", "toml" }
 
 local join_paths = require("lvim.utils").join_paths
 

+ 1 - 1
tests/minimal_init.lua

@@ -1,5 +1,5 @@
 local path_sep = vim.loop.os_uname().version:match "Windows" and "\\" or "/"
-local base_dir = os.getenv "LUNARVIM_RUNTIME_DIR" .. path_sep .. "lvim"
+local base_dir = vim.env.LUNARVIM_BASE_DIR
 local tests_dir = base_dir .. path_sep .. "tests"
 
 vim.opt.rtp:append(tests_dir)

+ 3 - 4
utils/ci/run_test.sh

@@ -2,6 +2,7 @@
 set -e
 
 export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$HOME/.local/share/lunarvim"}"
+export LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}"
 
 export LVIM_TEST_ENV=true
 
@@ -11,12 +12,10 @@ LUNARVIM_CACHE_DIR="$(mktemp -d)"
 
 export LUNARVIM_CONFIG_DIR LUNARVIM_CACHE_DIR
 
-echo "cache: $LUNARVIM_CACHE_DIR
-
-config: $LUNARVIM_CONFIG_DIR"
+printf "cache_dir: %s\nconfig_dir: %s\n" "$LUNARVIM_CACHE_DIR" "$LUNARVIM_CONFIG_DIR"
 
 lvim() {
-  nvim -u "$LUNARVIM_RUNTIME_DIR/lvim/tests/minimal_init.lua" --cmd "set runtimepath+=$LUNARVIM_RUNTIME_DIR/lvim" "$@"
+  nvim -u "$LUNARVIM_BASE_DIR/tests/minimal_init.lua" --cmd "set runtimepath+=$LUNARVIM_BASE_DIR" "$@"
 }
 
 if [ -n "$1" ]; then