jestjs / jest

Delightful JavaScript Testing.
https://jestjs.io
MIT License
44.21k stars 6.46k forks source link

Default to node_modules/.cache for cacheDirectory #2231

Closed hzoo closed 7 years ago

hzoo commented 7 years ago

Noticed when debugging https://github.com/facebookincubator/create-react-app/pull/1179?

my suggestion is using https://github.com/avajs/find-cache-dir

const findCacheDir = require('find-cache-dir');

findCacheDir({name: 'unicorns'});
//=> '/user/path/node-modules/.cache/unicorns'

We added it to babel-loader via https://github.com/babel/babel-loader/pull/301 although later a fallback to os https://github.com/babel/babel-loader/pull/318

thymikee commented 7 years ago

@hzoo I wonder if this is related – #2141? Looks like it would solve the issue with permissions.

thymikee commented 7 years ago

Hmm, I'd prefer not to make this change. We used to store the cache inside of node_modules/jest/.haste_cache and we had a ton of problems, like watchman would crawl this and then get out of sync and a ton of other tools at FB on all codebases would go mad with this. It should be easy to set "cacheDirectory": "/node_modules/.cache/jest" or something ~ @cpojer

github-actions[bot] commented 3 years ago

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.