vendredi 26 juin 2015

AngularJS unit tests in TypeScript with Jasmine are not run

I use AngularJS with TypeScript in a Web application in Visual Studio 2013. I can run tests in JavaScript just fine, but the tests written in TypeScript are not run. In fact, the ReSharper Test Runner displays a "Test Not Run" status for every test written in TypeScript, and I have no idea why. When I read blogs about this topic, they describe exactly what I do.

My code for such a unit test is:

/// <reference path="../typings/jasmine/jasmine.d.ts" />
/// <reference path="../AngularApp/Models/Member.ts" />
/// <reference path="../AngularApp/Models/Contract.ts" />


describe("Member", () => {
    "use strict";

    var contracts = new Array<App.Controllers.Contract>();
    var sut = new App.Controllers.Member("Elvis", "Presley", "350108-11.2222",
        new Date("1935-01-08"), new Date("1977-08-16"), "M", "Home", "", "90210", "Graceland",
        contracts);

    it("must not be null", () => {
        expect(sut).not.toBeNull();
    });


    it("must contain zero Contracts", () => {
        expect(sut.contracts).not.toBeNull();
        expect(sut.contracts.length).toBe(0);
    });    
});

What can cause this problem?

Aucun commentaire:

Enregistrer un commentaire