Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setupTests.js entry missing after eject #643

Closed
fcaldera opened this issue Sep 13, 2016 · 5 comments
Closed

setupTests.js entry missing after eject #643

fcaldera opened this issue Sep 13, 2016 · 5 comments
Milestone

Comments

@fcaldera
Copy link

This is how the setupFiles section looks after ejecting:

    "setupFiles": [
      "<rootDir>/config/polyfills.js"
    ],

In previous version:

    "setupFiles": [
      "<rootDir>/config/polyfills.js",
      "<rootDir>/src/setupTests.js"
    ], 
@gaearon
Copy link
Contributor

gaearon commented Sep 14, 2016

Which previous version? Can you clarify which versions you refer to?

@fcaldera
Copy link
Author

I think in v0.4.0 it was working fine Dan.

@gaearon gaearon added this to the 0.4.2 milestone Sep 18, 2016
@gaearon
Copy link
Contributor

gaearon commented Sep 18, 2016

I checked, and it’s not a bug.

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.

@gaearon gaearon closed this as completed Sep 18, 2016
@christopherdbull
Copy link

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
Copy link
Contributor

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

@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants