Skip to content

Commit 859a05f

Browse files
committed
test(e2e): Update react-router-6 test to avoid sending to Sentry
1 parent b1708d0 commit 859a05f

File tree

18 files changed

+138
-240
lines changed

18 files changed

+138
-240
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ jobs:
10121012
'react-create-hash-router',
10131013
'react-router-6-use-routes',
10141014
'react-router-5',
1015-
'standard-frontend-react',
1015+
'react-router-6',
10161016
'svelte-5',
10171017
'sveltekit',
10181018
'sveltekit-2',
@@ -1039,9 +1039,9 @@ jobs:
10391039
- test-application: 'create-react-app'
10401040
build-command: 'test:build-ts3.8'
10411041
label: 'create-react-app (TS 3.8)'
1042-
- test-application: 'standard-frontend-react'
1042+
- test-application: 'react-router-6'
10431043
build-command: 'test:build-ts3.8'
1044-
label: 'standard-frontend-react (TS 3.8)'
1044+
label: 'react-router-6 (TS 3.8)'
10451045
- test-application: 'create-next-app'
10461046
build-command: 'test:build-13'
10471047
label: 'create-next-app (next@13)'

.github/workflows/canary.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ jobs:
9292
- test-application: 'react-create-hash-router'
9393
build-command: 'test:build-canary'
9494
label: 'react-create-hash-router (canary)'
95-
- test-application: 'standard-frontend-react'
95+
- test-application: 'react-router-6'
9696
build-command: 'test:build-canary'
97-
label: 'standard-frontend-react (canary)'
97+
label: 'react-router-6 (canary)'
9898

9999
steps:
100100
- name: Check out current commit

dev-packages/e2e-tests/test-applications/standard-frontend-react/package.json renamed to dev-packages/e2e-tests/test-applications/react-router-6/package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
{
2-
"name": "standard-frontend-react-test",
2+
"name": "react-router-6-test",
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
66
"@sentry/react": "latest || *",
7-
"@testing-library/jest-dom": "5.14.1",
8-
"@testing-library/react": "13.0.0",
9-
"@testing-library/user-event": "13.2.1",
10-
"@types/jest": "27.0.1",
11-
"@types/node": "16.7.13",
127
"@types/react": "18.0.0",
138
"@types/react-dom": "18.0.0",
149
"react": "18.2.0",
1510
"react-dom": "18.2.0",
1611
"react-router-dom": "^6.4.1",
1712
"react-scripts": "5.0.1",
18-
"typescript": "4.9.5",
19-
"web-vitals": "2.1.0"
13+
"typescript": "4.9.5"
2014
},
2115
"scripts": {
2216
"build": "react-scripts build",
@@ -48,6 +42,7 @@
4842
},
4943
"devDependencies": {
5044
"@playwright/test": "^1.44.1",
45+
"@sentry-internal/test-utils": "link:../../../test-utils",
5146
"serve": "14.0.1"
5247
},
5348
"volta": {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { getPlaywrightConfig } from '@sentry-internal/test-utils';
2+
3+
const config = getPlaywrightConfig({
4+
startCommand: `pnpm start`,
5+
});
6+
7+
export default config;

dev-packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx renamed to dev-packages/e2e-tests/test-applications/react-router-6/src/index.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,8 @@ Sentry.init({
3636
// Always capture replays, so we can test this properly
3737
replaysSessionSampleRate: 1.0,
3838
replaysOnErrorSampleRate: 0.0,
39-
});
40-
41-
Sentry.addEventProcessor(event => {
42-
if (
43-
event.type === 'transaction' &&
44-
(event.contexts?.trace?.op === 'pageload' || event.contexts?.trace?.op === 'navigation')
45-
) {
46-
const eventId = event.event_id;
47-
if (eventId) {
48-
window.recordedTransactions = window.recordedTransactions || [];
49-
window.recordedTransactions.push(eventId);
50-
}
51-
}
5239

53-
return event;
40+
tunnel: 'http://localhost:3031',
5441
});
5542

5643
const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes);
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as Sentry from '@sentry/react';
21
// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX
32
import * as React from 'react';
43
import { Link } from 'react-router-dom';
@@ -11,8 +10,7 @@ const Index = () => {
1110
value="Capture Exception"
1211
id="exception-button"
1312
onClick={() => {
14-
const eventId = Sentry.captureException(new Error('I am an error!'));
15-
window.capturedExceptionId = eventId;
13+
throw new Error('I am an error!');
1614
}}
1715
/>
1816
<Link to="/user/5" id="navigation">

0 commit comments

Comments
 (0)