Skip to content
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

Merged
merged 5 commits into from
Aug 22, 2023

Conversation

brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Aug 16, 2023

Updated implementation of #5529 to dog food the @remix-run/testing package so we can stabilize it. This PR moves integration/meta-test.tsx to packages/remix-react/__tests__/integration/meta-test.tsx and changes it from playwright tests to createRemixStub tests

yarn test:primary packages/remix-react/__tests__/integration/meta-test.tsx

This makes some changes to createRemixStub to permit meta/links implementations on routes. It also combines the manifest/routeModules generation into the patchRoutesWithContext function (renamed processRoutes) 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:

  • Internal testing via @remix-run/testing should be mostly (entirely?) for packages/remix-react so I'm just putting tests in packages/remix-react/__tests__/integration for now. This allows our current jest setup to pick them up - simpler is better at this stage IMO.
  • No renaming yet of 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

@changeset-bot
Copy link

changeset-bot bot commented Aug 16, 2023

🦋 Changeset detected

Latest commit: cd0a518

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@remix-run/testing Minor
create-remix Minor
remix Minor
@remix-run/architect Minor
@remix-run/cloudflare Minor
@remix-run/cloudflare-pages Minor
@remix-run/cloudflare-workers Minor
@remix-run/css-bundle Minor
@remix-run/deno Minor
@remix-run/dev Minor
@remix-run/eslint-config Minor
@remix-run/express Minor
@remix-run/node Minor
@remix-run/react Minor
@remix-run/serve Minor
@remix-run/server-runtime Minor

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

@brophdawg11 brophdawg11 force-pushed the brophdawg11/dogfood-remix-testing branch from 94317de to a0c8b42 Compare August 16, 2023 22:15
// 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 :/
Copy link
Member

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?

Copy link
Contributor Author

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;
}

@brophdawg11 brophdawg11 merged commit eef484d into dev Aug 22, 2023
9 checks passed
@brophdawg11 brophdawg11 deleted the brophdawg11/dogfood-remix-testing branch August 22, 2023 19:43
@github-actions github-actions bot added the awaiting release This issue has been fixed and will be released soon label Aug 22, 2023
@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-49e8da1-20230823 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version 2.0.0-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting release This issue has been fixed and will be released soon CLA Signed package:testing renderer:react
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants