Skip to content

[legacy-framework] (newapp) Fix tests not working out of box#1323

Merged
flybayer merged 1 commit intoblitz-js:canaryfrom
peter50216:patch-2
Oct 14, 2020
Merged

[legacy-framework] (newapp) Fix tests not working out of box#1323
flybayer merged 1 commit intoblitz-js:canaryfrom
peter50216:patch-2

Conversation

@peter50216
Copy link
Copy Markdown

What are the changes and their implications?

Currently blitz new test; cd test; blitz db migrate; blitz test would fail with

TypeError: Cannot read property 'createContext' of undefined

This is caused by react-query has require("react") inside a folder named react, and adding "." to moduleDirectories seems to make jest add current directory to module path for ALL dependencies.

Fix this by using "<rootDir>" instead of ".".

Copy link
Copy Markdown
Member

@flybayer flybayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks @peter50216!!

@flybayer
Copy link
Copy Markdown
Member

flybayer commented Oct 14, 2020

@all-contributors add @peter50216 for code

@allcontributors
Copy link
Copy Markdown

@flybayer

I've put up a pull request to add @peter50216! 🎉

@iamtekeste
Copy link
Copy Markdown

I am not sure how you figured this out but this was very helpful and thank you for sharing your solution @peter50216 <3

@itsdillon itsdillon changed the title (newapp) Fix tests not working out of box [legacy-framework] (newapp) Fix tests not working out of box Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants