SET001
SET001

Reputation: 11718

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?

Upvotes: 9

Views: 3084

Answers (1)

alecxe
alecxe

Reputation: 473803

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.

Upvotes: 2

Related Questions