Skip to content

Commit 3a9219b

Browse files
committed
test: Add browser based scenarios
1 parent 6b278f1 commit 3a9219b

9 files changed

+96
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { init } from "@sentry/browser";
2+
3+
class CustomIntegration {
4+
static id = 'CustomIntegration';
5+
6+
name = CustomIntegration.id;
7+
options = undefined;
8+
9+
constructor(options) {
10+
this.options = options;
11+
}
12+
13+
setupOnce(addGlobalEventProcessor, getCurrentHub) {
14+
addGlobalEventProcessor(event => event);
15+
const hub = getCurrentHub();
16+
hub.captureMessage(options.name);
17+
}
18+
}
19+
20+
init({
21+
dsn: "https://[email protected]/0000000",
22+
integrations: [CustomIntegration()],
23+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { init, Transports } from "@sentry/browser";
2+
3+
class CustomTransport extends Transports.BaseTransport {
4+
constructor(options) {
5+
super(options);
6+
}
7+
8+
sendEvent(event) {
9+
console.log("Sending Event");
10+
return super.sendEvent(event);
11+
}
12+
13+
sendSession(session) {
14+
console.log("Sending Session");
15+
return super.sendSession(session);
16+
}
17+
}
18+
19+
init({
20+
dsn: "https://[email protected]/0000000",
21+
transport: CustomTransport
22+
});

scenarios/browser/basic-init.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { init } from "@sentry/browser";
2+
3+
init({
4+
dsn: "https://[email protected]/0000000",
5+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { init } from "@sentry/browser";
2+
3+
init({
4+
dsn: "https://[email protected]/0000000",
5+
defaultIntegrations: false,
6+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { init } from "@sentry/browser";
2+
3+
init({
4+
dsn: "https://[email protected]/0000000",
5+
release: "[email protected]",
6+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { init } from "@sentry/browser";
2+
3+
init({
4+
dsn: "https://[email protected]/0000000",
5+
tunnel: "/errors",
6+
});

scenarios/browser/perf-auto.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { init } from "@sentry/browser";
2+
import { Integrations } from "@sentry/tracing";
3+
4+
init({
5+
dsn: "https://[email protected]/0000000",
6+
integrations: [new Integrations.BrowserTracing()],
7+
tracesSampleRate: 1.0,
8+
});

scenarios/browser/perf-manual.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { init } from "@sentry/browser";
2+
import "@sentry/tracing";
3+
4+
init({
5+
dsn: "https://[email protected]/0000000",
6+
tracesSampleRate: 1.0,
7+
});
8+
9+
const transaction = Sentry.startTransaction({ op: "task", name: "Important Stuff" });
10+
11+
setTimeout(() => {
12+
transaction.finish();
13+
}, 1000);

scenarios/browser/react.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { init } from "@sentry/react";
2+
3+
init({
4+
dsn: "https://[email protected]/0000000",
5+
});
6+
7+

0 commit comments

Comments
 (0)