Skip to content

Commit d11472d

Browse files
committed
remove compensation in tests
1 parent c335d95 commit d11472d

File tree

6 files changed

+5
-56
lines changed

6 files changed

+5
-56
lines changed

packages/core/test/lib/base.test.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -884,29 +884,9 @@ describe('BaseClient', () => {
884884
const normalizedTransaction = JSON.parse(JSON.stringify(transaction)); // deep-copy
885885

886886
client.captureEvent(transaction);
887-
888-
// TODO: This is to compensate for a temporary debugging hack which adds data the tests aren't anticipating to the
889-
// event. The code can be restored to its original form (the commented-out line below) once that hack is
890-
// removed. See https://github.com/getsentry/sentry-javascript/pull/4425 and
891-
// https://github.com/getsentry/sentry-javascript/pull/4574
892887
const capturedEvent = TestClient.instance!.event!;
893-
if (capturedEvent.sdkProcessingMetadata?.normalizeDepth) {
894-
if (Object.keys(capturedEvent.sdkProcessingMetadata).length === 1) {
895-
delete capturedEvent.sdkProcessingMetadata;
896-
} else {
897-
delete capturedEvent.sdkProcessingMetadata.normalizeDepth;
898-
}
899-
}
900-
if (capturedEvent.sdkProcessingMetadata?.baseClientNormalized) {
901-
if (Object.keys(capturedEvent.sdkProcessingMetadata).length === 1) {
902-
delete capturedEvent.sdkProcessingMetadata;
903-
} else {
904-
delete capturedEvent.sdkProcessingMetadata.baseClientNormalized;
905-
}
906-
}
907888

908889
expect(capturedEvent).toEqual(normalizedTransaction);
909-
// expect(TestClient.instance!.event!).toEqual(normalizedTransaction);
910890
});
911891

912892
test('calls beforeSend and uses original event without any changes', () => {

packages/core/test/mocks/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ export class TestClient extends BaseClient<TestClientOptions> {
6969

7070
public sendEvent(event: Event, hint?: EventHint): void {
7171
this.event = event;
72+
73+
// In real life, this will get deleted as part of envelope creation.
74+
delete event.sdkProcessingMetadata;
75+
7276
if (this._options.enableSend) {
7377
super.sendEvent(event, hint);
7478
return;

packages/integration-tests/suites/public-api/configureScope/clear_scope/test.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@ sentryTest('should clear previously set properties of a scope', async ({ getLoca
99

1010
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
1111

12-
// TODO: This is to compensate for a temporary debugging hack which adds data the tests aren't anticipating to the
13-
// event. The code can be restored to its original form (the commented-out line below) once that hack is
14-
// removed. See https://github.com/getsentry/sentry-javascript/pull/4425 and
15-
// https://github.com/getsentry/sentry-javascript/pull/4574
16-
if (eventData.extra) {
17-
if (Object.keys(eventData.extra).length === 1) {
18-
delete eventData.extra;
19-
} else {
20-
delete eventData.extra.normalizeDepth;
21-
}
22-
}
23-
2412
expect(eventData.message).toBe('cleared_scope');
2513
expect(eventData.user).toBeUndefined();
2614
expect(eventData.tags).toBeUndefined();

packages/integration-tests/utils/helpers.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,7 @@ async function getMultipleRequests(
7070
if (urlRgx.test(request.url())) {
7171
try {
7272
reqCount -= 1;
73-
74-
// TODO: This is to compensate for a temporary debugging hack which adds data the tests aren't anticipating to
75-
// the request. The code can be restored to its original form (the commented-out line below) once that hack is
76-
// removed. See https://github.com/getsentry/sentry-javascript/pull/4425.
77-
const parsedRequest = requestParser(request);
78-
if (parsedRequest.tags) {
79-
if (
80-
Object.keys(parsedRequest.tags).length === 0 ||
81-
(Object.keys(parsedRequest.tags).length === 1 && 'skippedNormalization' in parsedRequest.tags)
82-
) {
83-
delete parsedRequest.tags;
84-
} else {
85-
delete parsedRequest.tags.skippedNormalization;
86-
}
87-
}
88-
if (parsedRequest.extra && Object.keys(parsedRequest.extra).length === 0) {
89-
delete parsedRequest.extra;
90-
}
91-
requestData.push(parsedRequest);
92-
// requestData.push(requestParser(request));
73+
requestData.push(requestParser(request));
9374

9475
if (reqCount === 0) {
9576
if (timeoutId) {

packages/node-integration-tests/suites/public-api/configureScope/clear_scope/test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ test('should clear previously set properties of a scope', async () => {
88

99
assertSentryEvent(envelope[2], {
1010
message: 'cleared_scope',
11-
tags: {},
12-
extra: {},
1311
});
1412

1513
expect((envelope[2] as Event).user).not.toBeDefined();

packages/node-integration-tests/suites/public-api/withScope/nested-scopes/test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ test('should allow nested scoping', async () => {
1111
user: {
1212
id: 'qux',
1313
},
14-
tags: {},
1514
});
1615

1716
assertSentryEvent(envelopes[3][2], {
@@ -49,6 +48,5 @@ test('should allow nested scoping', async () => {
4948
user: {
5049
id: 'qux',
5150
},
52-
tags: {},
5351
});
5452
});

0 commit comments

Comments
 (0)