Skip to content

Commit

Permalink
jest-config: use UID for default cache folder (jestjs#3380)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlauliac authored and cpojer committed Apr 27, 2017
1 parent 75e25a0 commit f960634
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/jest-config/src/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ module.exports = ({
automock: false,
bail: false,
browser: false,
cacheDirectory: path.join(os.tmpdir(), 'jest'),
cacheDirectory: (() => {
if (process.getuid == null) {
return path.join(os.tmpdir(), 'jest');
}
// On some platforms tmpdir() is `/tmp`, causing conflicts between different users and
// permission issues. Adding an additional subdivision by UID can help.
return path.join(os.tmpdir(), 'jest', process.getuid().toString(36));
})(),
clearMocks: false,
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
coverageReporters: ['json', 'text', 'lcov', 'clover'],
Expand Down

0 comments on commit f960634

Please sign in to comment.