From 557ccdd5de3b7fca3b0c562f07c5716b5e944f17 Mon Sep 17 00:00:00 2001 From: Stephen Benjamin Date: Tue, 8 Oct 2024 09:50:10 -0400 Subject: [PATCH] Expose NewWriter from internal for openshift-tests-extension Ginkgo's output writer hardcodes output to always go to os.Stdout, this exposes the NewWriter function so openshift-tests-extension can use it. This gives us more control over how we handle output from ginkgo, including writing it to `stderr` instead of `stdout`, or writing it to `io.Discard`, while maintaing the bytes buffer for returning output to OTE. --- OWNERS | 1 + core_dsl_patch.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/OWNERS b/OWNERS index bfdc4ad275..5c9e0b087f 100644 --- a/OWNERS +++ b/OWNERS @@ -1,3 +1,4 @@ +reviewers: approvers: - bertinatto - bparees diff --git a/core_dsl_patch.go b/core_dsl_patch.go index 0260e4a53a..bf60ceb522 100644 --- a/core_dsl_patch.go +++ b/core_dsl_patch.go @@ -1,6 +1,8 @@ package ginkgo import ( + "io" + "github.com/onsi/ginkgo/v2/internal" "github.com/onsi/ginkgo/v2/internal/global" "github.com/onsi/ginkgo/v2/types" @@ -18,6 +20,10 @@ func GetFailer() *internal.Failer { return global.Failer } +func NewWriter(w io.Writer) *internal.Writer { + return internal.NewWriter(w) +} + func GetWriter() *internal.Writer { return GinkgoWriter.(*internal.Writer) }