Jest failing since defaultViewTransition in v1.117! Help! #4509
Unanswered
sirPixieJerry
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We updated from
@tanstack/react-router
v1.114
to1.121
recently and suddenly all jest tests fail with the following error:As you can see we use
node >=18
and the Response class should be available natively.Anyway, I discovered that the tests fail with the changes introduced to
v1.117
and the introduction ofdefaultViewTransition
.We use a custom render function that extends the render function of
@testing-library/react
with aTestProvider
for@tanstack/react-router
.Even when I set
defaultViewTransition
tofalse
the same error occurs. A log in the tests confirm that jest usesnode v20.18.0
. The test environment in thejest.config
is set totestEnvironment: 'jest-environment-jsdom'
.When I install
@tanstack/react-router v1.120
the error disappears but I need to wrap all my tests into awaitFor
to turn green. I discovered that when I put logs before and after thewaitFor
the dom is first empty and then fills up with the component to be rendered, althoughdefaultViewTransition
is set tofalse
.I actually spend two full working days on this now and have no clue what is going on. We found a workaround for now and just create a Provider from the
routerContext
directly:But this shouldn't be a solution. Does anyone have a clue or ran into the same problem?
EDIT:
To install and import the
whatwg-fetch
package to thejest.setup
solved theResponse
issue, but still we need a waitFor in each test because the dom doesn't hydrate with the tested component immediately.Beta Was this translation helpful? Give feedback.
All reactions