如何解决 TypeError:environment.teardown 不是函数 [英] How to solve TypeError: environment.teardown is not a function

查看:17
本文介绍了如何解决 TypeError:environment.teardown 不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法测试使用 create-react-app 创建的应用程序.

I can't test an application which was created with create-react-app.

所有指南都说默认情况下测试正在运行,但是当我尝试纱线测试"时,它需要安装jest-cli"并且安装后出现错误:

All guides says that test is working by default, but when I try "yarn test", it requires install 'jest-cli' and after installation gives an error:

TypeError: environment.teardown 不是函数

TypeError: environment.teardown is not a function

推荐答案

您不需要自己安装 jest-cli.它应该是开箱即用的.

You shouldn't need to install jest-cli yourself. It should come out of the box.

尝试以下操作:

  1. 删除 package-lock.json、yarn.lock 和 node_modules
  2. 从 package.json 中的依赖项中删除 jest
  3. 然后执行 npm installyarn install.

这篇关于如何解决 TypeError:environment.teardown 不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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