How can I make jasmine.js stop after a test failure?
问题 I want the runner to stop after the first failure rather than running all the tests. 回答1: 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>