How to update Jest testing framework in create-rea

2019-05-16 05:40发布

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.

2条回答
疯言疯语
2楼-- · 2019-05-16 06:22

The following commands are going to get the job done:

npm run eject
npm install --save-dev jest@16.0.0

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.

查看更多
贪生不怕死
3楼-- · 2019-05-16 06:37

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.

查看更多
登录 后发表回答