whats the use of beforeExit in the tests?