Skip to content

Debug test configuration can't build test binary #104

Open
@GrantFleming

Description

@GrantFleming

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions