Skip to content

Support workerIdleMemoryLimit as a Jest configuration option #13250

Open
@IPWright83

Description

@IPWright83

Is your proposal related to a problem?

Jest has memory leaks on versions of Node > 16.11.0+ which in large projects cause a significant slow down when running the tests. To mitigate this Jest 29 added the workerIdleMemoryLimit configuration option to help Jest restart and stop endlessly consuming memory. Unfortunately you can't set this due to the restriction on supported Jest keys without ejecting:

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

  • clearMocks
  • collectCoverageFrom
  • coveragePathIgnorePatterns
  • coverageReporters
  • coverageThreshold
  • displayName
  • extraGlobals
  • globalSetup
  • globalTeardown
  • moduleNameMapper
  • resetMocks
  • resetModules
  • restoreMocks
  • snapshotSerializers
  • testMatch
  • transform
  • transformIgnorePatterns
  • watchPathIgnorePatterns.

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

  • workerIdleMemoryLimit

If you wish to override other Jest options, you need to eject from the default setup. You can do so by running npm run eject but remember that this is a one-way operation. You may also file an issue with Create React App to discuss supporting more options out of the box.

Describe the solution you'd like

It would be incredibly helpful if we could set the workerIdleMemoryLimit and pass that through to Jest so we don't need to eject, as there is no CLI option avaliable.

Describe alternatives you've considered

  • Looking for a CLI option I could pass directly through instead
  • Ejecting, but I don't want to really...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions