Search code examples
node.jsreactjscreate-react-app

How to update Jest testing framework in create-react-app?


I already have an application created with create-react-app package. I found a bug with the version of Jest which is 15.1.1. But I realized that in version 16 the bug is gone.

How to update Jest?

My problem is in the package.json of application there is no Jest package.

Jest is in other folder: node_modules/react-scripts.


Solution

  • The following commands are going to get the job done:

    npm run eject
    npm install --save-dev [email protected]
    

    But be careful here! The eject command irreversibly eliminates the abstraction layer of create-react-app exposing all of the dependencies and configuration to you. Though, your app is going to work just like before. You'll just have total control upon it, including the ability to update dependencies.