:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { earlyUserContextReads, watchEarlyUserContextReads } from 'lib/utils/deferredAppContext'
import type { AppContext } from '~/types'
describe('app boot modules', () => {
afterEach(() => {
delete window.POSTHOG_APP_CONTEXT
delete window.POSTHOG_APP_CONTEXT_REQUEST
})
it('do not read the user data when they load', async () => {
window.POSTHOG_APP_CONTEXT_REQUEST = new Promise(() => {})
window.POSTHOG_APP_CONTEXT = { anonymous: false, deferred: true } as unknown as AppContext
watchEarlyUserContextReads()
await jest.isolateModulesAsync(async () => {
await import('scenes/App')
await import('scenes/bootApp')
})
expect(earlyUserContextReads()).toEqual([])
})
})