diff --git a/tests/core/init_spec.lua b/tests/core/init_spec.lua new file mode 100644 index 0000000..3a1b4c7 --- /dev/null +++ b/tests/core/init_spec.lua @@ -0,0 +1,7 @@ +describe("init", function() + it("has correct environment for tests", function() + for _, path in ipairs({ "config", "data", "cache", "state" }) do + assert(vim.fn.stdpath(path):find(".tests/" .. path)) + end + end) +end) diff --git a/tests/init.lua b/tests/init.lua index b5a94e8..a72b101 100644 --- a/tests/init.lua +++ b/tests/init.lua @@ -27,6 +27,10 @@ function M.setup() vim.opt.runtimepath:append(M.root()) vim.opt.packpath = { M.root(".tests/site") } M.load("nvim-lua/plenary.nvim") + vim.env.XDG_CONFIG_HOME = M.root(".tests/config") + vim.env.XDG_DATA_HOME = M.root(".tests/data") + vim.env.XDG_STATE_HOME = M.root(".tests/state") + vim.env.XDG_CACHE_HOME = M.root(".tests/cache") end M.setup()