Since delegate.dispatch(context, runnable) generally don't execute the runnable immediately, you should increment the counter before constructing the Runnable, and not inside the Runnable itself.
The current approach will increment the counter too late, and you can potentially get false positive idle notifications.
https://github.com/RBusarow/Dispatch/blob/4b231ef18802c064375eee7a58326f8283794dcd/dispatch-android-espresso/src/main/java/dispatch/android/espresso/IdlingDispatcher.kt#L58
Since
delegate.dispatch(context, runnable)
generally don't execute therunnable
immediately, you should increment the counter before constructing the Runnable, and not inside the Runnable itself. The current approach will increment the counter too late, and you can potentially get false positive idle notifications.