From f44809b580320a1202d3ce36b9d14f73678c7e71 Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Thu, 11 Jul 2024 19:24:03 +0200 Subject: [PATCH] fix(option): testify -> testify_enabled --- README.md | 2 +- lua/neotest-golang/ast.lua | 4 ++-- lua/neotest-golang/init.lua | 2 +- lua/neotest-golang/options.lua | 2 +- tests/go/testify/lookup_spec.lua | 2 +- tests/go/testify/positions_spec.lua | 2 +- tests/unit/options_spec.lua | 12 ++++++------ 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 22378ede..93baaf7a 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ return { | `go_test_args` | `{ "-v", "-race", "-count=1" }` | Arguments to pass into `go test`. | | `dap_go_enabled` | `false` | Leverage [leoluz/nvim-dap-go](https://github.com/leoluz/nvim-dap-go) for debugging tests. | | `dap_go_opts` | `{}` | Options to pass into `require("dap-go").setup()`. | -| `testify` | `false` | Enable support for [stretchr/testify](https://github.com/stretchr/testify) suites. | +| `testify_enabled` | `false` | Enable support for [stretchr/testify](https://github.com/stretchr/testify) suites. | | `warn_test_name_dupes` | `true` | Warn about duplicate test names within the same Go package. | | `warn_test_not_executed` | `true` | Warn if test was not executed. | diff --git a/lua/neotest-golang/ast.lua b/lua/neotest-golang/ast.lua index 3fb6595f..43b83826 100644 --- a/lua/neotest-golang/ast.lua +++ b/lua/neotest-golang/ast.lua @@ -127,7 +127,7 @@ function M.detect_tests(file_path) local opts = { nested_tests = true } local query = M.test_function .. M.table_tests - if options.get().testify == true then + if options.get().testify_enabled == true then -- detect receiver types (as namespaces) and test methods. query = query .. testify.query.namespace_query @@ -137,7 +137,7 @@ function M.detect_tests(file_path) ---@type neotest.Tree local tree = lib.treesitter.parse_positions(file_path, query, opts) - if options.get().testify == true then + if options.get().testify_enabled == true then tree = testify.tree_modification.modify_neotest_tree(tree) end diff --git a/lua/neotest-golang/init.lua b/lua/neotest-golang/init.lua index a0aaa766..912616f8 100644 --- a/lua/neotest-golang/init.lua +++ b/lua/neotest-golang/init.lua @@ -18,7 +18,7 @@ local M = {} M.Adapter = { name = "neotest-golang", init = function() - if options.get().testify == true then + if options.get().testify_enabled == true then testify.lookup.generate() end end, diff --git a/lua/neotest-golang/options.lua b/lua/neotest-golang/options.lua index b983052a..d8ce3585 100644 --- a/lua/neotest-golang/options.lua +++ b/lua/neotest-golang/options.lua @@ -8,9 +8,9 @@ local opts = { go_test_args = { "-v", "-race", "-count=1" }, dap_go_enabled = false, dap_go_opts = {}, + testify_enabled = false, warn_test_name_dupes = true, warn_test_not_executed = true, - testify = false, -- experimental, for now undocumented, options runner = "go", -- or "gotestsum" diff --git a/tests/go/testify/lookup_spec.lua b/tests/go/testify/lookup_spec.lua index 82cee932..28839a03 100644 --- a/tests/go/testify/lookup_spec.lua +++ b/tests/go/testify/lookup_spec.lua @@ -6,7 +6,7 @@ local testify = require("neotest-golang.features.testify") describe("Lookup", function() it("Generates tree replacement instructions", function() -- Arrange - options.set({ testify = true }) -- enable testify + options.set({ testify_enabled = true }) -- enable testify local folderpath = vim.loop.cwd() .. "/tests/go" local expected_lookup = { [folderpath .. "/positions_test.go"] = { diff --git a/tests/go/testify/positions_spec.lua b/tests/go/testify/positions_spec.lua index 2a2853c0..2b051d6c 100644 --- a/tests/go/testify/positions_spec.lua +++ b/tests/go/testify/positions_spec.lua @@ -72,7 +72,7 @@ describe("With testify_enabled=true", function() -- Arrange local test_filepath = vim.loop.cwd() .. "/tests/go/testify/positions_test.go" - options.set({ testify = true }) -- enable testify + options.set({ testify_enabled = true }) -- enable testify testify.lookup.generate() -- generate lookup local expected = { diff --git a/tests/unit/options_spec.lua b/tests/unit/options_spec.lua index f009a7bf..8a6f4249 100644 --- a/tests/unit/options_spec.lua +++ b/tests/unit/options_spec.lua @@ -3,16 +3,16 @@ local options = require("neotest-golang.options") describe("Options are set up", function() it("With defaults", function() local expected_options = { - dap_go_enabled = false, - dap_go_opts = {}, go_test_args = { "-v", "-race", "-count=1", }, + dap_go_enabled = false, + dap_go_opts = {}, + testify_enabled = false, warn_test_name_dupes = true, warn_test_not_executed = true, - testify = false, -- experimental runner = "go", @@ -25,17 +25,17 @@ describe("Options are set up", function() it("With non-defaults", function() local expected_options = { - dap_go_enabled = false, - dap_go_opts = {}, go_test_args = { "-v", "-race", "-count=1", "-parallel=1", -- non-default }, + dap_go_enabled = false, + dap_go_opts = {}, + testify_enabled = false, warn_test_name_dupes = true, warn_test_not_executed = true, - testify = false, -- experimental runner = "go",