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

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

问题描述

我无法测试使用create-react-app创建的应用程序,所有指南均表示该测试默认情况下有效,但是当我尝试纱线测试"时,它要求安装"jest-cli",并且安装后出现错误"TypeError :environment.teardown不是函数".

i cant test application which created with create-react-app, 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 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天全站免登陆