-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathcloudflare-runtime.test.ts
More file actions
34 lines (29 loc) · 1.02 KB
/
cloudflare-runtime.test.ts
File metadata and controls
34 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
test.describe('Cloudflare Runtime', () => {
test('Should report cloudflare as the runtime in API route error events', async ({ request }) => {
const errorEventPromise = waitForError('nextjs-16-cf-workers', errorEvent => {
return !!errorEvent?.exception?.values?.some(value =>
value.value?.includes('This is a test error from an API route'),
);
});
request.get('/api/test-error').catch(() => {
// Expected to fail
});
const errorEvent = await errorEventPromise;
expect(errorEvent.contexts?.runtime).toEqual({
name: 'cloudflare',
});
// The SDK info should include cloudflare in the packages
expect(errorEvent.sdk?.packages).toEqual(
expect.arrayContaining([
expect.objectContaining({
name: 'npm:@sentry/nextjs',
}),
expect.objectContaining({
name: 'npm:@sentry/cloudflare',
}),
]),
);
});
});