Skip to content

Commit d2d989c

Browse files
committed
plz dont be flaky
1 parent 51391c4 commit d2d989c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/remix/test/integration/app/routes/scope-bleed/$id.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as Sentry from '@sentry/remix';
44

55
export const loader: LoaderFunction = async ({ params: { id } }) => {
66
// Set delay to simulate requests at the same time
7-
await new Promise(resolve => setTimeout(resolve, parseInt(id || '', 10) * 1000 - 1000));
7+
await new Promise(resolve => setTimeout(resolve, 5000 - (parseInt(id || '', 10) * 1000 - 1000 - 14)));
88
Sentry.setTag(`tag${id}`, id);
99
return json({ test: 'test' });
1010
};

packages/remix/test/integration/test/server/loader.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,12 @@ describe.each(['builtin', 'express'])('Remix API Loaders with adapter = %s', ada
141141
const baseURL = await runServer(adapter);
142142

143143
await Promise.all(
144-
Array.from(Array(5).keys()).map(async (id: number) => {
144+
Array.from(Array(3).keys()).map(async (id: number) => {
145145
const url = `${baseURL}/scope-bleed/${id}`;
146-
await new Promise(resolve => setTimeout(resolve, 1000));
146+
// Send requests with 1 sec delays, but they should all resolve at the same time
147+
// See packages/remix/test/integration/app/routes/scope-bleed/$id.tsx
148+
// for server-side set up. Add 13 for a bit of randomness.
149+
await new Promise(resolve => setTimeout(resolve, id * 1000 - 1000 + 13));
147150
const envelope = await getEnvelopeRequest(url);
148151
const transaction = envelope[2];
149152

0 commit comments

Comments
 (0)