You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(e2e): route snap tarball downloads through MockServerE2E proxy
ReactNativeBlobUtil.fetch() bypasses shim.js's JS-layer fetch/XHR/expo-fetch
patches because it dispatches directly to OkHttp/NSURLSession. As a result,
the testSpecificMock rules registered for snap tarball downloads never fire,
and tests silently hit the live npm registry.
Rewrite the tarball URL at the source — inside NpmLocation.fetchNpmTarball —
when running in E2E. The request body and headers contract with native
ReactNativeBlobUtil stays untouched; only the target URL changes from
`https://registry.npmjs.org/...` to
`http://localhost:<mockServerPort>/proxy?url=<encoded-target>`.
Changes:
- app/core/Snaps/location/npm.ts: rewrite tarballUrl when isE2E
- app/util/test/utils.js: export FALLBACK_MOCK_SERVER_PORT + getMockServerPortInApp helper, mirroring fixtureServerPort/commandQueueServerPort pattern
- shim.js: store launchArgs.mockServerPort in testConfig so app code can read it
- app/core/Snaps/location/npm.test.ts: 2 new tests covering the rewrite both ways (E2E on / off)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments