Skip to content

Commit 94ef620

Browse files
committed
test: Add node scenarios
1 parent 79fa39f commit 94ef620

10 files changed

+97
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const Sentry = require("@sentry/node");
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+
Sentry.init({
21+
dsn: "https://[email protected]/0000000",
22+
integrations: [new CustomIntegration()]
23+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const Sentry = require("@sentry/node");
2+
3+
class CustomTransport extends Sentry.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+
Sentry.init({
20+
dsn: "https://[email protected]/0000000",
21+
transport: CustomTransport,
22+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const Sentry = require("@sentry/node");
2+
3+
Sentry.init({
4+
dsn: "https://[email protected]/0000000",
5+
sendClientReports: false,
6+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const Sentry = require("@sentry/node");
2+
3+
Sentry.init({
4+
dsn: "https://[email protected]/0000000",
5+
defaultIntegrations: false,
6+
});

scenarios/node/basic-no-dsn.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const Sentry = require("@sentry/node");
2+
3+
Sentry.init();

scenarios/node/basic-no-sessions.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const Sentry = require("@sentry/node");
2+
3+
Sentry.init({
4+
dsn: "https://[email protected]/0000000",
5+
release: "[email protected]",
6+
autoSessionTracking: false,
7+
});

scenarios/node/basic-with-debug.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const Sentry = require("@sentry/node");
2+
3+
Sentry.init({
4+
dsn: "https://[email protected]/0000000",
5+
debug: true,
6+
});

scenarios/node/basic-with-sessions.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const Sentry = require("@sentry/node");
2+
3+
Sentry.init({
4+
dsn: "https://[email protected]/0000000",
5+
release: "[email protected]",
6+
});

scenarios/node/basic.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const Sentry = require("@sentry/node");
2+
3+
Sentry.init({
4+
dsn: "https://[email protected]/0000000",
5+
});

scenarios/node/perf-manual.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const Sentry = require("@sentry/node");
2+
const _ = require("@sentry/tracing");
3+
4+
Sentry.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);

0 commit comments

Comments
 (0)