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 74b9348
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
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 74b9348

Please sign in to comment.