{"id":45185,"library":"jest-cache-directory","title":"jest-cache-directory","description":"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.","status":"active","version":"1.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/bluelovers/ws-jest","tags":["javascript","jest","cache","directory","create-by-yarn-tool","create-by-tsdx","typescript"],"install":[{"cmd":"npm install jest-cache-directory","lang":"bash","label":"npm"},{"cmd":"yarn add jest-cache-directory","lang":"bash","label":"yarn"},{"cmd":"pnpm add jest-cache-directory","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used to find the root cache directory when JEST_CACHE_DIRECTORY is not set","package":"find-cache-dir","optional":false}],"imports":[{"note":"Package is ESM-first but also supports CJS with named export. Types are included.","wrong":"const jestCacheDirectory = require('jest-cache-directory')","symbol":"jestCacheDirectory","correct":"import { jestCacheDirectory } from 'jest-cache-directory'"}],"quickstart":{"code":"import { jestCacheDirectory } from 'jest-cache-directory';\n\nconst cacheDir = jestCacheDirectory();\nconsole.log(cacheDir); // e.g., /tmp/jest_abc123 or /custom/path if JEST_CACHE_DIRECTORY set","lang":"typescript","description":"Shows basic usage to get Jest cache directory with fallback to tmpdir/jest."},"warnings":[{"fix":"Set JEST_CACHE_DIRECTORY environment variable to a persistent path if needed.","message":"The function returns a directory path based on `os.tmpdir()` which may not be persistent across reboots.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'/jest':23 '1.0.6':25 'api':35 'cach':3,10,15,37,49 'creat':52,57 'create-by-tsdx':56 'create-by-yarn-tool':51 'definit':42 'design':43 'directori':4,11,16,38,50 'environ':17,46 'fallback':20 'javascript':47 'jest':2,9,14,48 'jest-cache-directori':1 'node.js':45 'os.tmpdir':22 'provid':32 'recent':30 'resolut':39 'resolv':7 'ship':40 'simpl':34 'stabl':27 'tool':55 'tsdx':59 'typescript':41,60 'updat':31 'util':5 'variabl':18 'version':24 'yarn':54","created_at":"2026-06-07T12:53:46.995992+00:00","updated_at":"2026-06-07T12:53:46.995992+00:00","problems":[{"fix":"Use `const { jestCacheDirectory } = require('jest-cache-directory');` instead of default import.","cause":"Incorrect import/require style for CommonJS","error":"TypeError: jestCacheDirectory is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/bluelovers/ws-jest/tree/master/packages/jest-cache-directory#readme","github":"https://github.com/bluelovers/ws-jest","docs":null,"changelog":null,"pypi":null,"npm":"jest-cache-directory","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}