@@ -26,31 +26,31 @@ const stopProcessLogging = function (eventName, stopLogging, processHandler) {
2626 unsetProcessEvent ( eventName , processHandler )
2727}
2828
29- // Start logging while `process.exit()` is being stubbed
30- export const startExitLogging = function ( opts ) {
29+ // Start logging while `setTimeout()` and `process.exit()` are being stubbed
30+ export const startClockLogging = function ( opts ) {
31+ const clock = fakeTimers . install ( { toFake : [ 'setTimeout' ] } )
3132 stubProcessExit ( )
3233 const { stopLogging } = startLogging ( opts )
33- return stopExitLogging . bind ( undefined , stopLogging )
34+ const stopLoggingA = stopClockLogging . bind ( undefined , stopLogging , clock )
35+ return { clock, stopLogging : stopLoggingA }
3436}
3537
36- const stopExitLogging = function ( stopLogging ) {
38+ const stopClockLogging = function ( stopLogging , clock ) {
3739 stopLogging ( )
3840 unStubProcessExit ( )
41+ clock . uninstall ( )
3942}
4043
41- // Start logging while `setTimeout()` and `process.exit()` are being stubbed
42- export const startClockLogging = function ( opts ) {
43- const clock = fakeTimers . install ( { toFake : [ 'setTimeout' ] } )
44+ // Start logging while `process.exit()` is being stubbed
45+ export const startExitLogging = function ( opts ) {
4446 stubProcessExit ( )
4547 const { stopLogging } = startLogging ( opts )
46- const stopLoggingA = stopClockLogging . bind ( undefined , stopLogging , clock )
47- return { clock, stopLogging : stopLoggingA }
48+ return stopExitLogging . bind ( undefined , stopLogging )
4849}
4950
50- const stopClockLogging = function ( stopLogging , clock ) {
51+ const stopExitLogging = function ( stopLogging ) {
5152 stopLogging ( )
5253 unStubProcessExit ( )
53- clock . uninstall ( )
5454}
5555
5656// Stub `process.exit()`
0 commit comments