This repository has been archived by the owner on May 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Support files other than tests inside of __tests__ folders #355
Comments
Shouldn't only root files inside a given
Having a specific subdirectory for non-tests seems odd, shouldn't it be every subdirectory? |
This is one convention that we can look at as well. Because we encourage co-locating tests with code, folks shouldn't need nested directory structures for tests. |
How do you feel about using the underscore notation for helper files? It would just exclude any files that begin with an underscore. e.g.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Type of issue
Feature request
Description
Many developers have a need for fixtures and helper libraries for running test logic. With the current naming scheme that we have for universal tests, developers can't easily have additional utilities inside of the
__tests__
folder.Current behavior
Any files ending in
.js
inside of a__tests__
folder will attempt to execute as a jest test. When run, jest will fail with an error like:Expected behavior
You should be able to run tests and ignore utilities, helpers and fixtures.
Possible fixes
Whitelist a
support
folderAny files within this folder would not be considered tests. If there are tests in a folder named
__tests__/support
this would be a breaking change, but we might consider this one to be non-breaking as that seems pretty unlikely.Reconsider universal test naming scheme
Rename universal tests to something like
myTest.global.js
ormyTest.universal.js
. We would then supportmyTest.(universal|node|browser).js
. Breaking change.The text was updated successfully, but these errors were encountered: