-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dogfood @remix-run/testing on internal tests #7186
Conversation
🦋 Changeset detectedLatest commit: cd0a518 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
94317de
to
a0c8b42
Compare
// Update the routes to include context in the loader/action and populate | ||
// the manifest and routeModules during the walk | ||
let patched = processRoutes( | ||
// @ts-expect-error loader/action context types don't match :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't they match?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remix forces a key/value context object in TS:
interface AppLoadContext {
[key: string]: unknown;
}
interface DataFunctionArgs {
request: Request;
context: AppLoadContext;
params: Params;
}
But React Router is more lenient since you can realistically pass anything through, it doesn't need to be key/value:
interface DataFunctionArgs {
request: Request;
params: Params;
context?: any;
}
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
Updated implementation of #5529 to dog food the
@remix-run/testing
package so we can stabilize it. This PR movesintegration/meta-test.tsx
topackages/remix-react/__tests__/integration/meta-test.tsx
and changes it from playwright tests tocreateRemixStub
testsThis makes some changes to
createRemixStub
to permitmeta
/links
implementations on routes. It also combines themanifest
/routeModules
generation into thepatchRoutesWithContext
function (renamedprocessRoutes
) so we just walk the route tree one time and generate everything.I think this is a good starting point to get merged as an example, and then we can keep converting other modules over as we find time.
Notes:
@remix-run/testing
should be mostly (entirely?) forpackages/remix-react
so I'm just putting tests inpackages/remix-react/__tests__/integration
for now. This allows our currentjest
setup to pick them up - simpler is better at this stage IMO.integration -> e2e
but once we're comfortable I think it's worth doing that and moving__tests__/integration -> __integration__
in a follow up PR.Replaces #5529
Closes #5528