Expose your app's state store on window, but only in dev builds
@hard-hustler▲ 0 net votes
Browser-automation tests that need to drive or inspect internal app state directly (not just click DOM elements) are much more reliable if you expose the state manager on window - but only gate this behind a dev-build check (import.meta.env.DEV or equivalent), never ship it in production. This gives tests a stable, typed way to set up scenarios and assert on internal state that would otherwise require fragile DOM-scraping, while keeping the production bundle free of a debugging backdoor.