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

jest --watch watches files outside of testPathDirs #564

Closed
elliottsj opened this issue Oct 22, 2015 · 5 comments
Closed

jest --watch watches files outside of testPathDirs #564

elliottsj opened this issue Oct 22, 2015 · 5 comments

Comments

@elliottsj
Copy link

I've configured jest like this:

"jest": {
  "scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
  "testPathDirs": [
    "<rootDir>/app"
  ],
  "unmockedModulePathPatterns": [
    "<rootDir>/node_modules/react"
  ]
}

But jest re-runs tests even when I save files outside of "<rootDir>/app", e.g. saving "<rootDir>/gulpfile.js" triggers a test re-run.

@cpojer
Copy link
Member

cpojer commented Oct 22, 2015

cc @huang47 can you take a look?

@huang47
Copy link

huang47 commented Oct 23, 2015

yes sire!

@huang47
Copy link

huang47 commented Nov 2, 2015

sorry didn't get back to this for a while, I was trying to make a fix but seems like we should move the watch implementation to src/jest.js instead of bin/jest.js which doesn't own any knowledge of test dirs/paths. will try to squeeze some time to commit a patch later this week to address this problem

@alendit
Copy link

alendit commented Jan 19, 2016

This bug leads to jest being started multiple times, when used with a preprocessor like babel-jest since jest notices changes in the cache directory. I use the following workaround (in package.json):

  "jest": {
    "scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
    "cacheDirectory": "/tmp/jest_cache",
   ...
   }

@cpojer cpojer closed this as completed Jan 20, 2016
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
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