我喜欢在我进行测试时让mocha -w
在终端中运行,所以我得到了即时反馈,但我无法一眼就看出状态是否有所改变不会改变 - 它是否运行,或者它是否被卡住(它已经发生)?
我希望有一种方法可以在每次测试运行结束时附加时间戳,但理想情况下,只有在' watch'模式 - 如果我手动运行它,当然我知道它是否运行。
现在,我将异步控制台日志附加到上次运行的测试中:
it('description', function () {
// real test parts.should.test.things();
// Trick - schedule the time to be printed to the log - so I can see when it was run last
setTimeout(() => console.log(new Date().toDateString() + " @ " + new Date().toTimeString()), 5);
});
显然,由于以下几个原因,这是丑陋和糟糕的:
我看过一些对mocha的引用,用命令行args添加global.it
对象,可以搜索' -w'国旗,但这甚至更加丑陋,但仍然无法解决大部分问题。
是否有其他一些mocha附加模块可以提供此功能?或者我可能忽略了选项中的某些内容?或者也许我真的不应该这样做,我开始做错了吗?