-
-
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.
Add integration tests for Remix v2 features.
- Loading branch information
1 parent
09c5626
commit b166664
Showing
42 changed files
with
219 additions
and
39 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v1/routes/action-json-response/$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,2 @@ | ||
export * from '../../../common/routes/action-json-response.$id'; | ||
export { default } from '../../../common/routes/action-json-response.$id'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v1/routes/capture-exception.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,2 @@ | ||
export * from '../../common/routes/capture-exception'; | ||
export { default } from '../../common/routes/capture-exception'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v1/routes/capture-message.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,2 @@ | ||
export * from '../../common/routes/capture-message'; | ||
export { default } from '../../common/routes/capture-message'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v1/routes/error-boundary-capture/$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,2 @@ | ||
export * from '../../../common/routes/error-boundary-capture.$id'; | ||
export { default } from '../../../common/routes/error-boundary-capture.$id'; |
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 @@ | ||
export * from '../../common/routes/index'; | ||
export { default } from '../../common/routes/index'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v1/routes/loader-defer-response/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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from '../../../common/routes/loader-defer-response'; | ||
export { default } from '../../../common/routes/loader-defer-response'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v1/routes/loader-json-response/$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,2 @@ | ||
export * from '../../../common/routes/loader-json-response.$id'; | ||
export { default } from '../../../common/routes/loader-json-response.$id'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v1/routes/manual-tracing/$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,2 @@ | ||
export * from '../../../common/routes/manual-tracing.$id'; | ||
export { default } from '../../../common/routes/manual-tracing.$id'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v1/routes/scope-bleed/$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,2 @@ | ||
export * from '../../../common/routes/scope-bleed.$id'; | ||
export { default } from '../../../common/routes/scope-bleed.$id'; |
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,16 @@ | ||
import { RemixBrowser, useLocation, useMatches } from '@remix-run/react'; | ||
import { hydrate } from 'react-dom'; | ||
import * as Sentry from '@sentry/remix'; | ||
import { useEffect } from 'react'; | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/1337', | ||
tracesSampleRate: 1, | ||
integrations: [ | ||
new Sentry.BrowserTracing({ | ||
routingInstrumentation: Sentry.remixRouterInstrumentation(useEffect, useLocation, useMatches), | ||
}), | ||
], | ||
}); | ||
|
||
hydrate(<RemixBrowser />, document); |
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,27 @@ | ||
import type { EntryContext } from '@remix-run/node'; | ||
import { RemixServer } from '@remix-run/react'; | ||
import { renderToString } from 'react-dom/server'; | ||
import * as Sentry from '@sentry/remix'; | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/1337', | ||
tracesSampleRate: 1, | ||
// Disabling to test series of envelopes deterministically. | ||
autoSessionTracking: false, | ||
}); | ||
|
||
export default function handleRequest( | ||
request: Request, | ||
responseStatusCode: number, | ||
responseHeaders: Headers, | ||
remixContext: EntryContext, | ||
) { | ||
let markup = renderToString(<RemixServer context={remixContext} url={request.url} />); | ||
|
||
responseHeaders.set('Content-Type', 'text/html'); | ||
|
||
return new Response('<!DOCTYPE html>' + markup, { | ||
status: responseStatusCode, | ||
headers: responseHeaders, | ||
}); | ||
} |
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,60 @@ | ||
import { V2_MetaFunction, LoaderFunction, json, defer, redirect } from '@remix-run/node'; | ||
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react'; | ||
import { withSentry } from '@sentry/remix'; | ||
|
||
export const meta: V2_MetaFunction = ({ data }) => [ | ||
{ charset: 'utf-8' }, | ||
{ title: 'New Remix App' }, | ||
{ name: 'viewport', content: 'width=device-width,initial-scale=1' }, | ||
{ name: 'sentry-trace', content: data.sentryTrace }, | ||
{ name: 'baggage', content: data.sentryBaggage }, | ||
]; | ||
|
||
export const loader: LoaderFunction = async ({ request }) => { | ||
const url = new URL(request.url); | ||
const type = url.searchParams.get('type'); | ||
|
||
switch (type) { | ||
case 'empty': | ||
return {}; | ||
case 'plain': | ||
return { | ||
data_one: [], | ||
data_two: 'a string', | ||
}; | ||
case 'json': | ||
return json({ data_one: [], data_two: 'a string' }, { headers: { 'Cache-Control': 'max-age=300' } }); | ||
case 'defer': | ||
return defer({ data_one: [], data_two: 'a string' }); | ||
case 'null': | ||
return null; | ||
case 'undefined': | ||
return undefined; | ||
case 'throwRedirect': | ||
throw redirect('/?type=plain'); | ||
case 'returnRedirect': | ||
return redirect('/?type=plain'); | ||
default: { | ||
return {}; | ||
} | ||
} | ||
}; | ||
|
||
function App() { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<Meta /> | ||
<Links /> | ||
</head> | ||
<body> | ||
<Outlet /> | ||
<ScrollRestoration /> | ||
<Scripts /> | ||
<LiveReload /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
export default withSentry(App); |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v2/routes/action-json-response.$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,2 @@ | ||
export * from '../../common/routes/action-json-response.$id'; | ||
export { default } from '../../common/routes/action-json-response.$id'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v2/routes/capture-exception.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,2 @@ | ||
export * from '../../common/routes/capture-exception'; | ||
export { default } from '../../common/routes/capture-exception'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v2/routes/capture-message.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,2 @@ | ||
export * from '../../common/routes/capture-message'; | ||
export { default } from '../../common/routes/capture-message'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v2/routes/error-boundary-capture.$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,2 @@ | ||
export * from '../../common/routes/error-boundary-capture.$id'; | ||
export { default } from '../../common/routes/error-boundary-capture.$id'; |
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 @@ | ||
export * from '../../common/routes/index'; | ||
export { default } from '../../common/routes/index'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v2/routes/loader-defer-response.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,2 @@ | ||
export * from '../../common/routes/loader-defer-response'; | ||
export { default } from '../../common/routes/loader-defer-response'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v2/routes/loader-json-response.$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,2 @@ | ||
export * from '../../common/routes/loader-json-response.$id'; | ||
export { default } from '../../common/routes/loader-json-response.$id'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v2/routes/manual-tracing.$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,2 @@ | ||
export * from '../../common/routes/manual-tracing.$id'; | ||
export { default } from '../../common/routes/manual-tracing.$id'; |
2 changes: 2 additions & 0 deletions
2
packages/remix/test/integration/app_v2/routes/scope-bleed.$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,2 @@ | ||
export * from '../../common/routes/scope-bleed.$id'; | ||
export { default } from '../../common/routes/scope-bleed.$id'; |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,7 +1,16 @@ | ||
/** @type {import('@remix-run/dev').AppConfig} */ | ||
const useV2 = process.env.REMIX_VERSION === '2'; | ||
|
||
module.exports = { | ||
appDirectory: 'app', | ||
appDirectory: useV2 ? 'app_v2' : 'app_v1', | ||
assetsBuildDirectory: 'public/build', | ||
serverBuildPath: 'build/index.js', | ||
publicPath: '/build/', | ||
future: { | ||
v2_errorBoundary: useV2, | ||
v2_headers: useV2, | ||
v2_meta: useV2, | ||
v2_normalizeFormMethod: useV2, | ||
v2_routeConvention: useV2, | ||
}, | ||
}; |
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
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
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
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.