npm测试---coverage永不退出 [英] npm test -- --coverage never exits

查看:240
本文介绍了npm测试---coverage永不退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 create-react-app 创建一个React应用程序。当我执行 npm测试---coverage 时,该测试就不存在了。 npm test实际上运行 react-scripts测试。有想法吗?

I am using create-react-app to create a react application. When I executes npm test -- --coverage the test never exists. npm test actually runs react-scripts test. Any Idea?

推荐答案

---coverage 部分将不起作用,应使用以下命令之一设置 CI true

-- --coverage part won't work, and should use one of the commands below to set CI to true.


默认情况下,npm test使用交互式CLI运行观察程序。但是,您可以通过设置一个名为CI的环境变量来强制它运行一次测试并完成该过程。

By default npm test runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called CI.

来源:React文档


  • set CI = true& npm test

set CI = true& npm run build


  • ($ env:CI = true)-和(npm test)

($ env:CI = true)-和(npm run build)


  • CI = true npm test

CI = true npm run构建

不包括在docs

docker run -e CI = true [myImage ] npm运行测试

这篇关于npm测试---coverage永不退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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