question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jest ignoring tests inside src/node_modules

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
gaearoncommented, Jan 8, 2018

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 of src/node_modules.

1reaction
gaearoncommented, Nov 20, 2016

Let’s do this (support for src/node_modules). A PR would be welcome.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found