Conversation
|
cc @aaronabramov Have you seen those issues in last two screenshots? It seems like multi project runner can't find mocks in some cases. |
|
@gaearon i have seen it in www actually. But they were only in 2 or 3 tests, so i just fixed them by using mock/unmock and didn't look into it. Are those the only two modules that can't be found in React or is there more? |
| @@ -0,0 +1,18 @@ | |||
| /* eslint-disable */ | |||
| global.__DEV__ = false; | |||
There was a problem hiding this comment.
do we need to set NODE_ENV to 'production' too for fbjs to work? (caution that in the past this made the transforms fail for me because the transforms read NODE_ENV and expect it to be 'test'. might need to set it to 'test' and back before/after the babel transform in the jest preprocessor.)
There was a problem hiding this comment.
caution that in the past this made the transforms fail for me because the transforms read NODE_ENV and expect it to be 'test'. might need to set it to 'test' and back before/after the babel transform in the jest preprocessor.
That's what I ran into. I suppose yes, we'll need that.
I used to have more of these when I tried at first. I was sharing all JS setup files between projects, and only had an additional |
|
Related to Jest error: we might need to add |
This is a rough proof of concept. It adds production mode runner project to our Jest setup.
Example running a test in Stack, Fiber DEV and Fiber PROD:
Not all unit tests are friendly to this. And it doesn't completely represent the PROD mode because I haven't applied PROD transforms. For example it doesn't strip
warningcalls leading to:On the other hand, applying all PROD transforms would also be a bit tricky because we often assert on error message name which would be stripped. Maybe we can have
toThrowReactErrormatcher that just expectsMinified exceptionin PROD.Some are explicitly DEV only tests:
We should probably gate them.
This is also surfacing what appears to be Jest multi project runner bugs. For example, it appears that some mocks get broken in multi project setup:
Overall I think this is a promising direction but we'll need Jest MPR to become more stable to continue.