Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent tests execution in beforeAll block in jasmine?

Before all my tests (running in jasmine under protractor) I have to login to my system and if login fails I should not run any test. But even when I use proccess.exit (which is node feature to halt program execution), tests are still executed and all failed .

beforeAll(function(done){
    mainPage.resize();
    loginPage.login(env.regularUser).then(function(){
        mainPage.navigate();
        mainPage.waitLoading();
        done();
    }, function(){
        process.exit(1);
    });
});

How can I prevent tests execution in beforeAll block?

like image 869
SET Avatar asked Mar 10 '15 12:03

SET


1 Answers

If I understand correctly, this is the same or a related problem to:

  • Does jasmine-node offer any type of "fail fast" option?
  • Feature Request - fail-fast option
  • Bail on first failure
  • --fail-fast CLI option
  • Quitting on first failure

In other words, this is something a testing framework (in this case jasmine) should have. At the moment, this is an open feature request.

As a current workaround, use jasmine-bail-fast third-party package.

like image 140
alecxe Avatar answered Sep 27 '22 20:09

alecxe