Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 735
wilcus Avatar asked Oct 07 '16 19:10

wilcus


People also ask

Is Jest included in Create React app?

Jest is a JavaScript testing framework that allows developers to run tests on JavaScript and TypeScript code and can be easily integrated with React JS. Open the package. json, and you will find that when you use create-react-app for creating a react project, it has default support for jest and react testing library.


2 Answers

Create React App updates its dependencies once they are stable enough. This usually means waiting a week or two after the new release.

We don't recommend updating anything by yourself unless this is absolutely critical. If you choose to eject to update something we recommend making it a single commit so that you can revert it later once Create React App uses that version internally.

like image 169
Dan Abramov Avatar answered Sep 23 '22 09:09

Dan Abramov


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.

like image 24
Konstantin Grushetsky Avatar answered Sep 22 '22 09:09

Konstantin Grushetsky