code coverage: enable -covermode=atomic
for test coverage
#594
Labels
Milestone
-covermode=atomic
for test coverage
#594
Given the example go code:
This can then be tested from CLI with
go test
and you can see coverage with something like:Because this test uses
testing.T.Parallel()
, if you don't rungo test
in atomic mode, it will produce a coverage report that does not track all parallel test branches.VScode also displays this coverage in the editor. When doing so, it logs that it's running the following command:
Notably, it does not allow you to configure the
-covermode
flag, and per https://golang.org/pkg/cmd/go/internal/test/ the default isset
, which does not properly follow parallel tests.Of note, it appears that line 16755 of
dist/goMain.js
is building thego test
command from above, and vscode-go is running the command (from what I can tell), there's just no-covermode
flag option.It'd be nice to enable parallel testing code coverage, as golang supports it, by adding a
-covermode
flag, and making it a configurable option? Possibly also add a configurable option topackage.json
forgo.testCoverMode
and I'd suggestatomic
as a default option as well? I'm just rubbish with typescript, so modifying the extension is likely beyond me.Screenshots or recordings
Tests showing incorrect coverage (due to lack of
-covermode
flag and parallel test):Test showing correct coverage (but without parallel testing):
General environment information:
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insidersgo version
to get version of Gogo env
to get the go development environment detailsThe text was updated successfully, but these errors were encountered: