Closed Nauxscript closed 1 year ago
This issue is a missing DOM API in the test environment. The router needs window.scrollTo but the testing setup isn't patching it. I am not sure how to do this with Vitest, but I found an old stack overflow: https://stackoverflow.com/questions/57311971/error-not-implemented-window-scrollto-how-do-we-remove-this-error-from-jest-t This is a similar category of issue. But I am not sure what the steps are for Vitest.
This is an issue with the testing setup and not the router. @atk if you have any insights can you provide them. Otherwise I'm closing this.
The error is thrown by jsdom. I might be able to circumvent it in our testing library, though, but I'm hesitant to include side effects by default. Maybe an extra import would work.
Describe the bug
I am attempting to test my navbar component, which is essentially implemented the same as the provided example. The test case is working well, but I have noticed an error in the logs:
and I found a same issue in #111
Your Example Website or App
https://codesandbox.io/p/sandbox/heuristic-pascal-ym4s44
Steps to Reproduce the Bug or Issue
pnpm run test
Expected behavior
expected no error in the logs
Screenshots or Videos
No response
Platform
Additional context
No response