Skip to content

Commit 6adc783

Browse files
committed
fix integration tests
1 parent d9db03d commit 6adc783

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

packages/core/src/request.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ export function eventToSentryRequest(event: Event, api: APIDetails): SentryReque
7171
// https://github.com/getsentry/sentry-javascript/issues/2809 and
7272
// https://github.com/getsentry/sentry-javascript/pull/4425. TL;DR: even though we normalize all events (which should
7373
// prevent this), something is causing `JSON.stringify` to throw a circular reference error.
74+
//
75+
// TODO: It was necessary to compensate for this in the browser playwright tests, so when it's time to pull this hack
76+
// out, search for `skippedNormalization` and you'll find a note pointing out what to remove.
7477
const withSDKInfo = sdkInfo ? enhanceEventWithSdkInfo(event, api.metadata.sdk) : event;
7578
let body;
7679
try {

packages/integration-tests/utils/helpers.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,21 @@ async function getMultipleRequests(
8787
if (urlRgx.test(request.url())) {
8888
try {
8989
reqCount -= 1;
90-
requestData.push(requestParser(request));
90+
91+
// TODO: This is to compensate for a temporary debugging hack which adds data the tests aren't anticipating to
92+
// the request. The code can be restored to its original form (the commented-out line below) once that hack is
93+
// removed. See https://github.com/getsentry/sentry-javascript/pull/4425.
94+
const parsedRequest = requestParser(request);
95+
if (parsedRequest.tags) {
96+
if (parsedRequest.tags.skippedNormalization && Object.keys(parsedRequest.tags).length === 1) {
97+
delete parsedRequest.tags;
98+
} else {
99+
delete parsedRequest.tags.skippedNormalization;
100+
}
101+
}
102+
requestData.push(parsedRequest);
103+
// requestData.push(requestParser(request));
104+
91105
if (reqCount === 0) {
92106
resolve(requestData);
93107
}

0 commit comments

Comments
 (0)