Jest ignoring tests inside src/node_modules
See original GitHub issueI created a src/node_modules
directory so I can have shared
code I re-use throughout my project.
So rather than doing
import MyComponent from '../../../../shared/MyComponent';
I could write
import MyComponent from 'shared/MyComponent';
This works great, except when I add a test MyComponent.test.js
. It isn’t “seen” by Jest.
Not sure if this is a supported use case, it might just be a nice-to-have.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Jest not running tests in src/node_modules #2145 - GitHub
Sadly jest refuses to locate any of the tests since node_modules would always exist in the directory path of its parent directory. 3...
Read more >Configuring Jest
This option tells Jest that all imported modules in your tests should be mocked automatically. All modules used in your tests will have...
Read more >How to run, ignore or skip Jest tests, suites and files
Ignore a single Jest test in a file using .skip ... See the output, in which we ran 1 test (that didn't have...
Read more >Jest not finding all tests - Stack Overflow
I have tried creating a generic test file and moving it around. I found it would work in the following circumstances. I have...
Read more >Configuring Jest compiled - w3resource
It is the root directory that Jest has to scan for tests and modules within. If you have your Jest config inside your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing in favor of https://github.com/facebookincubator/create-react-app/issues/1333.
We’ll likely support Yarn Workspaces and/or Lerna with a top-level
packages
directory instead ofsrc/node_modules
.Let’s do this (support for
src/node_modules
). A PR would be welcome.