如何在测试失败后让jasmine.js停止? [英] How can I make jasmine.js stop after a test failure?
本文介绍了如何在测试失败后让jasmine.js停止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望跑步者在第一次失败后停止而不是运行所有测试。
I want the runner to stop after the first failure rather than running all the tests.
推荐答案
这是一个黑客,但是你可以在第一次测试之前插入这个脚本来做到这一点;
It's a hack, but you can do this by inserting this script before your first test;
<script type="text/javascript">
// after every test has run
afterEach(function () {
// check if any have failed
if(this.results_.failedCount > 0) {
// if so, change the function which should move to the next test
jasmine.Queue.prototype.next_ = function () {
// to instead skip to the end
this.onComplete();
}
}
});
</script>
Jasmine在申请时的最新提交是 https://github.com/pivotal/jasmine/commit/8b02bf731b193e135ccb486e99b3ecd7165bf95c
Jasmine's latest commit at the time of applying this was https://github.com/pivotal/jasmine/commit/8b02bf731b193e135ccb486e99b3ecd7165bf95c
这篇关于如何在测试失败后让jasmine.js停止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文