remix-run / react-router

Declarative routing for React
https://reactrouter.com
MIT License
53.05k stars 10.3k forks source link

[Bug]: react-router-dom-v5-compat not importing react-router-dom v5 in tests (DX) #8770

Open Streeterxs opened 2 years ago

Streeterxs commented 2 years ago

What version of React Router are you using?

v5-compat

Steps to Reproduce

Import a Switch from "react-router-dom":

import { Switch } from "react-router-dom";

...
    console.log({Switch});
    act(() => {
      ReactDOM.render(
        <MemoryRouter initialEntries={["/home"]}>
          <CompatRouter>
            <Switch>
              <CompatRoute path="home" element={<Home />} />
              <CompatRoute path="/details" element={<Details />} />
            </Switch>
          </CompatRouter>
        </MemoryRouter>,
        node
      );

image

Expected Behavior

After yarn install and yarn build (as CONTRIBUTING.md says) should install react-router-dom from packages/react-router-dom-v5-compat/package.json peerDependencies to permit usage and testability of CompatRoute and CompatRouter

Actual Behavior

Breaking my CompatRoute fail test on Switch usage (and CompatRouter useHistory() as well).

rtlong commented 2 years ago

@Streeterxs Did you find a workaround for this?

github-actions[bot] commented 1 year ago

This issue has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this issue will be automatically closed.