Let’s say you want to test handling of failing API backend call. Unfortunately it’s not easy to trigger.
How to make it easier to trigger? We can modify the code to introduce a buggy invocation. That works but what if we want to do it in the feature, without modifying the code all the time?
What I do is: I add window.debug object that exposes a bunch of functions that help in debugging the app.
It could be listing information internal to the app.
It could be setting a flag to change app’s behavior.
It could be forcing the next API call to fail to exercise handling of failures.
Those functions can be called in dev tools console.