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-routerv1.114to1.121recently and suddenly all jest tests fail with the following error:As you can see we use
node >=18and the Response class should be available natively.Anyway, I discovered that the tests fail with the changes introduced to
v1.117and the introduction ofdefaultViewTransition.We use a custom render function that extends the render function of
@testing-library/reactwith aTestProviderfor@tanstack/react-router.Even when I set
defaultViewTransitiontofalsethe same error occurs. A log in the tests confirm that jest usesnode v20.18.0. The test environment in thejest.configis set totestEnvironment: 'jest-environment-jsdom'.When I install
@tanstack/react-router v1.120the error disappears but I need to wrap all my tests into awaitForto turn green. I discovered that when I put logs before and after thewaitForthe dom is first empty and then fills up with the component to be rendered, althoughdefaultViewTransitionis 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
routerContextdirectly: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-fetchpackage to thejest.setupsolved theResponseissue, 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