You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a project with vite and react-router-dom. Add testing dependencies vitest jsdom @testing-library/jest-dom @testing-library/react
Configure vitest in vite.config.ts :
test: {globals: true,environment: "jsdom",},
Add test file using createMemoryRouter with a route that uses a loader, i.e.
What version of React Router are you using?
6.8.2
Steps to Reproduce
Test Case : https://stackblitz.com/edit/github-mvvyq5?file=src/app.test.tsx
Create a project with vite and react-router-dom. Add testing dependencies
vitest jsdom @testing-library/jest-dom @testing-library/react
Configure vitest in
vite.config.ts
:Add test file using
createMemoryRouter
with a route that uses aloader
, i.e.Run test.
Expected Behavior
Test should work properly.
Actual Behavior
Error output from the test :
Behavior is the same when using
createBrowserRouter
.Removing
loader
attribute for the route removes the issue. Also switching to another test environment, such ashappy-dom
, fixes the issue.The text was updated successfully, but these errors were encountered: