1// Package `globals` provides an interface to alter the global state of ginkgo suite. 2// 3// ginkgo currently registers a few singleton global vars that hold all the 4// test blocks and failure management. These vars are global per package, which means 5// that only one Suite definition can coexist in one package. 6// 7// However, there can be some use cases where applications using ginkgo may want to 8// have a bit more control about this. For instance, a package may be using ginkgo 9// to dynamically generate different tests and groups depending on some configuration. 10// In this particular case, if the application wants to test how these different groups 11// are generated, they will need access to change these global variables, so they 12// can re-generate this global state, and ensure that different configuration generate 13// indeed different tests. 14// 15// Note that this package is not intended to be used as part of normal ginkgo setups, and 16// usually, you will never need to worry about the global state of ginkgo 17package globals 18 19import "github.com/onsi/ginkgo/internal/global" 20 21// Reset calls `global.InitializeGlobals()` which will basically create a new instance 22// of Suite, and therefore, will effectively reset the global variables to the init state. 23// This will effectively remove all groups, tests and blocks that were added to the Suite. 24func Reset() { 25 global.InitializeGlobals() 26} 27