Skip to content

Commit a6c384c

Browse files
authored
test: Add browser based scenarios (#4100)
1 parent af0e436 commit a6c384c

File tree

38 files changed

+1150
-0
lines changed

38 files changed

+1150
-0
lines changed

.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,14 @@ module.exports = {
3131
'jsdoc/require-jsdoc': 'off',
3232
},
3333
},
34+
{
35+
files: ["scenarios/**"],
36+
parserOptions: {
37+
sourceType: "module",
38+
},
39+
rules: {
40+
"no-console": "off",
41+
},
42+
},
3443
],
3544
};

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ coverage/
1111
scratch/
1212
*.pyc
1313
*.tsbuildinfo
14+
scenarios/*/dist/
1415

1516
# logs
1617
yarn-error.log

packages/eslint-config-sdk/src/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ module.exports = {
186186
ecmaVersion: 2018,
187187
},
188188
},
189+
{
190+
// Configuration for jsx and tsx files
191+
files: ['*.tsx', '*.jsx', '*.test.tsx', '*.test.jsx'],
192+
parserOptions: {
193+
jsx: true,
194+
},
195+
},
189196
],
190197

191198
rules: {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { init, captureException } from "@sentry/browser";
2+
3+
init({
4+
dsn: "https://[email protected]/0000000",
5+
});
6+
7+
captureException(new Error("error here!"));
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "basic-capture-exception",
3+
"private": true,
4+
"version": "0.0.0"
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { init, captureMessage } from "@sentry/browser";
2+
3+
init({
4+
dsn: "https://[email protected]/0000000",
5+
});
6+
7+
captureMessage("this is a message");
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "basic-capture-message",
3+
"private": true,
4+
"version": "0.0.0"
5+
}
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: [new CustomIntegration()],
23+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "basic-custom-integration",
3+
"private": true,
4+
"version": "0.0.0"
5+
}
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+
});

0 commit comments

Comments
 (0)