Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #2687
Closed
Open
Issue created Jun 29, 2017 by Administrator@rootContributor

Allow specifying jest's `cacheDirectory`

Created by: nerfologist

Hi, this proposal is related to issue https://github.com/facebook/jest/issues/3705 (jest cache is not handled correctly upon moving files from point A to point B. This eventually causes coverage information to be displayed incorrectly).

For this reason, it would be nice to have a way to clear the jest cache manually when required. In order to do that, it would be useful to have a way to set the cache directory.

This is possible in Jest by setting the cacheDirectory config option in package.json (or from the command line). Unfortunately, in an application created with create-react-app, this config option is among those which cannot be overridden:

Out of the box, Create React App only supports overriding these Jest options:

  • collectCoverageFrom
  • coverageReporters
  • coverageThreshold
  • snapshotSerializers.

These options in your package.json Jest configuration are not currently supported by Create React App:

  • cacheDirectory

Without being able to set cacheDirectory, the cache files are created in a random-looking temporary directory such as /private/var/folders/zj/112vf5bj0js_hx6l9ntz3w780000gn/T/jest_dx (at least on my Mac Os X Sierra machine).

I think it would be useful to be able to set cacheDirectory to something more predictable, such as ./node_modules/.cache/jest, or even ./.cache/jest.

What do you think?

Thanks in advance for this awesome tool!

Assignee
Assign to
Time tracking