Unit testing TypeScript with Jasmine and Resharper 10

Using Resharper 10 in VS2015, I'm writing tests with TypeScript, but I'm not sure how to reference my application code.

I've chosen Jasmine in the ReSharper settings, and installed PhantomJS - the tests run fine, but they fail with ReferenceError: Can't find variable.

e.g.

describe("SampleTest", () => {
    var model;
    beforeEach(() => {
        model = new Application.Models.Document();
    });
    it("spec", () => {
        expect(true).toBe(true);
    });
});

In the above example, Application is the variable that can't be found.

How do I tell Resharper which .ts files are part of the code to be tested? I had thought it would pick up on any in the project.

3 comments
Comment actions Permalink

Hello Robin

  Have you tried to add a direct reference to a code file at the top of test file ///<reference path="path/to/code_file.d.ts"/>?

Thanks!

0
Comment actions Permalink

Thanks Alexander.

I have indeed, but it doesn't seem to have made a difference.

Also, my application is large: >100 TypeScript files. I don't think it's realistic to have to had references to them all!

0
Comment actions Permalink

Hello Robin,

Are you able to reproduce such issue in a demo solution and attach it here or create a new support request with it ("Submit a Request" above)? Since we have no idea what is exactly wrong.

Thanks! 

0

Please sign in to leave a comment.