7 ms·
> As far as I can tell you can’t step through tests in the debugger Maybe I am missing something, but that is not correct. You can debug tests the same way as
by leastangle 9y ago
> As far as I can tell you can’t step through tests in the debugger
Maybe I am missing something, but that is not correct. You can debug tests the same way as you debug any other code. Even works with the mentioned/used Go extension for VS Code.
- kjksf 9y agoIt's quite possible that it's just my laziness in figuring out how to do it. All I know is that hitting 'F5' in VSCode builds the binary and runs it under the debugger. How would I debug the equivalent of `go test` in VSCode?
- devuo 9y agoI have no idea in VSCode, but with JetBrains Gogland, debugging tests is stupidly easy. Simply add the breakpoint where you want it, left click on the play button in the line of the test declaration, click debug in the contextual menu, and off you go.
- ice109 9y agotoo bad sometimes it doesn't resolve pointers correctly
- lukehoban 9y agoIn Go test files, there's now a codelens annotation above every Test function with "run test" and "debug test" commands. Just click "debug test" to launch a debugger against that test. See https://twitter.com/ramyanexus/status/860190148239081472 https://twitter.com/ramyanexus/status/860190148239081472 If you want to configure F5 to launch tests instead of your main entry point, you can do that too in your launch.json file.