Skip to content

Commit a5567d7

Browse files
authored
Merge pull request #3170 from simonbaird/relative-path-acceptance-test-output
Show relative paths in acceptance test output
2 parents fee1e27 + 75ef6d8 commit a5567d7

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

acceptance/acceptance_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,18 @@ func initializeScenario(sc *godog.ScenarioContext) {
138138
sc.After(func(ctx context.Context, scenario *godog.Scenario, scenarioErr error) (context.Context, error) {
139139
// Log scenario end with status - write to /dev/tty to bypass capture
140140
if tty, err := os.OpenFile("/dev/tty", os.O_WRONLY, 0); err == nil {
141+
// Strip the working directory prefix to show relative paths
142+
uri := scenario.Uri
143+
if cwd, err := os.Getwd(); err == nil {
144+
if rel, err := filepath.Rel(cwd, uri); err == nil {
145+
uri = rel
146+
}
147+
}
148+
141149
if scenarioErr != nil {
142-
fmt.Fprintf(tty, "✗ FAILED: %s (%s)\n", scenario.Name, scenario.Uri)
150+
fmt.Fprintf(tty, "✗ FAILED: %s (%s)\n", scenario.Name, uri)
143151
} else {
144-
fmt.Fprintf(tty, "✓ PASSED: %s (%s)\n", scenario.Name, scenario.Uri)
152+
fmt.Fprintf(tty, "✓ PASSED: %s (%s)\n", scenario.Name, uri)
145153
}
146154
tty.Close()
147155
}

0 commit comments

Comments
 (0)