如果发现附加错误,如何“强制"所有业力测试失败? [英] How can I 'force' ALL karma test to fail if an eslint error is found?
问题描述
我发现有时候人们在运行测试时并没有意识到他们有掉毛错误,因为它们是在测试进度/信息之前显示的.
I have found that sometimes people do not realise they have linting errors in their tests when they run them since they are show before the test progress/information.
是否有任何配置如果任何测试有任何掉毛错误都将导致所有测试失败?
Is there any configuration which will cause ALL tests to fail if any of the tests have any linting errors?
我正在将摩卡咖啡与业力一起使用.
I am using mocha with karma.
谢谢.
推荐答案
使ESLint
执行成为grunt
或gulp
或"npm"任务(无论使用哪种)的一部分.例如,当我们运行grunt test
时,首先执行ESLint
,然后执行karma
.如果ESLint
产生任何错误或警告,则该任务将尽早失败.
Make the ESLint
execution a part of the grunt
or gulp
or "npm" task (whichever you use). For instance, when we run grunt test
, first the ESLint
is executed and then karma
. If there are any errors or warnings produced by ESLint
the task would fail early.
这篇关于如果发现附加错误,如何“强制"所有业力测试失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!