在Create-React-App中进行测试是自动处理的还是我需要创建/导入自定义测试?

发布于 2025-02-03 00:37:46 字数 140 浏览 3 评论 0原文

我正在使用Create-React-App来构建我的应用。我需要进行任何自定义测试,还是全部通过Create-React-App来处理?

另外,请在终端和控制台覆盖所有测试中收到的错误和提示,或者在发布应用程序之前需要做的其他操作。

谢谢

I'm using create-react-app to build my app. Do I need to do any custom testing or is it all handled by create-react-app?

Also, do the errors and prompts I receive in my terminal and console cover all testing or is there something else I need to do before releasing an app for production.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2025-02-10 00:37:46

我不确定您通过测试是什么意思……

如果您是指单元测试,那就不。 Create-React-App无法自动为您测试您的应用程序。它不知道您要对应用程序进行什么,因此无法测试它。

还是您是在谈论构建警告和错误?在这种情况下,创建反应应用程序将告诉您可以收集什么,这应该是相当多的,但是找不到可能的运行时错误。

无论如何,如果您希望测试涵盖的整个应用程序功能,则需要自己编写这些功能。如果您一般不熟悉测试,则可能需要查看一个或多个反应单元测试文章( https://felixgerschau.com/unit-testing-react--introduction/ 可能是起点),根据您想要看E2E测试的内容,也可能值得。

I'm not exactly sure what you mean by testing…

If you mean unit tests, then no. create-react-app can't automatically test your application for you. It has no idea what you're trying to acomplish with your application, so it can't test it.

Or are you talking about build warnings and errors? In that case create-react-app will tell you what it is able to gather, which should be quite a bit, but it can't find possible runtime errors.

In any case if you want your whole applications functionality covered by tests, you need to write those yourself. If you're not familiar with testing in general you may want to have a look at one or more react unit testing articles (https://felixgerschau.com/unit-testing-react-introduction/ could be starting point) and depending on what you want looking into e2e tests could also be worthwhile.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文