mercredi 27 avril 2016

Jasmine Tests Fail when Boot.js Included

I have bunch of tests which I was running through Visual Studio but now I am trying to implement the tests such that I can run them through the command line using Karma. After trying to use Karma my tests started to fail so I assumed that this was Karma's fault but now I think it might be linked to Jasmine.

I think it is linked to Jasmine because I started only including files I really needed into my karma.config.js file. I removed jasmine/boot.js and my tests stopped failing.

Let's say I have a test in this format...(as an example)

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

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

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

What would happen is my first describe would run, then the second describe and then the beforeEach and then the first it and so on. The problem was that after my test successfully ran it would run the its again without running the beforeEach and thus the tests would fail.

Example Output of Above Code

describe1
describe2(note that the "it"s are not executed)
beforeEach
it1
beforeEach
it2(so far so good but now...)
it1(notice how before each didn't run but the "it"s were reran here and below)
it2

Aucun commentaire:

Enregistrer un commentaire