Skip to content

Commit 7e8f9a5

Browse files
committed
Fix e2e-tests
1 parent d8bf84a commit 7e8f9a5

File tree

1 file changed

+33
-32
lines changed
  • dev-packages/e2e-tests/test-applications/cloudflare-workers/src

1 file changed

+33
-32
lines changed

dev-packages/e2e-tests/test-applications/cloudflare-workers/src/index.ts

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Learn more at https://developers.cloudflare.com/workers/
1212
*/
1313
import * as Sentry from '@sentry/cloudflare';
14-
import { DurableObject } from "cloudflare:workers";
14+
import { DurableObject } from 'cloudflare:workers';
1515

1616
class MyDurableObjectBase extends DurableObject<Env> {
1717
private throwOnExit = new WeakMap<WebSocket, Error>();
@@ -44,7 +44,7 @@ class MyDurableObjectBase extends DurableObject<Env> {
4444
}
4545

4646
webSocketClose(ws: WebSocket): void | Promise<void> {
47-
if (this.throwOnExit.has(ws)) {
47+
if (this.throwOnExit.has(ws)) {
4848
const error = this.throwOnExit.get(ws)!;
4949
this.throwOnExit.delete(ws);
5050
throw error;
@@ -53,36 +53,37 @@ class MyDurableObjectBase extends DurableObject<Env> {
5353
}
5454

5555
export const MyDurableObject = Sentry.instrumentDurableObjectWithSentry(
56-
(env: Env) => ({
57-
dsn: env.E2E_TEST_DSN,
58-
environment: 'qa', // dynamic sampling bias to keep transactions
59-
tunnel: `http://localhost:3031/`, // proxy server
60-
tracesSampleRate: 1.0,
61-
sendDefaultPii: true,
62-
transportOptions: {
63-
// We are doing a lot of events at once in this test
64-
bufferSize: 1000,
65-
},
66-
}),
67-
MyDurableObjectBase,
56+
(env: Env) => ({
57+
dsn: env.E2E_TEST_DSN,
58+
environment: 'qa', // dynamic sampling bias to keep transactions
59+
tunnel: `http://localhost:3031/`, // proxy server
60+
tracesSampleRate: 1.0,
61+
sendDefaultPii: true,
62+
transportOptions: {
63+
// We are doing a lot of events at once in this test
64+
bufferSize: 1000,
65+
},
66+
instrumentPrototypeMethods: true,
67+
}),
68+
MyDurableObjectBase,
6869
);
6970

7071
export default Sentry.withSentry(
71-
(env: Env) => ({
72-
dsn: env.E2E_TEST_DSN,
73-
environment: 'qa', // dynamic sampling bias to keep transactions
74-
tunnel: `http://localhost:3031/`, // proxy server
75-
tracesSampleRate: 1.0,
76-
sendDefaultPii: true,
77-
transportOptions: {
78-
// We are doing a lot of events at once in this test
79-
bufferSize: 1000,
80-
},
81-
}),
82-
{
83-
async fetch(request, env) {
84-
const url = new URL(request.url);
85-
switch (url.pathname) {
72+
(env: Env) => ({
73+
dsn: env.E2E_TEST_DSN,
74+
environment: 'qa', // dynamic sampling bias to keep transactions
75+
tunnel: `http://localhost:3031/`, // proxy server
76+
tracesSampleRate: 1.0,
77+
sendDefaultPii: true,
78+
transportOptions: {
79+
// We are doing a lot of events at once in this test
80+
bufferSize: 1000,
81+
},
82+
}),
83+
{
84+
async fetch(request, env) {
85+
const url = new URL(request.url);
86+
switch (url.pathname) {
8687
case '/rpc/throwException':
8788
{
8889
const id = env.MY_DURABLE_OBJECT.idFromName('foo');
@@ -105,7 +106,7 @@ export default Sentry.withSentry(
105106
return stub.fetch(new Request(url, request));
106107
}
107108
}
108-
return new Response('Hello World!');
109-
},
110-
} satisfies ExportedHandler<Env>,
109+
return new Response('Hello World!');
110+
},
111+
} satisfies ExportedHandler<Env>,
111112
);

0 commit comments

Comments
 (0)