如何在create-react-app中更新Jest测试框架? [英] How to update Jest testing framework in create-react-app?

查看:246
本文介绍了如何在create-react-app中更新Jest测试框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有一个使用 create-react-app 软件包。
我发现Jest版本为15.1.1的错误。但是我意识到在版本16中该错误消失了。

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.

如何更新Jest?

我的问题是在应用程序的 package.json 中没有Jest软件包。

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

Jest在其他文件夹中: node_modules / react-scripts

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

推荐答案

以下命令将完成任务:

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

但是请小心! eject 命令不可逆地消除了 create-react-app 的抽象层,为您提供了所有依赖关系和配置。不过,您的应用将像以前一样运行。您只需完全控制它,包括更新依赖项的能力。

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.

这篇关于如何在create-react-app中更新Jest测试框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆