1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +02:00

Don't show toasts when running integration tests

It's pointless because you can't check for them in tests anyway, so they
unnecessarily slow down the test run by two seconds for no reason.
This commit is contained in:
Stefan Haller 2023-08-30 10:54:32 +02:00
parent 2b26b380b6
commit 81216189e4
3 changed files with 14 additions and 0 deletions

View File

@ -21,6 +21,13 @@ func NewAppStatusHelper(c *HelperCommon, statusMgr func() *status.StatusManager)
}
func (self *AppStatusHelper) Toast(message string) {
if self.c.RunningIntegrationTest() {
// Don't bother showing toasts in integration tests. You can't check for
// them anyway, and they would only slow down the test unnecessarily by
// two seconds.
return
}
self.statusMgr().AddToastStatus(message)
self.renderAppStatus()

View File

@ -182,6 +182,10 @@ func (self *guiCommon) AfterLayout(f func() error) {
}
}
func (self *guiCommon) RunningIntegrationTest() bool {
return self.gui.integrationTest != nil
}
func (self *guiCommon) InDemo() bool {
return self.gui.integrationTest != nil && self.gui.integrationTest.IsDemo()
}

View File

@ -107,6 +107,9 @@ type IGuiCommon interface {
// hopefully we can remove this once we've moved all our keybinding stuff out of the gui god struct.
GetInitialKeybindingsWithCustomCommands() ([]*Binding, []*gocui.ViewMouseBinding)
// Returns true if we're running an integration test
RunningIntegrationTest() bool
// Returns true if we're in a demo recording/playback
InDemo() bool
}