admin管理员组文章数量:1386666
In my tests, there are lots of expects. But some of them may not be severe enough to stop the tests. Could I ignore the error at a moment and throw them at the end of the test?
In my tests, there are lots of expects. But some of them may not be severe enough to stop the tests. Could I ignore the error at a moment and throw them at the end of the test?
Share Improve this question edited May 20, 2016 at 13:54 MBielski 6,6103 gold badges35 silver badges45 bronze badges asked May 20, 2016 at 13:37 isian8814isian8814 1911 silver badge10 bronze badges 1- By default, jasmine would not stop once an expectation fails and the execution would continue to the next line.. – alecxe Commented May 20, 2016 at 13:38
1 Answer
Reset to default 10The jasmine expectations are kind of "soft" by default. In a sense that the test execution continues after a failure.
In other words, if you have the following code:
expect(true).toBe(false);
expect(false).toBe(true);
you would get a test failure with 2 unmet expectations.
A mon problem is an exact opposite of what you are asking about - how to turn the behavior off so that jasmine would fail the test after the very first expect fails - this is now solved by stopSpecOnExpectationFailure
option which is false
by default.
本文标签: javascriptdoes jasmine have soft assertion using expect()Stack Overflow
版权声明:本文标题:javascript - does jasmine have soft assertion using expect()? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744522882a2610564.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论