lundi 31 août 2015

How do I get Karma Coverage to detect correctly

I'm using Jenkins to run my Karma tests of Angular, but the coverage shows 20% even though its actually 100%. How does Karma Coverage test for coverage, and how can I write my tests so they should be correctly detected?

For example if my test looks like:

describe("ControllerName function xYz removes a query", function() {
    it("tests that the query was removed", function() {
        spyOn('ControllerName',xYz);
        ControllerName.xYz();
        expect(ControllerName.xYz).toHaveBeenCalled();
    });
});

Should the describe or it have only the controller name or function name for the coverage to be detected?

Aucun commentaire:

Enregistrer un commentaire