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

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

问题描述

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

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

所有指南都说该测试默认情况下有效,但是当我尝试"yarn test"时,它需要安装"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中的依赖项中删除笑话
  3. 然后执行npm installyarn install.
  1. Delete package-lock.json, yarn.lock and node_modules
  2. Remove jest from the dependencies in package.json
  3. Then do npm install or yarn install.

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

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