The README.md says:
The .test.js / .spec.js files (or the __tests__ folders) can be located at any depth under the src top level folder.
However, if I create a .spec.js
in a e2e
folder at the root of the project, it is still executed by npm test
I guess that's a bug. Right now I can workaround by overriding the testPathPattern
parameter in my package.json
: react-scripts test --env=jsdom --testPathPattern ./src\/.*
Interesting, thanks for writing up. I probably forgot to limit this. Now that I think of it I think maybe we should allow them to be in top level src
, test
, tests
and __tests__
.
Yup, as long as we can have e2e and integration tests living in the same repository, that seems fair
Is this issue still open? Can I jump on it?
This is a very annoying issue for us, since the workaround is adding --testPathPattern ./src\/.*
to the test command but that makes jest runs all the tests at every change, and we can't filter by pattern.
If anyone has a better workaround that would be great !
Is this issue still open? Can I jump on it?
Yes, please!
Hmm. Not running tests in other folders will probably be a breaking change for some people since they might rely on some of these tests. So I'm retagging as 0.10.
Happy to take a PR fixing it.
This bit me again today. :cry: Specifically using Cloud9 editor with files in the /.c9
directory.
My work around was to move everything down into a new directory web
, so that the tree became:
.
โโโ .c9
โย ย โโโ ...
โโโ .git
โย ย โโโ ...
โโโ web
โโโ .gitignore
โโโ README.md
โโโ node_modules
โโโ package.json
โโโ public
โโโ src
@motevets would you like to take a stab at fixing this and submit a pull request? ๐
Fixed via #1808.
Please help beta test the new version that includes this change!
https://github.com/facebookincubator/create-react-app/issues/2172
I'd like to place all test files outside of src
. Do I need to eject?
Any updates?
Most helpful comment
I'd like to place all test files outside of
src
. Do I need to eject?