Registry / testing / jest-cache-directory

jest-cache-directory

JSON →
library1.0.6jsnpmunverified

Utility to resolve the Jest cache directory from the JEST_CACHE_DIRECTORY environment variable or fallback to `${os.tmpdir()}/jest`. Version 1.0.6 is stable with no recent updates. Provides a simple API for cache directory resolution, ships TypeScript definitions. Designed for Node.js environments.

npm install jest-cache-directory
INSTALL
IMPORT
SIG · JEST-CACHE-DIRECTO
J
jest-cache-directory
testingjavascriptv1.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

jestCacheDirectory
import { jestCacheDirectory } from 'jest-cache-directory'
const jestCacheDirectory = require('jest-cache-directory')
Package is ESM-first but also supports CJS with named export. Types are included.

Shows basic usage to get Jest cache directory with fallback to tmpdir/jest.

import { jestCacheDirectory } from 'jest-cache-directory'; const cacheDir = jestCacheDirectory(); console.log(cacheDir); // e.g., /tmp/jest_abc123 or /custom/path if JEST_CACHE_DIRECTORY set
Debug
Known issues
gotchaThe function returns a directory path based on `os.tmpdir()` which may not be persistent across reboots.
fix
Set JEST_CACHE_DIRECTORY environment variable to a persistent path if needed.
affects: *
Errors
Common errors & fixes
TypeError: jestCacheDirectory is not a function
Incorrect import/require style for CommonJS
fix
Use `const { jestCacheDirectory } = require('jest-cache-directory');` instead of default import.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies
find-cache-dirrequiredUsed to find the root cache directory when JEST_CACHE_DIRECTORY is not set
Agent activity
10 hits · last 30 days
node
10
Resources
jest-cache-directory — npm install jest-cache-directory · libregistry