Error: Not implemented: window.scrollTo. How do we remove this error from Jest test?

Try running the jest command with --env=jsdom. This will mock most browser functions and will solve your issues.

There are more ways of setting the test environment, take a look at:

https://jestjs.io/docs/en/configuration#testenvironment-string

Update

This worked for the window.scrollTo errors

https://qiita.com/akameco/items/0edfdae02507204b24c8

Leave a Comment