单元测试期间热装 [英] Hot Reload during Unit testing
问题描述
我现在正在开发一个小型flutter应用程序.我认为与所有人一样,我爱上了热重装功能.
I develop right now a small flutter app. I think as everyone, I fell in love with the hot reload feature.
所以现在我想知道在单元测试期间是否有可能拥有相同的开发人员经验.一定要在某个地方转个旗,或者知道那是不可能的.
So now I'm wondering if there is any possibility to have the same developer experience during unit test. Do have to turn a flag somewhere or is it right know just no possible.
如果不可能,是否有任何计划使之成为可能?
If is not possible, are there any plans to make it possible?
推荐答案
我想您想要的是在新测试更改后立即运行它们.但是在那种情况下,它不是热装.仅仅是一个观察者,它可以检测您的源或测试是否已更改,然后重新启动它们.
I guess what you want is to run the new tests as soon as they changed. But in that case it's not a hot reload. Simply a watcher that detect whenever your sources or your tests have changed and restart them.
Flutter和较低的层还没有实现监视".尽管使用节点包可以很容易地达到类似的效果
Flutter, and the lower layers, don't implement "watch" yet. Although you can achieve a similar effect quite easily using a node packages
npm i -g手表
,它将在全局安装手表您可以在命令行中使用它.
npm i -g watch
which will install watch globally so that you can use it in as a command line.
然后在您的终端机上
监视"flutter测试" lib测试
,它将在lib和test文件夹中的任何更改每次运行 flutter测试
watch "flutter test" lib test
which will run flutter test
everytime something change inside lib and test folders
这篇关于单元测试期间热装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!