From 840f39fb5ad13f252e20d469d1bc57e65256a6f8 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 11 Nov 2025 11:01:18 +0100 Subject: [PATCH 1/2] test(browser-integration): Fix incorrect tag value assertions --- .../suites/public-api/setTag/with_primitives/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-packages/browser-integration-tests/suites/public-api/setTag/with_primitives/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setTag/with_primitives/test.ts index 47116b6554bb..2b4922e4a86e 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setTag/with_primitives/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setTag/with_primitives/test.ts @@ -9,7 +9,7 @@ sentryTest('should set primitive tags', async ({ getLocalTestUrl, page }) => { const eventData = await getFirstSentryEnvelopeRequest(page, url); expect(eventData.message).toBe('primitive_tags'); - expect(eventData.tags).toMatchObject({ + expect(eventData.tags).toEqual({ tag_1: 'foo', tag_2: 3.141592653589793, tag_3: false, From d280f6b5a234ebac6b460e2745f8c06239af7b1d Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 11 Nov 2025 11:10:56 +0100 Subject: [PATCH 2/2] found bug --- .../public-api/setTag/with_non_primitives/test.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/public-api/setTag/with_non_primitives/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setTag/with_non_primitives/test.ts index 181711650074..648187404c0e 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setTag/with_non_primitives/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setTag/with_non_primitives/test.ts @@ -3,11 +3,19 @@ import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should not accept non-primitive tags', async ({ getLocalTestUrl, page }) => { +sentryTest('[bug] accepts non-primitive tags', async ({ getLocalTestUrl, page }) => { + // this is a bug that went unnoticed due to type definitions and a bad assertion + // TODO: We should not accept non-primitive tags. Fix this as a follow-up. const url = await getLocalTestUrl({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); expect(eventData.message).toBe('non_primitives'); - expect(eventData.tags).toMatchObject({}); + + // TODO: This should be an empty object but instead, it is: + expect(eventData.tags).toEqual({ + tag_1: {}, + tag_2: [], + tag_3: ['a', {}], + }); });