Skip to content

Commit d705051

Browse files
author
Luca Forstner
committed
Add Sentry
1 parent 5a44229 commit d705051

File tree

7 files changed

+55
-96
lines changed

7 files changed

+55
-96
lines changed

packages/e2e-tests/test-applications/create-react-app/README.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

packages/e2e-tests/test-applications/create-react-app/package.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
{
2-
"name": "my-app",
2+
"name": "create-react-app-test",
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@testing-library/jest-dom": "^5.14.1",
7-
"@testing-library/react": "^13.0.0",
8-
"@testing-library/user-event": "^13.2.1",
9-
"@types/jest": "^27.0.1",
10-
"@types/node": "^16.7.13",
11-
"@types/react": "^18.0.0",
12-
"@types/react-dom": "^18.0.0",
13-
"react": "^18.2.0",
14-
"react-dom": "^18.2.0",
6+
"@sentry/react": "*",
7+
"@sentry/tracing": "*",
8+
"@testing-library/jest-dom": "5.14.1",
9+
"@testing-library/react": "13.0.0",
10+
"@testing-library/user-event": "13.2.1",
11+
"@types/jest": "27.0.1",
12+
"@types/node": "16.7.13",
13+
"@types/react": "18.0.0",
14+
"@types/react-dom": "18.0.0",
15+
"react": "18.2.0",
16+
"react-dom": "18.2.0",
1517
"react-scripts": "5.0.1",
16-
"typescript": "^4.4.2",
17-
"web-vitals": "^2.1.0"
18+
"typescript": "4.4.2",
19+
"web-vitals": "2.1.0"
1820
},
1921
"scripts": {
2022
"start": "react-scripts start",

packages/e2e-tests/test-applications/create-react-app/public/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="theme-color" content="#000000" />
8-
<meta
9-
name="description"
10-
content="Web site created using create-react-app"
11-
/>
8+
<meta name="description" content="Web site created using create-react-app" />
129
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
1310
<!--
1411
manifest.json provides metadata used when your web app is installed on a
Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
import React from 'react';
22
import logo from './logo.svg';
3+
import * as Sentry from '@sentry/react';
34
import './App.css';
45

56
function App() {
67
return (
7-
<div className="App">
8-
<header className="App-header">
9-
<img src={logo} className="App-logo" alt="logo" />
10-
<p>
11-
Edit <code>src/App.tsx</code> and save to reload.
12-
</p>
13-
<a
14-
className="App-link"
15-
href="https://reactjs.org"
16-
target="_blank"
17-
rel="noopener noreferrer"
8+
<Sentry.ErrorBoundary fallback={<p>An error has occurred</p>}>
9+
<div className="App">
10+
<header className="App-header">
11+
<img src={logo} className="App-logo" alt="logo" />
12+
<p>
13+
Edit <code>src/App.tsx</code> and save to reload.
14+
</p>
15+
<a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer">
16+
Learn React
17+
</a>
18+
</header>
19+
<button
20+
onClick={() => {
21+
Sentry.captureException(new Error('I am a captured error!'));
22+
}}
1823
>
19-
Learn React
20-
</a>
21-
</header>
22-
</div>
24+
I am capturing an error
25+
</button>
26+
</div>
27+
</Sentry.ErrorBoundary>
2328
);
2429
}
2530

26-
export default App;
31+
export default Sentry.withProfiler(App);
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
body {
22
margin: 0;
3-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5-
sans-serif;
3+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
4+
'Droid Sans', 'Helvetica Neue', sans-serif;
65
-webkit-font-smoothing: antialiased;
76
-moz-osx-font-smoothing: grayscale;
87
}
98

109
code {
11-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12-
monospace;
10+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
1311
}

packages/e2e-tests/test-applications/create-react-app/src/index.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,23 @@ import ReactDOM from 'react-dom/client';
33
import './index.css';
44
import App from './App';
55
import reportWebVitals from './reportWebVitals';
6+
import * as Sentry from '@sentry/react';
7+
import { BrowserTracing } from '@sentry/tracing';
68

7-
const root = ReactDOM.createRoot(
8-
document.getElementById('root') as HTMLElement
9-
);
9+
Sentry.init({
10+
dsn: 'https://[email protected]/6601807',
11+
integrations: [new BrowserTracing()],
12+
13+
// We recommend adjusting this value in production, or using tracesSampler
14+
// for finer control
15+
tracesSampleRate: 1.0,
16+
});
17+
18+
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
1019
root.render(
1120
<React.StrictMode>
1221
<App />
13-
</React.StrictMode>
22+
</React.StrictMode>,
1423
);
1524

1625
// If you want to start measuring performance in your app, pass a function
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
{
22
"compilerOptions": {
33
"target": "es5",
4-
"lib": [
5-
"dom",
6-
"dom.iterable",
7-
"esnext"
8-
],
4+
"lib": ["dom", "dom.iterable", "esnext"],
95
"allowJs": true,
106
"skipLibCheck": true,
117
"esModuleInterop": true,
@@ -18,9 +14,7 @@
1814
"resolveJsonModule": true,
1915
"isolatedModules": true,
2016
"noEmit": true,
21-
"jsx": "react-jsx"
17+
"jsx": "react"
2218
},
23-
"include": [
24-
"src"
25-
]
19+
"include": ["src"]
2620
}

0 commit comments

Comments
 (0)