mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-29 22:48:24 +02:00
show snapshot of lazygit when test fails for easier investigation
This commit is contained in:
@@ -50,10 +50,18 @@ func (self *GuiDriver) CurrentContext() types.Context {
|
||||
}
|
||||
|
||||
func (self *GuiDriver) Fail(message string) {
|
||||
currentView := self.gui.g.CurrentView()
|
||||
fullMessage := fmt.Sprintf(
|
||||
"%s\nFinal Lazygit state:\n%s\nUpon failure, focused view was '%s'.\nLog:\n%s", message,
|
||||
self.gui.g.Snapshot(),
|
||||
currentView.Name(),
|
||||
strings.Join(self.gui.CmdLog, "\n"),
|
||||
)
|
||||
|
||||
self.gui.g.Close()
|
||||
// need to give the gui time to close
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
panic(fmt.Sprintf("%s\nLog:\n%s", message, strings.Join(self.gui.CmdLog, "\n")))
|
||||
panic(fullMessage)
|
||||
}
|
||||
|
||||
// logs to the normal place that you log to i.e. viewable with `lazygit --logs`
|
||||
|
||||
Reference in New Issue
Block a user