mardi 26 avril 2016

Jasmine - Before Each Block Not Executing

I have a few test cases in this sort of format.

describe(() => {
    console.log("describe1");
    beforeEach(() => {
        console.log("beforeEach");
    });

    describe(() => {
        console.log("describe2");
        it(() => {
            console.log("it1");
        })

        it(() => {
            console.log("it2");
        })
    });
});

The problem I'm having is that I get every single test running perfectly but then when all the tests have ran it runs every test again but without running the beforeEach blocks which is making my tests fail.

So the above code would print as such...

describe1
describe2(note that the "it"s are not executed)
beforeEach
it1
beforeEach
it2(so far so good but now...)
it1
it2

So what I'm not understanding is why it1 and it2 run again without the before each.

Note: I am running this code using Karma Test Runner

Aucun commentaire:

Enregistrer un commentaire