Skip to content

Commit

Permalink
Ensure go test coverprofile outputs to the expected location (#1105)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelSpeed committed Dec 23, 2022
1 parent 49fab7a commit b0bd77b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ginkgo/internal/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"syscall"
Expand Down Expand Up @@ -63,6 +64,12 @@ func checkForNoTestsWarning(buf *bytes.Buffer) bool {
}

func runGoTest(suite TestSuite, cliConfig types.CLIConfig, goFlagsConfig types.GoFlagsConfig) TestSuite {
// As we run the go test from the suite directory, make sure the cover profile is absolute
// and placed into the expected output directory when one is configured.
if goFlagsConfig.Cover && !filepath.IsAbs(goFlagsConfig.CoverProfile) {
goFlagsConfig.CoverProfile = AbsPathForGeneratedAsset(goFlagsConfig.CoverProfile, suite, cliConfig, 0)
}

args, err := types.GenerateGoTestRunArgs(goFlagsConfig)
command.AbortIfError("Failed to generate test run arguments", err)
cmd, buf := buildAndStartCommand(suite, args, true)
Expand Down

0 comments on commit b0bd77b

Please sign in to comment.