Skip to content

test: Add node scenarios #4101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scenarios/browser/basic-capture-exception.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { init, captureException } from "@sentry/browser";

init({
dsn: "https://[email protected]/0000000",
});

captureException(new Error("error here!"));
7 changes: 7 additions & 0 deletions scenarios/browser/basic-capture-message.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { init, captureMessage } from "@sentry/browser";

init({
dsn: "https://[email protected]/0000000",
});

captureMessage("this is a message");
23 changes: 23 additions & 0 deletions scenarios/browser/basic-custom-integration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { init } from "@sentry/browser";

class CustomIntegration {
static id = 'CustomIntegration';

name = CustomIntegration.id;
options = undefined;

constructor(options) {
this.options = options;
}

setupOnce(addGlobalEventProcessor, getCurrentHub) {
addGlobalEventProcessor(event => event);
const hub = getCurrentHub();
hub.captureMessage(options.name);
}
}

init({
dsn: "https://[email protected]/0000000",
integrations: [new CustomIntegration()],
});
22 changes: 22 additions & 0 deletions scenarios/browser/basic-custom-transport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { init, Transports } from "@sentry/browser";

class CustomTransport extends Transports.BaseTransport {
constructor(options) {
super(options);
}

sendEvent(event) {
console.log("Sending Event");
return super.sendEvent(event);
}

sendSession(session) {
console.log("Sending Session");
return super.sendSession(session);
}
}

init({
dsn: "https://[email protected]/0000000",
transport: CustomTransport
});
6 changes: 6 additions & 0 deletions scenarios/browser/basic-no-client-reports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { init } from "@sentry/browser";

init({
dsn: "https://[email protected]/0000000",
sendClientReports: false,
});
6 changes: 6 additions & 0 deletions scenarios/browser/basic-no-default-integrations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { init } from "@sentry/browser";

init({
dsn: "https://[email protected]/0000000",
defaultIntegrations: false,
});
3 changes: 3 additions & 0 deletions scenarios/browser/basic-no-dsn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { init } from "@sentry/browser";

init();
7 changes: 7 additions & 0 deletions scenarios/browser/basic-no-sessions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { init } from "@sentry/browser";

init({
dsn: "https://[email protected]/0000000",
release: "[email protected]",
autoSessionTracking: false,
});
6 changes: 6 additions & 0 deletions scenarios/browser/basic-with-debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { init } from "@sentry/browser";

init({
dsn: "https://[email protected]/0000000",
debug: true,
});
6 changes: 6 additions & 0 deletions scenarios/browser/basic-with-sessions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { init } from "@sentry/browser";

init({
dsn: "https://[email protected]/0000000",
release: "[email protected]",
});
6 changes: 6 additions & 0 deletions scenarios/browser/basic-with-tunnel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { init } from "@sentry/browser";

init({
dsn: "https://[email protected]/0000000",
tunnel: "/errors",
});
5 changes: 5 additions & 0 deletions scenarios/browser/basic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { init } from "@sentry/browser";

init({
dsn: "https://[email protected]/0000000",
});
8 changes: 8 additions & 0 deletions scenarios/browser/perf-auto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { init } from "@sentry/browser";
import { Integrations } from "@sentry/tracing";

init({
dsn: "https://[email protected]/0000000",
integrations: [new Integrations.BrowserTracing()],
tracesSampleRate: 1.0,
});
13 changes: 13 additions & 0 deletions scenarios/browser/perf-manual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { init, startTransaction } from "@sentry/browser";
import "@sentry/tracing";

init({
dsn: "https://[email protected]/0000000",
tracesSampleRate: 1.0,
});

const transaction = startTransaction({ op: "task", name: "Important Stuff" });

setTimeout(() => {
transaction.finish();
}, 1000);
7 changes: 7 additions & 0 deletions scenarios/browser/react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { init } from "@sentry/react";

init({
dsn: "https://[email protected]/0000000",
});


7 changes: 7 additions & 0 deletions scenarios/node/basic-capture-exception.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const Sentry = require("@sentry/node");

Sentry.init({
dsn: "https://[email protected]/0000000",
});

Sentry.captureException(new Error("error here!"));
7 changes: 7 additions & 0 deletions scenarios/node/basic-capture-message.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const Sentry = require("@sentry/node");

Sentry.init({
dsn: "https://[email protected]/0000000",
});

Sentry.captureMessage("this is a message");
23 changes: 23 additions & 0 deletions scenarios/node/basic-custom-integration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const Sentry = require("@sentry/node");

class CustomIntegration {
static id = 'CustomIntegration';

name = CustomIntegration.id;
options = undefined;

constructor(options) {
this.options = options;
}

setupOnce(addGlobalEventProcessor, getCurrentHub) {
addGlobalEventProcessor(event => event);
const hub = getCurrentHub();
hub.captureMessage(options.name);
}
}

Sentry.init({
dsn: "https://[email protected]/0000000",
integrations: [new CustomIntegration()]
});
22 changes: 22 additions & 0 deletions scenarios/node/basic-custom-transport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const Sentry = require("@sentry/node");

class CustomTransport extends Sentry.Transports.BaseTransport {
constructor(options) {
super(options);
}

sendEvent(event) {
console.log("Sending Event");
return super.sendEvent(event);
}

sendSession(session) {
console.log("Sending Session");
return super.sendSession(session);
}
}

Sentry.init({
dsn: "https://[email protected]/0000000",
transport: CustomTransport,
});
6 changes: 6 additions & 0 deletions scenarios/node/basic-no-client-repors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const Sentry = require("@sentry/node");

Sentry.init({
dsn: "https://[email protected]/0000000",
sendClientReports: false,
});
6 changes: 6 additions & 0 deletions scenarios/node/basic-no-default-integrations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const Sentry = require("@sentry/node");

Sentry.init({
dsn: "https://[email protected]/0000000",
defaultIntegrations: false,
});
3 changes: 3 additions & 0 deletions scenarios/node/basic-no-dsn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const Sentry = require("@sentry/node");

Sentry.init();
7 changes: 7 additions & 0 deletions scenarios/node/basic-no-sessions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const Sentry = require("@sentry/node");

Sentry.init({
dsn: "https://[email protected]/0000000",
release: "[email protected]",
autoSessionTracking: false,
});
6 changes: 6 additions & 0 deletions scenarios/node/basic-with-debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const Sentry = require("@sentry/node");

Sentry.init({
dsn: "https://[email protected]/0000000",
debug: true,
});
6 changes: 6 additions & 0 deletions scenarios/node/basic-with-sessions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const Sentry = require("@sentry/node");

Sentry.init({
dsn: "https://[email protected]/0000000",
release: "[email protected]",
});
5 changes: 5 additions & 0 deletions scenarios/node/basic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Sentry = require("@sentry/node");

Sentry.init({
dsn: "https://[email protected]/0000000",
});
13 changes: 13 additions & 0 deletions scenarios/node/perf-manual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const Sentry = require("@sentry/node");
const _ = require("@sentry/tracing");

Sentry.init({
dsn: "https://[email protected]/0000000",
tracesSampleRate: 1.0,
});

const transaction = Sentry.startTransaction({ op: "task", name: "Important Stuff" });

setTimeout(() => {
transaction.finish();
}, 1000);