summaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/plugins/neotest.lua
diff options
context:
space:
mode:
authorIbrahim Muftee <ibrahim@muftee.net>2024-10-03 17:54:22 -0500
committerIbrahim Muftee <ibrahim@muftee.net>2026-07-01 00:23:31 -0400
commit7876fabd7c5c625194ee723972e63105eca4b505 (patch)
tree8a60254fdba136242a10954bc0429747e509a46c /dot_config/nvim/lua/plugins/neotest.lua
parent25845fce1beb28e783e7f9495a0fadf19e26bee6 (diff)
feat(nvim): neovim config rewrite
Diffstat (limited to 'dot_config/nvim/lua/plugins/neotest.lua')
-rw-r--r--dot_config/nvim/lua/plugins/neotest.lua78
1 files changed, 41 insertions, 37 deletions
diff --git a/dot_config/nvim/lua/plugins/neotest.lua b/dot_config/nvim/lua/plugins/neotest.lua
index e2ad2ce..68e7bc3 100644
--- a/dot_config/nvim/lua/plugins/neotest.lua
+++ b/dot_config/nvim/lua/plugins/neotest.lua
@@ -1,40 +1,44 @@
return {
- "nvim-neotest/neotest",
- cond = not vim.g.vscode,
- ft = { "python" },
- dependencies = {
- "nvim-lua/plenary.nvim",
- "antoinemadec/FixCursorHold.nvim",
- "nvim-treesitter/nvim-treesitter",
- "nvim-neotest/neotest-python",
- "nvim-neotest/nvim-nio",
- },
- opts = function()
- return {
- adapters = {
- require("neotest-python")({
- -- Use the current Python binary on the path.
- -- This will usually be a virtual environment.
- python = "python",
- runner = "pytest",
- is_test_file = function(file_path) ---@param file_path string
- -- I place all of my Python test files in a
- -- `tests` directory, and they all start with
- -- `test_` per Pytest conventions.
- local normalized_path = vim.fs.normalize(file_path)
- return normalized_path:match("tests/.*%/test_.*%.py$") ~= nil
- end,
- }),
- },
- }
- end,
- config = function(_, opts)
- require("neotest").setup(opts)
+ "nvim-neotest/neotest",
+ ft = { "python" },
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "antoinemadec/FixCursorHold.nvim",
+ "nvim-treesitter/nvim-treesitter",
+ "nvim-neotest/neotest-python",
+ "nvim-neotest/nvim-nio",
+ },
+ opts = function()
+ return {
+ adapters = {
+ require("neotest-python")({
+ -- Use the current Python binary on the path.
+ -- This will usually be a virtual environment.
+ python = "python",
+ runner = "pytest",
+ is_test_file = function(file_path) ---@param file_path string
+ -- I place all of my Python test files in a
+ -- `tests` directory, and they all start with
+ -- `test_` per Pytest conventions.
+ local normalized_path = vim.fs.normalize(file_path)
+ return normalized_path:match("tests/.*%/test_.*%.py$") ~= nil
+ end,
+ }),
+ },
+ }
+ end,
+ config = function(_, opts)
+ require("neotest").setup(opts)
- vim.keymap.set({ "n" }, "<leader>tr", require("neotest").run.run, { desc = "Neotest: run test at cursor" })
- vim.keymap.set({ "n" }, "<leader>tf", function()
- require("neotest").run.run(vim.fn.expand("%"))
- end, { desc = "Neotest: run all tests in current file" })
- vim.keymap.set({ "n", }, "<leader>ts", require("neotest").summary.toggle, { desc = "Neotest: toggle summary panel" })
- end,
+ vim.keymap.set({ "n" }, "<leader>tr", require("neotest").run.run, { desc = "Neotest: run test at cursor" })
+ vim.keymap.set({ "n" }, "<leader>tf", function()
+ require("neotest").run.run(vim.fn.expand("%"))
+ end, { desc = "Neotest: run all tests in current file" })
+ vim.keymap.set(
+ { "n" },
+ "<leader>ts",
+ require("neotest").summary.toggle,
+ { desc = "Neotest: toggle summary panel" }
+ )
+ end,
}