You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If src/setupTests.js exists when ejecting, it will be included in setupFiles.
Otherwise it will not.
(If you can reproduce it not being included when it exists please give exact instructions to reproduce, i.e. maybe you use symlinks or your setup is unusual in some other way? If you could put some logs in createJestConfig.js around where it does the file exists check, that would help.)
We can’t include it unconditionally because Jest will (rightly) throw an error about missing file.
We could potentially generate it on eject but I don’t think it’s very important.
I made a small tweak: now is uses a relative path instead of an absolute one after ejecting (d279aa0). But I believe current behavior is correct.
Could I suggest this being added to the documentation somewhere? Happy to do it if you tell me where. I've just spent the last couple of days bashing my head against the desk wonder why setupTests wasn't running in my ejected app...
Hi @gaearon , I was struggling as @TE-Chris was for this issue.
I think that including unconditionally isn't the right decision, but writing it in the doc would be really helpful, I made a PR here: #3656
I wasted almost one day :( , then I found this thread
Activity
gaearon commentedon Sep 14, 2016
Which previous version? Can you clarify which versions you refer to?
fcaldera commentedon Sep 18, 2016
I think in v0.4.0 it was working fine Dan.
gaearon commentedon Sep 18, 2016
I checked, and it’s not a bug.
If
src/setupTests.js
exists when ejecting, it will be included insetupFiles
.Otherwise it will not.
(If you can reproduce it not being included when it exists please give exact instructions to reproduce, i.e. maybe you use symlinks or your setup is unusual in some other way? If you could put some logs in
createJestConfig.js
around where it does the file exists check, that would help.)We can’t include it unconditionally because Jest will (rightly) throw an error about missing file.
We could potentially generate it on eject but I don’t think it’s very important.
I made a small tweak: now is uses a relative path instead of an absolute one after ejecting (d279aa0). But I believe current behavior is correct.
christopherdbull commentedon Oct 15, 2017
Could I suggest this being added to the documentation somewhere? Happy to do it if you tell me where. I've just spent the last couple of days bashing my head against the desk wonder why setupTests wasn't running in my ejected app...
dannycalleri commentedon Dec 28, 2017
Hi @gaearon , I was struggling as @TE-Chris was for this issue.
I think that including unconditionally isn't the right decision, but writing it in the doc would be really helpful, I made a PR here: #3656
I wasted almost one day :( , then I found this thread