File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,17 @@ import * as matchers from "@testing-library/jest-dom/matchers"
66import "@testing-library/jest-dom/vitest"
77import { cleanup } from "@testing-library/react"
88
9- // without nock, posthog and other services will attempt to load and cause tests to be flakey
9+ // happy-dom blocks external <script src="..."> execution by default, which prevents SDK bundles
10+ // like PostHog/Clerk from loading in tests.
11+ //
12+ // nock is still useful as a second layer: it blocks accidental external HTTP calls (fetch/xhr/http)
13+ // so tests remain deterministic even if runtime behavior changes.
1014nock . disableNetConnect ( )
1115nock . enableNetConnect ( ( host : string ) => {
1216 return host . startsWith ( "127.0.0.1" ) || host . startsWith ( "localhost" )
1317} )
1418
19+ // Keep this explicit PostHog stub for stability across environment/runtime differences.
1520nock ( / p o s t h o g \. c o m / )
1621 . persist ( )
1722 . get ( / .* / )
You can’t perform that action at this time.
0 commit comments