From 4ecedcef3312641feaf724dd0ce3ff249b3399d9 Mon Sep 17 00:00:00 2001 From: Grunet Date: Mon, 10 Apr 2023 22:44:26 +0000 Subject: [PATCH] fix(opentelemetry-sdk-trace-web): Remove broken test and replace with comment --- packages/opentelemetry-sdk-trace-web/src/utils.ts | 2 +- .../test/utils.test.ts | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/packages/opentelemetry-sdk-trace-web/src/utils.ts b/packages/opentelemetry-sdk-trace-web/src/utils.ts index 04898e6a03..2027abc42f 100644 --- a/packages/opentelemetry-sdk-trace-web/src/utils.ts +++ b/packages/opentelemetry-sdk-trace-web/src/utils.ts @@ -309,7 +309,7 @@ export function parseUrl(url: string): URLLike { url, typeof document !== 'undefined' ? document.baseURI - : typeof location !== 'undefined' + : typeof location !== 'undefined' // Some JS runtimes (e.g. Deno) don't define this ? location.href : undefined ); diff --git a/packages/opentelemetry-sdk-trace-web/test/utils.test.ts b/packages/opentelemetry-sdk-trace-web/test/utils.test.ts index 3c1c60b90a..06e550c1f0 100644 --- a/packages/opentelemetry-sdk-trace-web/test/utils.test.ts +++ b/packages/opentelemetry-sdk-trace-web/test/utils.test.ts @@ -495,21 +495,6 @@ describe('utils', () => { assert.strictEqual(typeof url[field], 'string'); }); }); - - // Deno is an example of this - it('should parse url in runtimes where global location is not defined', () => { - const actualLocationObj = globalThis.location; - globalThis.location = undefined as any; // undefined is not allowed as a value normally, hence the any - - try { - const url = parseUrl('https://opentelemetry.io/foo'); - urlFields.forEach(field => { - assert.strictEqual(typeof url[field], 'string'); - }); - } finally { - globalThis.location = actualLocationObj; - } - }); }); describe('normalizeUrl', () => {