lundi 25 avril 2016

Jasmine Unit Tests Run Twice when using Karma

I'm trying to Unit Test and Angular app. I started off running my Unit Tests through Visual Studio 2015 with the Karma Plugin which worked fine but now I'm trying to run my tests through the Command Line and I've run into a couple issues.

My First issue is that some of my tests are executing twice and I know this because I only have one console.log in all of my files and it is located in one test that console.log is printing twice.

I found a solution to my tests running twice:

    {
        pattern: __dirname + "/app/test/whatever.spec.js", included: false
    }

I found the above solution online but when I tried to include my spec files in Karma.config like that I kept getting an

Uncaught TypeError: Cannot read property 'appendChild' of null

from the jasmine-html.js file.

I looked at that file and found that it was failing at this line

var alert = find('.jasmine-alert');

but the only other place which contained that specific class was

createDom('div', {className: 'jasmine-alert'}),

in an earlier this.initialize function.

I'm not sure what my issue might be, maybe I'm not including my spec files in the correct order?

1 commentaire: