From d58da1cfcb4284d0ea8d08053a8147f00ea59c25 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Wed, 27 Nov 2024 19:34:33 +0000 Subject: [PATCH] Update integration tests --- .../suites/integrations/httpclient/axios/test.ts | 9 +++++++++ .../suites/integrations/httpclient/fetch/simple/test.ts | 9 +++++++++ .../integrations/httpclient/fetch/withRequest/test.ts | 9 +++++++++ .../fetch/withRequestAndBodyAndOptions/test.ts | 9 +++++++++ .../httpclient/fetch/withRequestAndOptions/test.ts | 9 +++++++++ .../suites/integrations/httpclient/xhr/test.ts | 9 +++++++++ .../browser-integration-tests/utils/generatePlugin.ts | 1 - packages/browser/src/integrations/httpclient.ts | 5 +---- 8 files changed, 55 insertions(+), 5 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts index 8b4267c217e6..29f564fed15c 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts @@ -40,6 +40,15 @@ sentryTest( type: 'http.client', handled: false, }, + stacktrace: { + frames: expect.arrayContaining([ + expect.objectContaining({ + filename: 'http://sentry-test.io/subject.bundle.js', + function: '?', + in_app: true, + }), + ]), + }, }, ], }, diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts index d490f98426cd..ee40a6bdc054 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts @@ -42,6 +42,15 @@ sentryTest( type: 'http.client', handled: false, }, + stacktrace: { + frames: expect.arrayContaining([ + expect.objectContaining({ + filename: 'http://sentry-test.io/subject.bundle.js', + function: '?', + in_app: true, + }), + ]), + }, }, ], }, diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts index 9fb6add1a2d5..7492a39e039b 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts @@ -38,6 +38,15 @@ sentryTest('works with a Request passed in', async ({ getLocalTestUrl, page }) = type: 'http.client', handled: false, }, + stacktrace: { + frames: expect.arrayContaining([ + expect.objectContaining({ + filename: 'http://sentry-test.io/subject.bundle.js', + function: '?', + in_app: true, + }), + ]), + }, }, ], }, diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts index 485a52ed3fd4..4426bd05733a 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts @@ -40,6 +40,15 @@ sentryTest( type: 'http.client', handled: false, }, + stacktrace: { + frames: expect.arrayContaining([ + expect.objectContaining({ + filename: 'http://sentry-test.io/subject.bundle.js', + function: '?', + in_app: true, + }), + ]), + }, }, ], }, diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts index d78860f7b1a6..79131aef0558 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts @@ -38,6 +38,15 @@ sentryTest('works with a Request (without body) & options passed in', async ({ g type: 'http.client', handled: false, }, + stacktrace: { + frames: expect.arrayContaining([ + expect.objectContaining({ + filename: 'http://sentry-test.io/subject.bundle.js', + function: '?', + in_app: true, + }), + ]), + }, }, ], }, diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts index 9953de1c860e..5d1c10d5f9da 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts @@ -40,6 +40,15 @@ sentryTest( type: 'http.client', handled: false, }, + stacktrace: { + frames: expect.arrayContaining([ + expect.objectContaining({ + filename: 'http://sentry-test.io/subject.bundle.js', + function: '?', + in_app: true, + }), + ]), + }, }, ], }, diff --git a/dev-packages/browser-integration-tests/utils/generatePlugin.ts b/dev-packages/browser-integration-tests/utils/generatePlugin.ts index 26a086bf2a77..3b6491debd72 100644 --- a/dev-packages/browser-integration-tests/utils/generatePlugin.ts +++ b/dev-packages/browser-integration-tests/utils/generatePlugin.ts @@ -176,7 +176,6 @@ class SentryScenarioGenerationPlugin { } : {}; - // Checking if the current scenario has imported `@sentry/integrations`. compiler.hooks.normalModuleFactory.tap(this._name, factory => { factory.hooks.parser.for('javascript/auto').tap(this._name, parser => { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access diff --git a/packages/browser/src/integrations/httpclient.ts b/packages/browser/src/integrations/httpclient.ts index 8024197e1f92..65deaae6b7e9 100644 --- a/packages/browser/src/integrations/httpclient.ts +++ b/packages/browser/src/integrations/httpclient.ts @@ -46,7 +46,7 @@ const _httpClientIntegration = ((options: Partial = {}) => { return { name: INTEGRATION_NAME, - setup(client: Client): void { + setup(client): void { _wrapFetch(client, _options); _wrapXHR(client, _options); }, @@ -93,10 +93,7 @@ function _fetchResponseHandler( stacktrace: error instanceof Error ? error.stack : undefined, }); - // withScope(scope => { - // scope.setFingerprint([request.url, request.method, response.status.toString()]); captureEvent(event); - // }); } }