ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

How to debug unit tests in vscode?

Open plastikfan opened this issue 2 years ago • 1 comments

I am using the Ginkgo test explorer plugin in vscode and it works in all aspects excpet for 1. Debug unit tests doesnt work. Here is the output generated when I attempt to debug:

Starting: /home/plastikfan/go/bin/dlv dap --check-go-version=false --listen=127.0.0.1:40849 --log-dest=3 from /home/plastikfan/dev/github/go/snivilised/cobrass/src/adapters
DAP server listening at: 127.0.0.1:40849
Type 'dlv help' for list of commands.
Running Suite: Adapters Suite - /home/plastikfan/dev/github/go/snivilised/cobrass/src/adapters
==============================================================================================
Random Seed: 1657619476

Will run 0 of 504 specs
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS

Ran 0 of 504 Specs in 0.016 seconds
SUCCESS! -- 0 Passed | 0 Failed | 0 Pending | 504 Skipped
You're using deprecated Ginkgo functionality:
=============================================
  --ginkgo.debug is deprecated
  Learn more at: https://onsi.github.io/ginkgo/MIGRATING_TO_V2#removed--debug
  --ginkgo.reportFile is deprecated, use --ginkgo.junit-report instead
  Learn more at: https://onsi.github.io/ginkgo/MIGRATING_TO_V2#improved-reporting-infrastructure

To silence deprecations that can be silenced set the following environment variable:
  ACK_GINKGO_DEPRECATIONS=2.1.4

Visiting the proposed link relating to --ginkgo.debug is deprecated being disabled doesn't shed any light on the matter.

Please can you let me know how to work around this problem. Raising this is a last resort, I have not been able to find a solution to this problem so I hope you can help.

Is there possibly another test explorer/runner/debugger for vscode that I simply havent found yet? I am not sure if joselitofilho.ginkgotestexplorer is still being maintained, but it does mostly work except for a few minor hiccups, as well as the show stopper of not being able to debug tests.

PS: love the work on this repo, it is simply the best test frramework I've ever used, cheers.

plastikfan avatar Jul 12 '22 10:07 plastikfan

hey @plastikfan thanks for the kind words.

unfortunately I'm not super familiar with delve and using it to debug tests - and I'm pretty sure ginkgo test explorer doesn't integrate with delve those @joselitofilho could say more.

I'd start with trying on the command line. Ginkgo tests run on top of go test and in the context of debugging a single test I bet you don't need most of the Ginkgo CLI's features so I'd suggest focusing the spec in question (with Fit) and then running dlv test ./ and see if that gets you farther.

onsi avatar Jul 12 '22 19:07 onsi