-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a495c7f
commit ee6cb16
Showing
12 changed files
with
391 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
dev-packages/e2e-tests/test-applications/create-remix-app-fastify-vite/.npmrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@sentry:registry=http://127.0.0.1:4873 | ||
@sentry-internal:registry=http://127.0.0.1:4873 |
71 changes: 62 additions & 9 deletions
71
dev-packages/e2e-tests/test-applications/create-remix-app-fastify-vite/app/root.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,80 @@ | ||
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react'; | ||
|
||
import { cssBundleHref } from '@remix-run/css-bundle'; | ||
import { LinksFunction, MetaFunction, json } from '@remix-run/node'; | ||
import { | ||
Links, | ||
LiveReload, | ||
Meta, | ||
Outlet, | ||
Scripts, | ||
ScrollRestoration, | ||
useLoaderData, | ||
useRouteError, | ||
} from '@remix-run/react'; | ||
import { captureRemixErrorBoundaryError, withSentry } from '@sentry/remix'; | ||
import type { SentryMetaArgs } from '@sentry/remix'; | ||
|
||
export const links: LinksFunction = () => [...(cssBundleHref ? [{ rel: 'stylesheet', href: cssBundleHref }] : [])]; | ||
|
||
export const loader = () => { | ||
return json({ | ||
ENV: { | ||
SENTRY_DSN: process.env.E2E_TEST_DSN, | ||
}, | ||
}); | ||
}; | ||
|
||
export const meta = ({ data }: SentryMetaArgs<MetaFunction<typeof loader>>) => { | ||
return [ | ||
{ | ||
env: data.ENV, | ||
}, | ||
{ | ||
name: 'sentry-trace', | ||
content: data.sentryTrace, | ||
}, | ||
{ | ||
name: 'baggage', | ||
content: data.sentryBaggage, | ||
}, | ||
]; | ||
}; | ||
|
||
export function ErrorBoundary() { | ||
const error = useRouteError(); | ||
const eventId = captureRemixErrorBoundaryError(error); | ||
|
||
return ( | ||
<div> | ||
<span>ErrorBoundary Error</span> | ||
<span id="event-id">{eventId}</span> | ||
</div> | ||
); | ||
} | ||
|
||
function App() { | ||
const { ENV } = useLoaderData(); | ||
|
||
export function Layout({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1" /> | ||
<script | ||
dangerouslySetInnerHTML={{ | ||
__html: `window.ENV = ${JSON.stringify(ENV)}`, | ||
}} | ||
/> | ||
<Meta /> | ||
<Links /> | ||
</head> | ||
<body> | ||
{children} | ||
<Outlet /> | ||
<ScrollRestoration /> | ||
<Scripts /> | ||
<LiveReload /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
function App() { | ||
return <Outlet />; | ||
} | ||
|
||
export default withSentry(App); |
58 changes: 20 additions & 38 deletions
58
dev-packages/e2e-tests/test-applications/create-remix-app-fastify-vite/app/routes/_index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,27 @@ | ||
import type { MetaFunction } from '@remix-run/node'; | ||
import { Link, useSearchParams } from '@remix-run/react'; | ||
import * as Sentry from '@sentry/remix'; | ||
|
||
export const meta: MetaFunction = () => { | ||
return [{ title: 'New Remix App' }, { name: 'description', content: 'Welcome to Remix!' }]; | ||
}; | ||
|
||
export default function Index() { | ||
const [searchParams] = useSearchParams(); | ||
|
||
if (searchParams.get('tag')) { | ||
Sentry.setTag('sentry_test', searchParams.get('tag')); | ||
} | ||
|
||
return ( | ||
<div style={{ fontFamily: 'system-ui, sans-serif', lineHeight: '1.8' }}> | ||
<h1>Welcome to Remix</h1> | ||
<ul> | ||
<li> | ||
<a target="_blank" href="https://remix.run/tutorials/blog" rel="noreferrer"> | ||
15m Quickstart Blog Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a target="_blank" href="https://remix.run/tutorials/jokes" rel="noreferrer"> | ||
Deep Dive Jokes App Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a target="_blank" href="https://remix.run/docs" rel="noreferrer"> | ||
Remix Docs | ||
</a> | ||
</li> | ||
<li> | ||
<div> | ||
<span>Remix + Sentry on the client</span> | ||
<input | ||
type="button" | ||
value="Capture Exception" | ||
id="exception-button" | ||
onClick={() => { | ||
const eventId = Sentry.captureException(new Error('I am an error!')); | ||
window.capturedExceptionId = eventId; | ||
}} | ||
/> | ||
</div> | ||
</li> | ||
</ul> | ||
<div> | ||
<input | ||
type="button" | ||
value="Capture Exception" | ||
id="exception-button" | ||
onClick={() => { | ||
const eventId = Sentry.captureException(new Error('I am an error!')); | ||
window.capturedExceptionId = eventId; | ||
}} | ||
/> | ||
<Link to="/user/5" id="navigation"> | ||
navigate | ||
</Link> | ||
</div> | ||
); | ||
} |
13 changes: 13 additions & 0 deletions
13
...ges/e2e-tests/test-applications/create-remix-app-fastify-vite/app/routes/client-error.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { useState } from 'react'; | ||
|
||
export default function ErrorBoundaryCapture() { | ||
const [count, setCount] = useState(0); | ||
|
||
if (count > 0) { | ||
throw new Error('Sentry React Component Error'); | ||
} else { | ||
setTimeout(() => setCount(count + 1), 0); | ||
} | ||
|
||
return <div>{count}</div>; | ||
} |
20 changes: 20 additions & 0 deletions
20
...ackages/e2e-tests/test-applications/create-remix-app-fastify-vite/app/routes/navigate.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { LoaderFunction } from '@remix-run/node'; | ||
import { useLoaderData } from '@remix-run/react'; | ||
|
||
export const loader: LoaderFunction = async ({ params: { id } }) => { | ||
if (id === '-1') { | ||
throw new Error('Unexpected Server Error'); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
export default function LoaderError() { | ||
const data = useLoaderData(); | ||
|
||
return ( | ||
<div> | ||
<h1>{data && data.test ? data.test : 'Not Found'}</h1> | ||
</div> | ||
); | ||
} |
3 changes: 3 additions & 0 deletions
3
...ackages/e2e-tests/test-applications/create-remix-app-fastify-vite/app/routes/user.$id.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function User() { | ||
return <div>I am a blank page</div>; | ||
} |
7 changes: 7 additions & 0 deletions
7
dev-packages/e2e-tests/test-applications/create-remix-app-fastify-vite/globals.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
interface Window { | ||
recordedTransactions?: string[]; | ||
capturedExceptionId?: string; | ||
ENV: { | ||
SENTRY_DSN: string; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.