From 4e6a40ad1451b77b8b76f5911fb6edbf1275637a Mon Sep 17 00:00:00 2001 From: Satoshi Qazi Muhammed Date: Sun, 11 Oct 2026 07:22:37 +0400 Subject: [PATCH] dev-test: expose location in the browser environment The browser environment copied window, document, navigator and localStorage onto the global, but not location. Code that reads the bare global, such as the apps URL type decoder, threw "location is not defined" while an ApiPromise was being created, so the api never became ready. location is now exposed with the other window objects. --- packages/dev-test/src/env/browser.spec.ts | 1 + packages/dev-test/src/env/browser.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/dev-test/src/env/browser.spec.ts b/packages/dev-test/src/env/browser.spec.ts index 1a72884..690ff88 100644 --- a/packages/dev-test/src/env/browser.spec.ts +++ b/packages/dev-test/src/env/browser.spec.ts @@ -21,6 +21,7 @@ describe('browser', () => { it('contains the top-level objects', () => { expect(all.document).toBeDefined(); expect(all.navigator).toBeDefined(); + expect(location.href).toBe('http://localhost/'); }); it('contains HTML*Element', () => { diff --git a/packages/dev-test/src/env/browser.ts b/packages/dev-test/src/env/browser.ts index 5926bfc..07d079d 100644 --- a/packages/dev-test/src/env/browser.ts +++ b/packages/dev-test/src/env/browser.ts @@ -181,6 +181,7 @@ export function browser () { crypto: window.crypto, document: window.document, localStorage: window.localStorage, + location: window.location, navigator: window.navigator, // window... window