From eb641452f4981e2f4476cf5eb9edff1cc8bccca9 Mon Sep 17 00:00:00 2001 From: nhatthm Date: Fri, 14 May 2021 15:10:44 +0200 Subject: [PATCH] Flush console at close to get full output --- manager.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/manager.go b/manager.go index 4230059..29d2633 100644 --- a/manager.go +++ b/manager.go @@ -104,6 +104,8 @@ func (m *Manager) CloseConsole(sc *godog.Scenario) { return } + m.flushSession(sess) + for _, fn := range m.closers { fn(sc) } @@ -116,9 +118,13 @@ func (m *Manager) CloseConsole(sc *godog.Scenario) { m.current = "" } +func (m *Manager) flushSession(s *session) { + s.console.Expect(expect.EOF, expect.PTSClosed, expect.WithTimeout(10*time.Millisecond)) // nolint: errcheck, gosec +} + // Flush flushes console state. func (m *Manager) Flush() { - m.session().console.Expect(expect.EOF, expect.PTSClosed, expect.WithTimeout(10*time.Millisecond)) // nolint: errcheck, gosec + m.flushSession(m.session()) } func (m *Manager) isConsoleOutput(expected *godog.DocString) error {