From 380264a2f7bef3ef80540ff4682af47f37b48495 Mon Sep 17 00:00:00 2001 From: ecosse3 Date: Sun, 21 Jul 2024 23:18:22 +0200 Subject: [PATCH] refactor(plugins): general testing plugins file --- lua/plugins/neotest.lua | 87 ------------------------------- lua/plugins/testing.lua | 110 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 87 deletions(-) delete mode 100644 lua/plugins/neotest.lua create mode 100644 lua/plugins/testing.lua diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua deleted file mode 100644 index c75adea4..00000000 --- a/lua/plugins/neotest.lua +++ /dev/null @@ -1,87 +0,0 @@ -local present, neotest = pcall(require, "neotest") -if not present then - return -end - --- ╭──────────────────────────────────────────────────────────╮ --- │ Setup │ --- ╰──────────────────────────────────────────────────────────╯ -neotest.setup({ - adapters = { - require("neotest-jest")({ - jestCommand = "npm test --", - env = { CI = true }, - cwd = function(path) - return vim.fn.getcwd() - end, - }), - }, - diagnostic = { - enabled = false - }, - floating = { - border = EcoVim.ui.float.border or "rounded", - max_height = 0.6, - max_width = 0.6 - }, - highlights = { - adapter_name = "NeotestAdapterName", - border = "NeotestBorder", - dir = "NeotestDir", - expand_marker = "NeotestExpandMarker", - failed = "NeotestFailed", - file = "NeotestFile", - focused = "NeotestFocused", - indent = "NeotestIndent", - namespace = "NeotestNamespace", - passed = "NeotestPassed", - running = "NeotestRunning", - skipped = "NeotestSkipped", - test = "NeotestTest" - }, - icons = { - child_indent = "│", - child_prefix = "├", - collapsed = "─", - expanded = "╮", - failed = "✖", - final_child_indent = " ", - final_child_prefix = "╰", - non_collapsible = "─", - passed = "✔", - running = "", - skipped = "ﰸ", - unknown = "?" - }, - output = { - enabled = true, - open_on_run = true, - }, - run = { - enabled = true - }, - status = { - enabled = true - }, - strategies = { - integrated = { - height = 40, - width = 120 - } - }, - summary = { - enabled = true, - expand_errors = true, - follow = true, - mappings = { - attach = "a", - expand = { "", "<2-LeftMouse>" }, - expand_all = "e", - jumpto = "i", - output = "o", - run = "r", - short = "O", - stop = "u" - } - } -}) diff --git a/lua/plugins/testing.lua b/lua/plugins/testing.lua new file mode 100644 index 00000000..e9309b67 --- /dev/null +++ b/lua/plugins/testing.lua @@ -0,0 +1,110 @@ +return { + { + "andythigpen/nvim-coverage", + dependencies = "nvim-lua/plenary.nvim", + cmd = { + "Coverage", + "CoverageSummary", + "CoverageLoad", + "CoverageShow", + "CoverageHide", + "CoverageToggle", + "CoverageClear", + }, + config = function() + require("coverage").setup() + end, + }, + + { + "nvim-neotest/neotest", + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "antoinemadec/FixCursorHold.nvim", + "nvim-neotest/neotest-jest", + }, + config = function() + require('neotest').setup { + adapters = { + require("neotest-jest")({ + jestCommand = "npm test --", + env = { CI = true }, + cwd = function(path) + return vim.fn.getcwd() + end, + }), + }, + diagnostic = { + enabled = false + }, + floating = { + border = EcoVim.ui.float.border or "rounded", + max_height = 0.6, + max_width = 0.6 + }, + highlights = { + adapter_name = "NeotestAdapterName", + border = "NeotestBorder", + dir = "NeotestDir", + expand_marker = "NeotestExpandMarker", + failed = "NeotestFailed", + file = "NeotestFile", + focused = "NeotestFocused", + indent = "NeotestIndent", + namespace = "NeotestNamespace", + passed = "NeotestPassed", + running = "NeotestRunning", + skipped = "NeotestSkipped", + test = "NeotestTest" + }, + icons = { + child_indent = "│", + child_prefix = "├", + collapsed = "─", + expanded = "╮", + failed = "✖", + final_child_indent = " ", + final_child_prefix = "╰", + non_collapsible = "─", + passed = "✔", + running = "", + skipped = "ﰸ", + unknown = "?" + }, + output = { + enabled = true, + open_on_run = true, + }, + run = { + enabled = true + }, + status = { + enabled = true + }, + strategies = { + integrated = { + height = 40, + width = 120 + } + }, + summary = { + enabled = true, + expand_errors = true, + follow = true, + mappings = { + attach = "a", + expand = { "", "<2-LeftMouse>" }, + expand_all = "e", + jumpto = "i", + output = "o", + run = "r", + short = "O", + stop = "u" + } + } + } + end + } +}