9

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?

SET001
  • 11,480
  • 6
  • 52
  • 76
  • 1
    `beforeAll` doesn't take the async `done` param (see http://jasmine.github.io/2.2/introduction.html#section-49) – hankduan Mar 10 '15 at 18:58
  • @hankduan, in fact `beforeAll` does take one promise parameter, at least in jasmine 2.2.1. Check it yourself. – SET001 Mar 16 '15 at 16:53

1 Answers1

2

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

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.

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195