Skip to content

Commit

Permalink
fix(option): testify -> testify_enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed Jul 11, 2024
1 parent d7500ca commit f44809b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |

Expand Down
4 changes: 2 additions & 2 deletions lua/neotest-golang/ast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lua/neotest-golang/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lua/neotest-golang/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/go/testify/lookup_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = {
Expand Down
2 changes: 1 addition & 1 deletion tests/go/testify/positions_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/options_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit f44809b

Please sign in to comment.