Debug test configuration can't build test binary #104

Closed
opened 2024-11-21 12:01:07 +03:00 by GrantFleming · 1 comment
GrantFleming commented 2024-11-21 12:01:07 +03:00 (Migrated from github.com)

Note: I am talking about the vanilla "dap" debug test option that is registered (that I assume is supposed to debug the test file under the cursor) as opposed to the "debug an individual test" option.

Actions Taken

After installing nvim-dap-go (along with nvim-dap), while most debugging options work as expected, the "Debug test" option cannot build the test binary.

Steps to reproduce

  1. create a package containing one file and one test file
  2. ensure your cursor is in the test file
  3. :lua require('dap').continue()
  4. select option 6 - "Debug test"

What Happened

Received an error building the test binary due to undefined functions in the test (that are definitely defined in the same package).

Build Error: go test -c -o /Users/grant/Projects/gotest/__debug_bin1012801603 -gcflags all=-N -l /Users/grant/Projects/gotest/pkg/somepackage/somemoretests_test.go
# command-line-arguments [command-line-arguments.test]
pkg/somepackage/somemoretests_test.go:6:13: undefined: UpperIt
pkg/somepackage/somemoretests_test.go:14:13: undefined: UpperIt (exit status 1)

It appears that when you try to test a single file, the required go files are not supplied alongside the test file:

go test somefile_test.go somefile.go

What I Expected to Happen

The tests are built and run successfully.

Note: I am talking about the vanilla "dap" debug test option that is registered (that I assume is supposed to debug the test file under the cursor) as opposed to the "debug an individual test" option. ### Actions Taken After installing nvim-dap-go (along with nvim-dap), while most debugging options work as expected, the "Debug test" option cannot build the test binary. Steps to reproduce 1) create a package containing one file and one test file 2) ensure your cursor is in the test file 3) `:lua require('dap').continue()` 4) select option 6 - "Debug test" ### What Happened Received an error building the test binary due to undefined functions in the test (that are definitely defined in the same package). ``` Build Error: go test -c -o /Users/grant/Projects/gotest/__debug_bin1012801603 -gcflags all=-N -l /Users/grant/Projects/gotest/pkg/somepackage/somemoretests_test.go # command-line-arguments [command-line-arguments.test] pkg/somepackage/somemoretests_test.go:6:13: undefined: UpperIt pkg/somepackage/somemoretests_test.go:14:13: undefined: UpperIt (exit status 1) ``` It appears that when you try to test a single file, the required go files are not supplied alongside the test file: `go test somefile_test.go somefile.go` ### What I Expected to Happen The tests are built and run successfully.
stale[bot] commented 2025-05-20 14:44:44 +03:00 (Migrated from github.com)

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
NeonXP/nvim-dap-go#104
No description provided.