From e42ee7b48d3bc1c434e121c50b6e6409cb287edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Tue, 10 May 2022 10:54:26 +0200 Subject: [PATCH] Use minimal when available for lua testing --- symlinks/config/nvim/after/plugin/testing.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/symlinks/config/nvim/after/plugin/testing.lua b/symlinks/config/nvim/after/plugin/testing.lua index f5c12a0..3cc0938 100644 --- a/symlinks/config/nvim/after/plugin/testing.lua +++ b/symlinks/config/nvim/after/plugin/testing.lua @@ -16,16 +16,26 @@ vim.keymap.set("n", "tg", ":TestVisit", opts) local last_path = nil +local function get_plenary_test_opts() + if vim.g["esensar#testing#use_minimal"] then + return { + minimal_init = vim.g["esensar#testing#minimal_init"] or "tests/minimal.vim", + } + else + return nil + end +end + vim.api.nvim_create_user_command("PlenaryTestFile", function() last_path = vim.fn.expand("%:p") - require("plenary.test_harness").test_directory(last_path) + require("plenary.test_harness").test_directory(last_path, get_plenary_test_opts()) end, {}) vim.api.nvim_create_user_command("PlenaryTestSuite", function() last_path = vim.fn["projectionist#path"]() - require("plenary.test_harness").test_directory(last_path) + require("plenary.test_harness").test_directory(last_path, get_plenary_test_opts()) end, {}) vim.api.nvim_create_user_command("PlenaryTestLast", function() @@ -33,7 +43,7 @@ vim.api.nvim_create_user_command("PlenaryTestLast", function() vim.notify("No plenary tests run yet! Nothing to do here", vim.log.levels.WARN) return end - require("plenary.test_harness").test_directory(last_path) + require("plenary.test_harness").test_directory(last_path, get_plenary_test_opts()) end, {}) vim.api.nvim_create_user_command("PlenaryVisitLastTest", function()